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

Method run

test/int/distinct.cpp:218–256  ·  view source on GitHub ↗

Perform test

Source from the content-addressed store, hash-verified

216 Test::str(n0)+"::"+Test::str(ipl0)), n(n0), ipl(ipl0) {}
217 /// Perform test
218 virtual bool run(void) {
219 using namespace Gecode;
220 {
221 TestSpace* s = new TestSpace;
222 IntVarArgs x(n);
223 for (int i=0; i<n; i++)
224 x[i] = IntVar(*s,0,i);
225 distinct(*s,x,ipl);
226 if (s->status() == SS_FAILED) {
227 delete s; return false;
228 }
229 for (int i=0; i<n; i++)
230 if (!x[i].assigned() || (x[i].val() != i)) {
231 delete s; return false;
232 }
233 delete s;
234 }
235 {
236 TestSpace* s = new TestSpace;
237 IntVarArgs x(2*n);
238 for (int i=0; i<n; i++) {
239 int v[] = {0,i};
240 IntSet d(v,2);
241 x[i] = IntVar(*s,d);
242 }
243 for (int i=n; i<2*n; i++)
244 x[i] = IntVar(*s,n-1,i);
245 distinct(*s,x,ipl);
246 if (s->status() == SS_FAILED) {
247 delete s; return false;
248 }
249 for (int i=0; i<n; i++)
250 if (!x[i].assigned() || (x[i].val() != i)) {
251 delete s; return false;
252 }
253 delete s;
254 }
255 return true;
256 }
257 };
258
259 const int v[7] = {-1001,-1000,-10,0,10,1000,1001};

Callers

nothing calls this directly

Calls 5

distinctFunction · 0.85
IntVarClass · 0.70
statusMethod · 0.45
assignedMethod · 0.45
valMethod · 0.45

Tested by

no test coverage detected