package org.clafer.choco.constraint;

import org.chocosolver.solver.Model;
import static org.clafer.choco.constraint.ConstraintQuickTest.$;
import org.clafer.choco.constraint.ConstraintQuickTest.Check;
import org.clafer.choco.constraint.ConstraintQuickTest.Input;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.chocosolver.solver.constraints.Constraint;
import org.chocosolver.solver.variables.IntVar;
import org.chocosolver.solver.variables.SetVar;
import static org.chocosolver.solver.variables.Var.*;

/**
 *
 * @author jimmy
 */
@RunWith(ConstraintQuickTest.class)
public class SetStrictHighBoundTest {

    @Input(solutions = 511)
    public Object testSumSet(Model model) {
        /*
         * import Control.Monad
         *
         * powerset = filterM (const [True, False])
         *
         * solutions = do
         *     set <- powerset [-4..3]
         *     bound <- [-4..4]
         *     guard $ all (< bound) set
         *     return (set, bound)
         */
        return $(model.setVar("set", ker(), env(-4, -3, -2, -1, 0, 1, 2, 3)),
                model.intVar("bound", -4, 4));
    }

    @Check
    public void check(int[] set, int bound) {
        if (set.length > 0) {
            assertTrue(set[set.length - 1] < bound);
        }
    }

    @ArcConsistent
    @Test(timeout = 60000)
    public Constraint setup(SetVar set, IntVar bound) {
        return Constraints.stritctHighBound(set, bound);
    }
}

@@ -550,16 +550,47 @@
 s.Var.*;
+%0Aimport org.clafer.test.NoCard;
 %0A%0A/**%0A *
@@ -1423,16 +1423,24 @@
 t setup(
+@NoCard 
 SetVar s

Add no card to the set variables of set strict high bound test.