MCPcopy Create free account
hub / github.com/Gecode/gecode / run_test

Function run_test

test/test.cpp:251–276  ·  view source on GitHub ↗

Run a single test, returning true iff the test succeeded

Source from the content-addressed store, hash-verified

249
250 /// Run a single test, returning true iff the test succeeded
251 bool run_test(Base* test, unsigned int test_seed, const Options& options, std::ostream& ostream) {
252 try {
253 ostream << test->name() << " ";
254 ostream.flush();
255 test->_rand.seed(test_seed);
256 for (unsigned int i = options.iter; i--;) {
257 unsigned int seed = test->_rand.seed();
258 if (test->run()) {
259 ostream << '+';
260 ostream.flush();
261 } else {
262 ostream << "-" << std::endl;
263 report_error(test->name(), seed, opt, ostream);
264 return false;
265 }
266 }
267 ostream << std::endl;
268 return true;
269 } catch (Gecode::Exception& e) {
270 ostream << "Exception in \"Gecode::" << e.what()
271 << "." << std::endl
272 << "Stopping..." << std::endl;
273 report_error(test->name(), options.seed, opt, ostream);
274 return false;
275 }
276 }
277
278 /// Run all the tests with the supplied options.
279 int run_tests(const std::vector<Base*>& tests, const Options& options) {

Callers 2

run_testsFunction · 0.85
runMethod · 0.85

Calls 6

report_errorFunction · 0.85
nameMethod · 0.45
flushMethod · 0.45
seedMethod · 0.45
runMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected