| 465 | Gecode::Reify) {} |
| 466 | |
| 467 | bool |
| 468 | Test::run(void) { |
| 469 | using namespace Gecode; |
| 470 | const char* test = "NONE"; |
| 471 | const char* problem = "NONE"; |
| 472 | |
| 473 | // Set up assignments |
| 474 | Assignment* ap = assignment(); |
| 475 | Assignment& a = *ap; |
| 476 | |
| 477 | // Set up space for all solution search |
| 478 | TestSpace* search_s = new TestSpace(arity,dom,this); |
| 479 | post(*search_s,search_s->x); |
| 480 | branch(*search_s,search_s->x,INT_VAR_NONE(),INT_VAL_MIN()); |
| 481 | Search::Options search_o; |
| 482 | search_o.threads = 1; |
| 483 | DFS<TestSpace> e_s(search_s,search_o); |
| 484 | delete search_s; |
| 485 | |
| 486 | while (a.has_more()) { |
| 487 | bool sol = solution(a); |
| 488 | if (opt.log) { |
| 489 | olog << ind(1) << "Assignment: " << a |
| 490 | << (sol ? " (solution)" : " (no solution)") |
| 491 | << std::endl; |
| 492 | } |
| 493 | |
| 494 | START_TEST("Assignment (after posting)"); |
| 495 | { |
| 496 | TestSpace* s = new TestSpace(arity,dom,this); |
| 497 | TestSpace* sc = nullptr; |
| 498 | s->post(); |
| 499 | switch (_rand(2)) { |
| 500 | case 0: |
| 501 | if (opt.log) |
| 502 | olog << ind(3) << "No copy" << std::endl; |
| 503 | sc = s; |
| 504 | s = nullptr; |
| 505 | break; |
| 506 | case 1: |
| 507 | if (opt.log) |
| 508 | olog << ind(3) << "Copy" << std::endl; |
| 509 | if (s->status() != SS_FAILED) { |
| 510 | sc = static_cast<TestSpace*>(s->clone()); |
| 511 | } else { |
| 512 | sc = s; s = nullptr; |
| 513 | } |
| 514 | break; |
| 515 | default: assert(false); |
| 516 | } |
| 517 | sc->assign(a, false, _rand); |
| 518 | if (sol) { |
| 519 | CHECK_TEST(!sc->failed(), "Failed on solution"); |
| 520 | CHECK_TEST(sc->propagators()==0, "No subsumption"); |
| 521 | } else { |
| 522 | CHECK_TEST(sc->failed(), "Solved on non-solution"); |
| 523 | } |
| 524 | delete s; delete sc; |
no test coverage detected