File tree Expand file tree Collapse file tree 2 files changed +35
-15
lines changed
pumpkin-crates/core/src/constraints/arithmetic Expand file tree Collapse file tree 2 files changed +35
-15
lines changed Original file line number Diff line number Diff line change @@ -140,3 +140,38 @@ impl<Var: IntegerVariable + 'static> NegatableConstraint for Inequality<Var> {
140140 }
141141 }
142142}
143+
144+ #[ cfg( test) ]
145+ mod tests {
146+ use super :: * ;
147+
148+ #[ test]
149+ fn less_than_conflict ( ) {
150+ let mut solver = Solver :: default ( ) ;
151+
152+ let constraint_tag = solver. new_constraint_tag ( ) ;
153+ let x = solver. new_named_bounded_integer ( 0 , 0 , "x" ) ;
154+
155+ let result = less_than ( [ x] , 0 , constraint_tag) . post ( & mut solver) ;
156+ assert_eq ! (
157+ result,
158+ Err ( ConstraintOperationError :: InfeasiblePropagator ) ,
159+ "Expected {result:?} to be an `InfeasiblePropagator` error"
160+ ) ;
161+ }
162+
163+ #[ test]
164+ fn greater_than_conflict ( ) {
165+ let mut solver = Solver :: default ( ) ;
166+
167+ let constraint_tag = solver. new_constraint_tag ( ) ;
168+ let x = solver. new_named_bounded_integer ( 0 , 0 , "x" ) ;
169+
170+ let result = greater_than ( [ x] , 0 , constraint_tag) . post ( & mut solver) ;
171+ assert_eq ! (
172+ result,
173+ Err ( ConstraintOperationError :: InfeasiblePropagator ) ,
174+ "Expected {result:?} to be an `InfeasiblePropagator` error"
175+ ) ;
176+ }
177+ }
Original file line number Diff line number Diff line change @@ -64,18 +64,3 @@ fn proof_with_equality_unit_nogood_step() {
6464 let result = solver. satisfy ( & mut brancher, & mut Indefinite ) ;
6565 assert ! ( matches!( result, SatisfactionResult :: Unsatisfiable ( _, _) ) ) ;
6666}
67-
68- #[ test]
69- fn greater_than_bug ( ) {
70- let mut solver = Solver :: default ( ) ;
71-
72- let constraint_tag = solver. new_constraint_tag ( ) ;
73- let x = solver. new_named_bounded_integer ( 0 , 0 , "x" ) ;
74- let gt = solver. add_constraint ( constraints:: greater_than ( [ x] , 0 , constraint_tag) ) ;
75-
76- match gt. post ( ) {
77- Err ( ConstraintOperationError :: InfeasiblePropagator ) => { }
78- Ok ( ( ) ) => panic ! ( "expected InfeasiblePropagator when posting x > 0 for x fixed to 0" ) ,
79- Err ( e) => panic ! ( "unexpected error: {e:?}" ) ,
80- }
81- }
You can’t perform that action at this time.
0 commit comments