diff --git a/tests/test_pysat_cardinality.py b/tests/test_pysat_cardinality.py index c5b657e3d..00b7bcf08 100644 --- a/tests/test_pysat_cardinality.py +++ b/tests/test_pysat_cardinality.py @@ -107,6 +107,27 @@ def test_pysat_linear_other(self): for expression in expressions: cp.Model(expression).solve("pysat") + def test_pysat_oob(self): + + def test_encode_pb_oob(self): + self.assertTrue(len(self.bv) == 3) + # test out of bounds (meaningless) thresholds + expressions = [ + sum(self.bv) <= 5, # true + sum(self.bv) <= 3, # true + sum(self.bv) <= -2, # false + sum(self.bv) <= 0, # undecided + + sum(self.bv) >= -2, # true + sum(self.bv) >= 0, # true + sum(self.bv) >= 5, # false + sum(self.bv) >= 3, # undecided + ] + + ## check all types of linear constraints are handled + for expression in expressions: + Model(expression).solve("pysat") + def test_pysat_different(self): differrent = cp.Model(