void perform_test_trivial() { Benchmark s; typedef ParserResultElement<Benchmark> Parser; Parser p(s); { const std::string test = "bench123"; OKLIB_TESTTRIVIAL_RETHROW(::OKlib::Parser::Test_ParsingString<Parser>(p, test, ::OKlib::Parser::match_full)); if(s.name() != test) OKLIB_THROW("Resulting name is " + s.name() + ", and not " + test); } }
int BenchmarkRunner::run() { typedef std::vector<Benchmark *>::iterator iterator; try { _options.parse(); } catch(const std::exception &ex) { std::cerr << ex.what() << std::endl; return EXIT_FAILURE; } _log.verbose(_verbose); for(iterator i = _benchmarks.begin(), e = _benchmarks.end(); i != e; ++i) { Benchmark *bench = *i; try { _log << "*** Start benchmark " << bench->name() << std::endl; bench->setup(); for(unsigned j = 0, f = _times; j != f; ++j) bench->execute(); bench->teardown(); _log.verbose(true); _log << bench->name(); bench->report(); _log << std::endl; _log.verbose(_verbose); _log << "*** End benchmark " << bench->name() << std::endl; } catch(const std::exception &ex) { _log << ex.what() << std::endl << "*** End benchmark " << bench->name() << std::endl; return EXIT_FAILURE; } } return EXIT_SUCCESS; }