Sha256: b4dd37aeaa837da942386c63db131c61fc383799d09f557f45fe3883d413b4fa
Contents?: true
Size: 1.15 KB
Versions: 14
Compression:
Stored size: 1.15 KB
Contents
require File.dirname(__FILE__) + '/../property_helper' describe Gecode::Set::Cardinality, ' (property)' do before do @model = Gecode::Model.new @set = @model.set_var([], 0..10) @var = @model.int_var(0..11) @model.branch_on @set @model.branch_on @var @property_types = [:set] @select_property = lambda do |set| set.size end @selected_property = @set.size @constraint_class = Gecode::BlockConstraint end it 'should constrain the cardinality of a set' do @set.size.must == @var @model.solve! @set.value.size.should == @var.value end it 'should constrain the cardinality of a set (2)' do @set.size.must == 2 @model.solve!.should_not be_nil @set.value.size.should == 2 end it 'should constrain the cardinality of a set (3)' do @set.size.must == @var @var.must == 2 @model.solve! @set.value.size.should == 2 end it 'should translate into a cardinality constraint' do Gecode::Raw.should_receive(:cardinality) @set.size.must == @var @model.solve! end it_should_behave_like( 'property that produces int operand by short circuiting equality') end
Version data entries
14 entries across 14 versions & 2 rubygems