specs/constraints/channel.rb in gecoder-0.7.1 vs specs/constraints/channel.rb in gecoder-0.8.0

- old
+ new

@@ -23,22 +23,22 @@ @elements = @model.elements @invoke_options = lambda do |hash| @positions.must.channel @elements, hash @model.solve! end - @expect_options = lambda do |strength, reif_var| + @expect_options = option_expectation do |strength, kind, reif_var| Gecode::Raw.should_receive(:channel).once.with( an_instance_of(Gecode::Raw::Space), an_instance_of(Gecode::Raw::IntVarArray), - an_instance_of(Gecode::Raw::IntVarArray), strength) + an_instance_of(Gecode::Raw::IntVarArray), strength, kind) end end it 'should translate into a channel constraint' do Gecode::Raw.should_receive(:channel).once.with( an_instance_of(Gecode::Raw::Space), - anything, anything, Gecode::Raw::ICL_DEF) + anything, anything, Gecode::Raw::ICL_DEF, Gecode::Raw::PK_DEF) @invoke_options.call({}) end it 'should constrain variables to be channelled' do @elements.must.channel @positions @@ -57,11 +57,11 @@ it 'should raise error for unsupported right hand sides' do lambda{ @elements.must.channel 'hello' }.should raise_error(TypeError) end - it_should_behave_like 'constraint with strength option' + it_should_behave_like 'reifiable constraint' end describe Gecode::Constraints::IntEnum::Channel, ' (one int enum and one set enum)' do before do @model = ChannelSampleProblem.new @@ -97,19 +97,19 @@ @invoke_options = lambda do |hash| @sets.must.channel @positions, hash @model.solve! end - @expect_options = lambda do |strength, reif_var| + @expect_options = option_expectation do |strength, kind, reif_var| Gecode::Raw.should_receive(:channel).once.with( an_instance_of(Gecode::Raw::Space), an_instance_of(Gecode::Raw::IntVarArray), an_instance_of(Gecode::Raw::SetVarArray)) end end it 'should translate into a channel constraint' do - @expect_options.call(Gecode::Raw::ICL_DEF, nil) + @expect_options.call({}) @sets.must.channel @positions @model.solve! end it 'should not allow negation' do \ No newline at end of file