36 tout <<
"Test with " << n <<
" repetitions took " << time1 <<
" secs\n";
37 unsigned n_new = n * 10;
39 SKIP_TEST(
"Can't count enough repetitions to be able to time test");
41 }
while (time1 <= 0.001);
43 double time10 = func(n);
44 tout <<
"Test with " << n <<
" repetitions took " << time10 <<
" secs\n";
46 TEST_REL(time10,<,time1 * threshold);
Test how an operation scales.
a generic test suite engine
#define TEST_REL(A, REL, B)
Test a relation holds,e.g. TEST_REL(a,>,b);.
std::ostringstream tout
The debug printing stream.
void test_scalability(double(*func)(unsigned), unsigned n, double threshold)
#define SKIP_TEST(MSG)
Skip the current testcase with message MSG.