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

Method Create

test/int/extensional.cpp:663–799  ·  view source on GitHub ↗

Perform creation and registration

Source from the content-addressed store, hash-verified

661 public:
662 /// Perform creation and registration
663 Create(void) {
664 // This code is executed on load, and thus a random number generator source from the supplied
665 // seed is not available.
666 // In order to get interesting data her, but still have deterministic and repeatable execution, a fixed seed
667 // is used for a local random number generator.
668 // TODO: Make this code later on test run, and use the supplied seed/random number generator.
669 Gecode::Support::RandomGenerator rand(42);
670
671 using namespace Gecode;
672 for (bool pos : { false, true }) {
673 {
674 TupleSet ts(4);
675 ts.add({2, 1, 2, 4}).add({2, 2, 1, 4})
676 .add({4, 3, 4, 1}).add({1, 3, 2, 3})
677 .add({3, 3, 3, 2}).add({5, 1, 4, 4})
678 .add({2, 5, 1, 5}).add({4, 3, 5, 1})
679 .add({1, 5, 2, 5}).add({5, 3, 3, 2})
680 .finalize();
681 (void) new TupleSetTest("A",pos,IntSet(0,6),ts,true);
682 }
683 {
684 TupleSet ts(4);
685 ts.finalize();
686 (void) new TupleSetTest("Empty",pos,IntSet(1,2),ts,true);
687 }
688 {
689 TupleSet ts(4);
690 for (int n=1024*16; n--; )
691 ts.add({1,2,3,4});
692 ts.finalize();
693 (void) new TupleSetTest("Assigned",pos,IntSet(1,4),ts,true);
694 }
695 {
696 TupleSet ts(1);
697 ts.add({1}).add({2}).add({3}).finalize();
698 (void) new TupleSetTest("Single",pos,IntSet(-4,4),ts,true);
699 }
700 {
701 int m = Gecode::Int::Limits::min;
702 TupleSet ts(3);
703 ts.add({m+0,m+1,m+2}).add({m+4,m+1,m+3})
704 .add({m+2,m+3,m+0}).add({m+2,m+3,m+0})
705 .add({m+1,m+2,m+5}).add({m+2,m+3,m+0})
706 .add({m+3,m+6,m+5}).finalize();
707 (void) new TupleSetTest("Min",pos,IntSet(m,m+7),ts,true);
708 }
709 {
710 int M = Gecode::Int::Limits::max;
711 TupleSet ts(3);
712 ts.add({M-0,M-1,M-2}).add({M-4,M-1,M-3})
713 .add({M-2,M-3,M-0}).add({M-2,M-3,M-0})
714 .add({M-1,M-2,M-5}).add({M-2,M-3,M-0})
715 .add({M-3,M-6,M-5}).finalize();
716 (void) new TupleSetTest("Max",pos,IntSet(M-7,M),ts,true);
717 }
718 {
719 int m = Gecode::Int::Limits::min;
720 int M = Gecode::Int::Limits::max;

Callers

nothing calls this directly

Calls 7

IntSetClass · 0.85
randomTupleSetFunction · 0.85
IntArgsClass · 0.50
finalizeMethod · 0.45
addMethod · 0.45
has_moreMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected