Class ConstraintSolver::ConstraintListTest
In: test/ConstraintListTest.rb
Parent: Test::Unit::TestCase
Test::Unit::TestCase AllDifferentConstraintTest SolutionTest ConstraintSolverTest ConstraintListTest VariableTest DomainTest BinaryConstraintTest ProblemTest BinaryRelationTest Exception DomainWipeoutException UndoStackEmptyException AbstractConstraint BinaryConstraint AllDifferentConstraint Array ConstraintList BinaryRelation Variable Solution ConstraintSolver Problem Domain test/DomainTest.rb test/SolutionTest.rb lib/BinaryConstraint.rb lib/Variable.rb test/ConstraintListTest.rb lib/ConstraintList.rb test/ProblemTest.rb lib/Solution.rb test/BinaryConstraintTest.rb lib/ConstraintSolver.rb test/VariableTest.rb test/AllDifferentConstraintTest.rb lib/AllDifferentConstraint.rb lib/Problem.rb test/ConstraintSolverTest.rb lib/Domain.rb lib/AbstractConstraint.rb ConstraintSolver dot/m_19_0.png

Methods

Public Instance methods

[Source]

# File test/ConstraintListTest.rb, line 14
        def setup
            @var1 = Variable.new("test1", Domain.new([ 1 ].to_set), 1)
            @var2 = Variable.new("test2", Domain.new([ 1 ].to_set), 1)
            @var3 = Variable.new("test3", Domain.new([ 1 ].to_set))

            @proc = Proc.new {|a, b| a == b }

            @con1 = BinaryConstraint.new(@var1, @var2, @proc)
            @con2 = BinaryConstraint.new(@var1, @var3, @proc)

            @cl = ConstraintList.new([ @con1, @con2 ])
        end

[Source]

# File test/ConstraintListTest.rb, line 31
        def testAllDifferentConstraintList
            allDiff = AllDifferentConstraint.new([ @var1, @var2, @var3 ])
            list = ConstraintList.new([ allDiff ])
            assert_equal(list, list.notAllAssignedWithVariable(@var1))
        end

[Source]

# File test/ConstraintListTest.rb, line 27
        def testNotAllAssignedWithVariable
            assert_equal(ConstraintList.new([ @con2 ]), @cl.notAllAssignedWithVariable(@var1))
        end

[Validate]