Sha256: b71e98003e5a379e9f192771f855669845c75265717cc58e2aa8b911ec23ab00
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
#!/usr/bin/ruby $:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'test/unit' require 'ConstraintList' require 'BinaryConstraint' require 'Variable' require 'Domain' require 'AllDifferentConstraint' module ConstraintSolver class ConstraintListTest < Test::Unit::TestCase 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 def testNotAllAssignedWithVariable assert_equal(ConstraintList.new([ @con2 ]), @cl.notAllAssignedWithVariable(@var1)) end def testAllWithVariable assert_equal(ConstraintList.new([ @con1, @con2 ]), @cl.allWithVariable(@var1)) end def testAllDifferentConstraintList allDiff = AllDifferentConstraint.new([ @var1, @var2, @var3 ]) list = ConstraintList.new([ allDiff ]) assert_equal(list, list.notAllAssignedWithVariable(@var1)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ConstraintSolver-0.1 | test/ConstraintListTest.rb |