| 173 | } |
| 174 | |
| 175 | bool |
| 176 | IntTest::run(void) { |
| 177 | using namespace Gecode; |
| 178 | IntTestSpace* root = new IntTestSpace(arity,dom); |
| 179 | post(*root, root->x); |
| 180 | (void) root->status(); |
| 181 | |
| 182 | for (int val = 0; val<n_int_assign; val++) { |
| 183 | IntTestSpace* clone = static_cast<IntTestSpace*>(root->clone()); |
| 184 | Gecode::Search::Options o; |
| 185 | o.a_d = _rand(10); |
| 186 | o.c_d = _rand(10); |
| 187 | |
| 188 | Rnd r(1); |
| 189 | IntAssign ia; |
| 190 | switch (val) { |
| 191 | case 0: ia = INT_ASSIGN_MIN(); break; |
| 192 | case 1: ia = INT_ASSIGN_MED(); break; |
| 193 | case 2: ia = INT_ASSIGN_MAX(); break; |
| 194 | case 3: ia = INT_ASSIGN_RND(r); break; |
| 195 | case 4: ia = INT_ASSIGN(&int_val); break; |
| 196 | default: GECODE_NEVER; |
| 197 | } |
| 198 | |
| 199 | assign(*clone, clone->x, ia); |
| 200 | Gecode::DFS<IntTestSpace> e_s(clone, o); |
| 201 | delete clone; |
| 202 | |
| 203 | // Find number of solutions |
| 204 | int solutions = 0; |
| 205 | while (Space* s = e_s.next()) { |
| 206 | delete s; solutions++; |
| 207 | } |
| 208 | if (solutions != 1) { |
| 209 | std::cout << "FAILURE" << std::endl |
| 210 | << "\tc_d=" << o.c_d << ", a_d=" << o.a_d << std::endl |
| 211 | << "\t" << int_assign_name[val] << std::endl; |
| 212 | delete root; |
| 213 | return false; |
| 214 | } |
| 215 | } |
| 216 | delete root; |
| 217 | return true; |
| 218 | } |
| 219 | |
| 220 | BoolTest::BoolTest(const std::string& s, int a) |
| 221 | : Base("Bool::Assign::"+s), arity(a) { |
nothing calls this directly
no test coverage detected