Skip to content

Commit 844eee5

Browse files
author
Christian Schulte
committed
Simple enable/disable test for floats
git-svn-id: file:///Volumes/GecodeGitMigration/gecode-svn-mirror/gecode/trunk@15217 e85b7adc-8362-4630-8c63-7469d557c915
1 parent 1839fc6 commit 844eee5

2 files changed

Lines changed: 47 additions & 1 deletion

File tree

test/float.cpp

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,17 @@ namespace Test { namespace Float {
186186
return new TestSpace(share,*this);
187187
}
188188

189+
void
190+
TestSpace::enable(void) {
191+
Gecode::PropagatorGroup::all.enable(*this);
192+
}
193+
194+
void
195+
TestSpace::disable(void) {
196+
Gecode::PropagatorGroup::all.disable(*this);
197+
(void) status();
198+
}
199+
189200
void
190201
TestSpace::dropUntil(const Assignment& a) {
191202
for (int i = x.size(); i--; )
@@ -547,6 +558,38 @@ if (!(T)) { \
547558
}
548559
delete s;
549560
}
561+
START_TEST("Assignment (after posting, disable)");
562+
{
563+
TestSpace* s = new TestSpace(arity,dom,step,this);
564+
s->post();
565+
s->disable();
566+
s->enable();
567+
s->assign(a,sol);
568+
if (sol == MT_TRUE) {
569+
CHECK_TEST(!s->failed(), "Failed on solution");
570+
CHECK_TEST(subsumed(*s), "No subsumption");
571+
} else if (sol == MT_FALSE) {
572+
CHECK_TEST(s->failed(), "Solved on non-solution");
573+
}
574+
delete s;
575+
}
576+
START_TEST("Partial assignment (after posting, disable)");
577+
{
578+
TestSpace* s = new TestSpace(arity,dom,step,this);
579+
s->post();
580+
s->disable();
581+
s->enable();
582+
s->assign(a,sol,true);
583+
(void) s->failed();
584+
s->assign(a,sol);
585+
if (sol == MT_TRUE) {
586+
CHECK_TEST(!s->failed(), "Failed on solution");
587+
CHECK_TEST(subsumed(*s), "No subsumption");
588+
} else if (sol == MT_FALSE) {
589+
CHECK_TEST(s->failed(), "Solved on non-solution");
590+
}
591+
delete s;
592+
}
550593
START_TEST("Assignment (before posting)");
551594
{
552595
TestSpace* s = new TestSpace(arity,dom,step,this);
@@ -594,7 +637,6 @@ if (!(T)) { \
594637
}
595638
delete s;
596639
}
597-
598640
if (reified && !ignore(a) && (sol != MT_MAYBE)) {
599641
if (eqv()) {
600642
START_TEST("Assignment reified (rewrite after post, <=>)");

test/float.hh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ namespace Test {
233233
void prune(void);
234234
/// Prune values but not those in assignment \a a
235235
bool prune(const Assignment& a, bool testfix);
236+
/// Disable propagators in space and compute fixpoint (make all idle)
237+
void disable(void);
238+
/// Enable propagators in space
239+
void enable(void);
236240
/// Return the number of propagators
237241
unsigned int propagators(void);
238242
};

0 commit comments

Comments
 (0)