//CPU TIME void TerminationCriterionTest::test_cpu_time_common( bool inner ) { MsqPrintError err(std::cout); PatchData pd; double LIMIT = 0.5; TerminationCriterion tc; tc.add_cpu_time(LIMIT); if (inner) tc.reset_inner( pd, ofEval, err ); else tc.reset_outer( 0, 0, ofEval, 0, err ); ASSERT_NO_ERROR(err); tc.reset_patch( pd, err ); ASSERT_NO_ERROR(err); Timer timer; while (timer.since_birth() < 0.5*LIMIT) { CPPUNIT_ASSERT(!tc.terminate()); tc.accumulate_patch( pd, err ); ASSERT_NO_ERROR(err); if (inner) tc.accumulate_inner( pd, 0, 0, err ); else tc.accumulate_outer( 0, 0, ofEval, 0, err ); ASSERT_NO_ERROR(err); } while (timer.since_birth() < 1.1*LIMIT); tc.accumulate_patch( pd, err ); ASSERT_NO_ERROR(err); if (inner) tc.accumulate_inner( pd, 0, 0, err ); else tc.accumulate_outer( 0, 0, ofEval, 0, err ); ASSERT_NO_ERROR(err); CPPUNIT_ASSERT(tc.terminate()); }