Class | ConstraintSolver::DomainTest |
In: |
test/DomainTest.rb
|
Parent: | Test::Unit::TestCase |
# File test/DomainTest.rb, line 14 def testConstructor assert_nothing_raised { Domain.new } assert_raise(ArgumentError) { Domain.new(3) } assert_raise(ArgumentError) { Domain.new([ 2 ]) } assert_nothing_raised { Domain.new([ 2 ].to_set) } assert_nothing_raised { Domain.new([ 2, 3, 4 ].to_set) } end
# File test/DomainTest.rb, line 22 def testDomainAddDelete domain = Domain.new assert(domain.empty?) domain << 3 assert(domain.include?(3)) domain.delete(3) assert(domain.empty?) end
# File test/DomainTest.rb, line 50 def testEquals assert_equal(@domain, Domain.new([ 2, 3, 4 ].to_set)) assert_not_equal(@domain, Domain.new([ 2, 3 ].to_set)) @domain.prune(4) assert_not_equal(@domain, Domain.new([ 2, 3 ].to_set)) end
# File test/DomainTest.rb, line 38 def testPruneScalar @domain.prune(2) assert_equal([ 3, 4 ].to_set, @domain.values) @domain.undoPruning assert_equal([ 2, 3, 4 ].to_set, @domain.values) end
# File test/DomainTest.rb, line 31 def testPruneSet @domain.prune([ 2, 3 ].to_set) assert_equal([ 4 ].to_set, @domain.values) @domain.undoPruning assert_equal([ 2, 3, 4 ].to_set, @domain.values) end