test main loop