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

Method run

test/test.cpp:405–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403 : tec(tec), initial_seed(initialSeed) {}
404
405 void run(void) override {
406 // Set up a local source of randomness seeds based on the initial seed supplied.
407 Gecode::Support::RandomGenerator seed_sequence(initial_seed);
408
409 // Loop runs tests continuously in batches from the test execution control
410 while (true) {
411 // Get next batch
412 const std::pair<size_t, size_t>& start_and_size = tec.next_batch();
413 const size_t batch_start = start_and_size.first;
414 const size_t batch_size = start_and_size.second;
415 if (batch_start >= tec.tests.size()) {
416 // No more tests to run
417 break;
418 }
419 // Run each test in the batch, handling output and failures
420 for (size_t i = batch_start; i < batch_start + batch_size && i < tec.tests.size(); ++i) {
421 if (!tec.continue_testing()) {
422 break;
423 }
424 auto test = tec.tests[i];
425 unsigned int test_seed = seed_sequence.next();
426 std::ostringstream test_output;
427 if (!run_test(test, test_seed, tec.options, test_output)) {
428 tec.set_failure();
429 }
430 tec.write_output(test_output.str());
431 }
432 if (!tec.continue_testing()) {
433 break;
434 }
435 }
436
437 // Signal that this thread is done. Last one signals the waiting main thread.
438 tec.thread_done();
439 }
440 };
441
442 /// Run all the tests with the supplied options i parallel.

Callers 1

run_testFunction · 0.45

Calls 9

run_testFunction · 0.85
next_batchMethod · 0.80
continue_testingMethod · 0.80
set_failureMethod · 0.80
write_outputMethod · 0.80
thread_doneMethod · 0.80
sizeMethod · 0.45
nextMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected