00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include "test/int.hh"
00041
00042 #include <gecode/minimodel.hh>
00043 #include <climits>
00044
00045 namespace Test { namespace Int {
00046
00048 namespace Extensional {
00049
00055
00056 class RegSimpleA : public Test {
00057 public:
00059 RegSimpleA(void) : Test("Extensional::Reg::Simple::A",4,2,2) {}
00061 virtual bool solution(const Assignment& x) const {
00062 return (((x[0] == 0) || (x[0] == 2)) &&
00063 ((x[1] == -1) || (x[1] == 1)) &&
00064 ((x[2] == 0) || (x[2] == 1)) &&
00065 ((x[3] == 0) || (x[3] == 1)));
00066 }
00068 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00069 using namespace Gecode;
00070 extensional(home, x,
00071 (REG(0) | REG(2)) +
00072 (REG(-1) | REG(1)) +
00073 (REG(7) | REG(0) | REG(1)) +
00074 (REG(0) | REG(1)));
00075 }
00076 };
00077
00079 class RegSimpleB : public Test {
00080 public:
00082 RegSimpleB(void) : Test("Extensional::Reg::Simple::B",4,2,2) {}
00084 virtual bool solution(const Assignment& x) const {
00085 return (x[0]<x[1]) && (x[1]<x[2]) && (x[2]<x[3]);
00086 }
00088 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00089 using namespace Gecode;
00090 extensional(home, x,
00091 (REG(-2) + REG(-1) + REG(0) + REG(1)) |
00092 (REG(-2) + REG(-1) + REG(0) + REG(2)) |
00093 (REG(-2) + REG(-1) + REG(1) + REG(2)) |
00094 (REG(-2) + REG(0) + REG(1) + REG(2)) |
00095 (REG(-1) + REG(0) + REG(1) + REG(2)));
00096 }
00097 };
00098
00100 class RegSimpleC : public Test {
00101 public:
00103 RegSimpleC(void) : Test("Extensional::Reg::Simple::C",6,0,1) {}
00105 virtual bool solution(const Assignment& x) const {
00106 int pos = 0;
00107 int s = x.size();
00108
00109 while (pos < s && x[pos] == 0) ++pos;
00110 if (pos + 4 > s) return false;
00111
00112 for (int i = 0; i < 2; ++i, ++pos)
00113 if (x[pos] != 1) return false;
00114 if (pos + 2 > s) return false;
00115
00116 for (int i = 0; i < 1; ++i, ++pos)
00117 if (x[pos] != 0) return false;
00118 while (pos < s && x[pos] == 0) ++pos;
00119 if (pos + 1 > s) return false;
00120
00121 for (int i = 0; i < 1; ++i, ++pos)
00122 if (x[pos] != 1) return false;
00123 while (pos < s) if (x[pos++] != 0) return false;
00124 return true;
00125
00126 }
00128 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00129 using namespace Gecode;
00130 extensional(home, x,
00131 *REG(0) + REG(1)(2,2) + +REG(0) + REG(1)(1,1) + *REG(0));
00132 }
00133 };
00134
00136 class RegDistinct : public Test {
00137 public:
00139 RegDistinct(void) : Test("Extensional::Reg::Distinct",4,-1,4) {}
00141 virtual bool solution(const Assignment& x) const {
00142 for (int i=0; i<x.size(); i++) {
00143 if ((x[i] < 0) || (x[i] > 3))
00144 return false;
00145 for (int j=i+1; j<x.size(); j++)
00146 if (x[i]==x[j])
00147 return false;
00148 }
00149 return true;
00150 }
00152 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00153 using namespace Gecode;
00154 extensional(home, x,
00155 (REG(0)+REG(1)+REG(2)+REG(3)) |
00156 (REG(0)+REG(1)+REG(3)+REG(2)) |
00157 (REG(0)+REG(2)+REG(1)+REG(3)) |
00158 (REG(0)+REG(2)+REG(3)+REG(1)) |
00159 (REG(0)+REG(3)+REG(1)+REG(2)) |
00160 (REG(0)+REG(3)+REG(2)+REG(1)) |
00161 (REG(1)+REG(0)+REG(2)+REG(3)) |
00162 (REG(1)+REG(0)+REG(3)+REG(2)) |
00163 (REG(1)+REG(2)+REG(0)+REG(3)) |
00164 (REG(1)+REG(2)+REG(3)+REG(0)) |
00165 (REG(1)+REG(3)+REG(0)+REG(2)) |
00166 (REG(1)+REG(3)+REG(2)+REG(0)) |
00167 (REG(2)+REG(0)+REG(1)+REG(3)) |
00168 (REG(2)+REG(0)+REG(3)+REG(1)) |
00169 (REG(2)+REG(1)+REG(0)+REG(3)) |
00170 (REG(2)+REG(1)+REG(3)+REG(0)) |
00171 (REG(2)+REG(3)+REG(0)+REG(1)) |
00172 (REG(2)+REG(3)+REG(1)+REG(0)) |
00173 (REG(3)+REG(0)+REG(1)+REG(2)) |
00174 (REG(3)+REG(0)+REG(2)+REG(1)) |
00175 (REG(3)+REG(1)+REG(0)+REG(2)) |
00176 (REG(3)+REG(1)+REG(2)+REG(0)) |
00177 (REG(3)+REG(2)+REG(0)+REG(1)) |
00178 (REG(3)+REG(2)+REG(1)+REG(0)));
00179 }
00180 };
00181
00183 class RegRoland : public Test {
00184 public:
00186 RegRoland(int n)
00187 : Test("Extensional::Reg::Roland::"+str(n),n,0,1) {}
00189 virtual bool solution(const Assignment& x) const {
00190 int n = x.size();
00191 return
00192 ((n > 1) && (x[n-2] == 0)) ||
00193 ((n > 0) && (x[n-1] == 0));
00194 }
00196 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00197 using namespace Gecode;
00198 REG r0(0), r1(1);
00199 REG r01 = r0 | r1;
00200 extensional(home, x, *r01 + r0 + r01(0,1));
00201 }
00202 };
00203
00205 class RegSharedA : public Test {
00206 public:
00208 RegSharedA(void) : Test("Extensional::Reg::Shared::A",4,2,2) {}
00210 virtual bool solution(const Assignment& x) const {
00211 return (((x[0] == 0) || (x[0] == 2)) &&
00212 ((x[1] == -1) || (x[1] == 1)) &&
00213 ((x[2] == 0) || (x[2] == 1)) &&
00214 ((x[3] == 0) || (x[3] == 1)));
00215 }
00217 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00218 using namespace Gecode;
00219 IntVarArgs y(8);
00220 for (int i=0; i<4; i++)
00221 y[i]=y[i+4]=x[i];
00222 unshare(home,y);
00223 extensional(home, y,
00224 ((REG(0) | REG(2)) +
00225 (REG(-1) | REG(1)) +
00226 (REG(7) | REG(0) | REG(1)) +
00227 (REG(0) | REG(1)))(2,2));
00228 }
00229 };
00230
00232 class RegSharedB : public Test {
00233 public:
00235 RegSharedB(void) : Test("Extensional::Reg::Shared::B",4,2,2) {}
00237 virtual bool solution(const Assignment& x) const {
00238 return (((x[0] == 0) || (x[0] == 2)) &&
00239 ((x[1] == -1) || (x[1] == 1)) &&
00240 ((x[2] == 0) || (x[2] == 1)) &&
00241 ((x[3] == 0) || (x[3] == 1)));
00242 }
00244 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00245 using namespace Gecode;
00246 IntVarArgs y(12);
00247 for (int i=0; i<4; i++)
00248 y[i]=y[i+4]=y[i+8]=x[i];
00249 unshare(home,y);
00250 extensional(home, y,
00251 ((REG(0) | REG(2)) +
00252 (REG(-1) | REG(1)) +
00253 (REG(7) | REG(0) | REG(1)) +
00254 (REG(0) | REG(1)))(3,3));
00255 }
00256 };
00257
00259 class RegSharedC : public Test {
00260 public:
00262 RegSharedC(void) : Test("Extensional::Reg::Shared::C",4,0,1) {}
00264 virtual bool solution(const Assignment& x) const {
00265 return (x[1]==1) && (x[2]==0) && (x[3]==1);
00266 }
00268 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00269 using namespace Gecode;
00270 Gecode::BoolVarArgs y(8);
00271 for (int i=0; i<4; i++)
00272 y[i]=y[i+4]=channel(home,x[i]);
00273 unshare(home,y);
00274 extensional(home,y,
00275 ((REG(0) | REG(1)) + REG(1) + REG(0) + REG(1))(2,2));
00276 }
00277 };
00278
00280 class RegSharedD : public Test {
00281 public:
00283 RegSharedD(void) : Test("Extensional::Reg::Shared::D",4,0,1) {}
00285 virtual bool solution(const Assignment& x) const {
00286 return (x[1]==1) && (x[2]==0) && (x[3]==1);
00287 }
00289 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00290 using namespace Gecode;
00291 Gecode::BoolVarArgs y(12);
00292 for (int i=0; i<4; i++)
00293 y[i]=y[i+4]=y[i+8]=channel(home,x[i]);
00294 unshare(home, y);
00295 extensional(home, y,
00296 ((REG(0) | REG(1)) + REG(1) + REG(0) + REG(1))(3,3));
00297 }
00298 };
00299
00301 class RegEmptyDFA : public Test {
00302 public:
00304 RegEmptyDFA(void) : Test("Extensional::Reg::Empty::DFA",1,0,0) {
00305 testsearch = false;
00306 }
00308 virtual bool solution(const Assignment& x) const {
00309 (void)x;
00310 return false;
00311 }
00313 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00314 Gecode::DFA d;
00315 Gecode::extensional(home, x, d);
00316 }
00317 };
00318
00320 class RegEmptyREG : public Test {
00321 public:
00323 RegEmptyREG(void) : Test("Extensional::Reg::Empty::REG",1,0,0) {
00324 testsearch = false;
00325 }
00327 virtual bool solution(const Assignment& x) const {
00328 (void)x;
00329 return false;
00330 }
00332 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00333 Gecode::REG r;
00334 Gecode::extensional(home, x, r);
00335 }
00336 };
00337
00339 class RegOpt : public Test {
00340 protected:
00342 int n;
00343 public:
00345 RegOpt(int n0)
00346 : Test("Extensional::Reg::Opt::"+str(n0),1,0,15), n(n0) {}
00348 virtual bool solution(const Assignment& x) const {
00349 return (x[0] < n) && ((x[0] & 1) == 0);
00350 }
00352 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00353 using namespace Gecode;
00354 DFA::Transition* t = new DFA::Transition[n+1];
00355 DFA::Transition* ti = t;
00356 int* f = new int[n+1];
00357 int* fi = f;
00358 for (int i=0; i<n; i++) {
00359 ti->i_state = 0;
00360 ti->symbol = i;
00361 ti->o_state = i+1;
00362 ti++;
00363 if ((i & 1) == 0) {
00364 *fi = i+1; fi++;
00365 }
00366 }
00367 ti->i_state = -1;
00368 *fi = -1;
00369 DFA d(0, t, f, false);
00370 delete [] t;
00371 delete [] f;
00372 extensional(home, x, d);
00373 }
00374
00375 };
00376
00378 Gecode::DFA tupleset2dfa(Gecode::TupleSet ts) {
00379 using namespace Gecode;
00380 REG expression;
00381 for (int i = 0; i<ts.tuples(); i++) {
00382 REG r;
00383 for (int j = 0; j<ts.arity(); j++) {
00384 r += REG(ts[i][j]);
00385 }
00386 expression |= r;
00387 }
00388 DFA dfa(expression);
00389 return dfa;
00390 }
00391
00393 class TupleSetBase : public Test {
00394 public:
00396 TupleSetBase(void)
00397 : Test("Extensional::TupleSet::Base",
00398 4,1,5,false,Gecode::IPL_DOM) {}
00400 virtual bool solution(const Assignment& x) const {
00401 return ((x[0] == 1 && x[1] == 3 && x[2] == 2 && x[3] == 3) ||
00402 (x[0] == 2 && x[1] == 1 && x[2] == 2 && x[3] == 4) ||
00403 (x[0] == 2 && x[1] == 2 && x[2] == 1 && x[3] == 4) ||
00404 (x[0] == 3 && x[1] == 3 && x[2] == 3 && x[3] == 2) ||
00405 (x[0] == 4 && x[1] == 3 && x[2] == 4 && x[3] == 1)
00406 );
00407 }
00409 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00410 using namespace Gecode;
00411 TupleSet t(4);
00412 IntArgs t1(4, 2, 1, 2, 4);
00413 IntArgs t2(4, 2, 2, 1, 4);
00414 IntArgs t3(4, 4, 3, 4, 1);
00415 IntArgs t4(4, 1, 3, 2, 3);
00416 IntArgs t5(4, 3, 3, 3, 2);
00417 t.add(t1).add(t1).add(t2).add(t2)
00418 .add(t3).add(t3).add(t4).add(t4)
00419 .add(t5).add(t5).add(t5).add(t5)
00420 .add(t5).add(t5).add(t5).add(t5)
00421 .add(t1).add(t1).add(t2).add(t2)
00422 .add(t3).add(t3).add(t4).add(t4)
00423 .add(t5).add(t5).add(t5).add(t5)
00424 .add(t5).add(t5).add(t5).add(t5)
00425 .finalize();
00426
00427 TupleSet ts = TupleSet(t.arity(),tupleset2dfa(t));
00428 assert(t == ts);
00429 extensional(home, x, t, ipl);
00430 }
00431 };
00432
00434 class TupleSetTest : public Test {
00435 protected:
00437 Gecode::TupleSet ts;
00439 bool toDFA;
00440 public:
00442 TupleSetTest(const std::string& s,
00443 Gecode::IntSet d0, Gecode::TupleSet ts0, bool td)
00444 : Test("Extensional::TupleSet::"+s,
00445 ts0.arity(),d0,false,Gecode::IPL_DOM), ts(ts0) {
00446 toDFA = td;
00447 }
00449 virtual bool solution(const Assignment& x) const {
00450 using namespace Gecode;
00451 for (int i=ts.tuples(); i--; ) {
00452 TupleSet::Tuple t = ts[i];
00453 bool same = true;
00454 for (int j=0; (j < ts.arity()) && same; j++)
00455 if (t[j] != x[j])
00456 same = false;
00457 if (same)
00458 return true;
00459 }
00460 return false;
00461 }
00463 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00464 using namespace Gecode;
00465
00466 if (toDFA) {
00467 TupleSet t = TupleSet(ts.arity(),tupleset2dfa(ts));
00468 assert(ts == t);
00469 }
00470 extensional(home, x, ts, ipl);
00471 }
00472 };
00473
00474 class RandomTupleSetTest : public TupleSetTest {
00475 public:
00477 RandomTupleSetTest(const std::string& s,
00478 Gecode::IntSet d0, Gecode::TupleSet ts0)
00479 : TupleSetTest(s,d0,ts0,false) {
00480 testsearch = false;
00481 }
00483 virtual Assignment* assignment(void) const {
00484 using namespace Gecode;
00485 return new RandomAssignment(arity,dom,1000);
00486 }
00487 };
00488
00490 class TupleSetLarge : public Test {
00491 mutable Gecode::TupleSet t;
00492 public:
00494 TupleSetLarge(double prob)
00495 : Test("Extensional::TupleSet::Large",
00496 5,1,5,false,Gecode::IPL_DOM), t(5) {
00497 using namespace Gecode;
00498
00499 CpltAssignment ass(5, IntSet(1, 5));
00500 while (ass()) {
00501 if (Base::rand(100) <= prob*100) {
00502 IntArgs tuple(5);
00503 for (int i = 5; i--; ) tuple[i] = ass[i];
00504 t.add(tuple);
00505 }
00506 ++ass;
00507 }
00508 t.finalize();
00509 }
00511 virtual bool solution(const Assignment& x) const {
00512 using namespace Gecode;
00513 for (int i = 0; i < t.tuples(); ++i) {
00514 TupleSet::Tuple l = t[i];
00515 bool same = true;
00516 for (int j = 0; j < t.arity() && same; ++j)
00517 if (l[j] != x[j]) same = false;
00518 if (same) return true;
00519 }
00520 return false;
00521 }
00523 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00524 using namespace Gecode;
00525 extensional(home, x, t, ipl);
00526 }
00527 };
00528
00530 class TupleSetBool : public Test {
00531 mutable Gecode::TupleSet t;
00532 public:
00534 TupleSetBool(double prob)
00535 : Test("Extensional::TupleSet::Bool",
00536 5,0,1,false), t(5) {
00537 using namespace Gecode;
00538
00539 CpltAssignment ass(5, IntSet(0, 1));
00540 while (ass()) {
00541 if (Base::rand(100) <= prob*100) {
00542 IntArgs tuple(5);
00543 for (int i = 5; i--; ) tuple[i] = ass[i];
00544 t.add(tuple);
00545 }
00546 ++ass;
00547 }
00548 t.finalize();
00549 }
00551 virtual bool solution(const Assignment& x) const {
00552 using namespace Gecode;
00553 for (int i = 0; i < t.tuples(); ++i) {
00554 TupleSet::Tuple l = t[i];
00555 bool same = true;
00556 for (int j = 0; j < t.arity() && same; ++j)
00557 if (l[j] != x[j]) same = false;
00558 if (same) return true;
00559 }
00560 return false;
00561 }
00563 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
00564 using namespace Gecode;
00565 BoolVarArgs y(x.size());
00566 for (int i = x.size(); i--; )
00567 y[i] = channel(home, x[i]);
00568 extensional(home, y, t, ipl);
00569 }
00570 };
00571
00573 class TupleSetTestSize {
00574 public:
00576 TupleSetTestSize(int size) {
00577 using namespace Gecode;
00579 int arity = 2;
00580 int n_tuples = 5*5;
00581 while (n_tuples < size) {
00582 arity++;
00583 n_tuples*=5;
00584 }
00586 TupleSet ts(arity);
00587 CpltAssignment ass(arity, IntSet(0, 4));
00588 for (int i = size; i--; ) {
00589 assert(ass());
00590 IntArgs tuple(arity);
00591 for (int j = arity; j--; ) tuple[j] = ass[j];
00592 ts.add(tuple);
00593 ++ass;
00594 }
00595 ts.finalize();
00596 assert(ts.tuples() == size);
00597
00598 (void) new TupleSetTest(std::to_string(size),IntSet(0,4),ts,
00599 size <= 128);
00600 }
00601 };
00602
00603 Gecode::TupleSet randomTupleSet(int n, int min, int max, double prob) {
00604 using namespace Gecode;
00605 TupleSet t(n);
00606 CpltAssignment ass(n, IntSet(min, max));
00607 while (ass()) {
00608 if (Base::rand(100) <= prob*100) {
00609 IntArgs tuple(n);
00610 for (int i = n; i--; ) tuple[i] = ass[i];
00611 t.add(tuple);
00612 }
00613 ++ass;
00614 }
00615 t.finalize();
00616 return t;
00617 }
00618
00620 class Create {
00621 public:
00623 Create(void) {
00624 using namespace Gecode;
00625 {
00626 TupleSet ts(4);
00627 ts.add(2, 1, 2, 4).add(2, 2, 1, 4)
00628 .add(4, 3, 4, 1).add(1, 3, 2, 3)
00629 .add(3, 3, 3, 2).add(5, 1, 4, 4)
00630 .add(2, 5, 1, 5).add(4, 3, 5, 1)
00631 .add(1, 5, 2, 5).add(5, 3, 3, 2)
00632 .finalize();
00633 (void) new TupleSetTest("A",IntSet(0,6),ts,true);
00634 }
00635 {
00636 TupleSet ts(4);
00637 ts.finalize();
00638 (void) new TupleSetTest("Empty",IntSet(1,2),ts,true);
00639 }
00640 {
00641 TupleSet ts(4);
00642 for (int n=1024*16; n--; )
00643 ts.add(1,2,3,4);
00644 ts.finalize();
00645 (void) new TupleSetTest("Assigned",IntSet(1,4),ts,true);
00646 }
00647 {
00648 TupleSet ts(1);
00649 ts.add(1).add(2).add(3).finalize();
00650 (void) new TupleSetTest("Single",IntSet(-4,4),ts,true);
00651 }
00652 {
00653 int m = Gecode::Int::Limits::min;
00654 TupleSet ts(3);
00655 ts.add(m+0,m+1,m+2).add(m+4,m+1,m+3)
00656 .add(m+2,m+3,m+0).add(m+2,m+3,m+0)
00657 .add(m+1,m+2,m+5).add(m+2,m+3,m+0)
00658 .add(m+3,m+6,m+5).finalize();
00659 (void) new TupleSetTest("Min",IntSet(m,m+7),ts,true);
00660 }
00661 {
00662 int M = Gecode::Int::Limits::max;
00663 TupleSet ts(3);
00664 ts.add(M-0,M-1,M-2).add(M-4,M-1,M-3)
00665 .add(M-2,M-3,M-0).add(M-2,M-3,M-0)
00666 .add(M-1,M-2,M-5).add(M-2,M-3,M-0)
00667 .add(M-3,M-6,M-5).finalize();
00668 (void) new TupleSetTest("Max",IntSet(M-7,M),ts,true);
00669 }
00670 {
00671 int m = Gecode::Int::Limits::min;
00672 int M = Gecode::Int::Limits::max;
00673 TupleSet ts(3);
00674 ts.add(M-0,m+1,M-2).add(m+4,M-1,M-3)
00675 .add(m+2,M-3,m+0).add(M-2,M-3,M-0)
00676 .finalize();
00677 (void) new TupleSetTest("MinMax",
00678 IntSet(IntArgs(6, m,m+1,m+4,M-3,M-2,M)),
00679 ts,true);
00680 }
00681 {
00682 TupleSet ts(7);
00683 for (int i = 0; i < 10000; i++) {
00684 IntArgs tuple(7);
00685 for (int j = 0; j < 7; j++) {
00686 tuple[j] = Base::rand(j+1);
00687 }
00688 ts.add(tuple);
00689 }
00690 ts.finalize();
00691 (void) new RandomTupleSetTest("Triangle",IntSet(0,6),ts);
00692 }
00693 {
00694 for (int i = 0; i <= 64*6; i+=32)
00695 (void) new TupleSetTestSize(i);
00696 }
00697 {
00698 (void) new RandomTupleSetTest("Rand(10,-1,2)", IntSet(-1,2),
00699 randomTupleSet(10,-1,2,0.05));
00700 (void) new RandomTupleSetTest("Rand(5,-10,10)", IntSet(-10,10),
00701 randomTupleSet(5,-10,10,0.05));
00702 }
00703 {
00704 TupleSet t(5);
00705 CpltAssignment ass(4, IntSet(1, 4));
00706 while (ass()) {
00707 IntArgs tuple(5);
00708 tuple[4] = 1;
00709 for (int i = 4; i--; ) tuple[i] = ass[i];
00710 t.add(tuple);
00711 ++ass;
00712 }
00713 t.add(2,2,4,3,4);
00714 t.finalize();
00715 (void) new TupleSetTest("FewLast",IntSet(1,4),t,false);
00716 }
00717 {
00718 TupleSet t(4);
00719 CpltAssignment ass(4, IntSet(1, 6));
00720 while (ass()) {
00721 t.add(ass[0],0,ass[1],ass[2]);
00722 ++ass;
00723 }
00724 t.add(2,-1,3,4);
00725 t.finalize();
00726 (void) new TupleSetTest("FewMiddle",IntSet(-1,6),t,false);
00727 }
00728 {
00729 TupleSet t(10);
00730 CpltAssignment ass(9, IntSet(1, 4));
00731 while (ass()) {
00732 if (Base::rand(100) <= 0.25*100) {
00733 IntArgs tuple(10);
00734 tuple[0] = 2;
00735 for (int i = 9; i--; ) tuple[i+1] = ass[i];
00736 t.add(tuple);
00737 }
00738 ++ass;
00739 }
00740 t.add(1,1,1,1,1,1,1,1,1,1);
00741 t.add(1,2,3,4,4,2,1,2,3,3);
00742 t.finalize();
00743 (void) new RandomTupleSetTest("FewHuge",IntSet(1,4),t);
00744 }
00745 }
00746 };
00747
00748 Create c;
00749
00750 RegSimpleA ra;
00751 RegSimpleB rb;
00752 RegSimpleC rc;
00753
00754 RegDistinct rd;
00755
00756 RegRoland rr1(1);
00757 RegRoland rr2(2);
00758 RegRoland rr3(3);
00759 RegRoland rr4(4);
00760
00761 RegSharedA rsa;
00762 RegSharedB rsb;
00763 RegSharedC rsc;
00764 RegSharedD rsd;
00765
00766 RegEmptyDFA redfa;
00767 RegEmptyREG rereg;
00768
00769 RegOpt ro0(CHAR_MAX-1);
00770 RegOpt ro1(CHAR_MAX);
00771 RegOpt ro2(static_cast<int>(UCHAR_MAX-1));
00772 RegOpt ro3(static_cast<int>(UCHAR_MAX));
00773 RegOpt ro4(SHRT_MAX-1);
00774 RegOpt ro5(SHRT_MAX);
00775 RegOpt ro6(static_cast<int>(USHRT_MAX-1));
00776 RegOpt ro7(static_cast<int>(USHRT_MAX));
00777
00778 TupleSetBase tsb;
00779
00780 TupleSetLarge tsl(0.05);
00781
00782 TupleSetBool tsbool(0.3);
00784
00785 }
00786 }}
00787
00788
00789