specs/binding_changes.rb in gecoder-0.5.0 vs specs/binding_changes.rb in gecoder-0.6.0
- old
+ new
@@ -1,26 +1,26 @@
require File.dirname(__FILE__) + '/spec_helper'
describe 'Space', :shared => true do
it 'should give different indices when creating int variables' do
- @space.new_int_vars(0, 17).should_not equal(@space.new_int_vars(0, 17))
+ @space.new_int_vars([0, 17]).should_not equal(@space.new_int_vars([0, 17]))
end
it 'should give different indices when creating bool variables' do
@space.new_bool_vars().should_not equal(@space.new_bool_vars())
end
it 'should give different indices when creating multiple int variables' do
- @space.new_int_vars(0, 17, 17).uniq.size.should equal(17)
+ @space.new_int_vars([0, 17], 17).uniq.size.should equal(17)
end
it 'should give different indices when creating multiple bool variables' do
@space.new_bool_vars(17).uniq.size.should equal(17)
end
it 'should not return nil for created int variables' do
- @space.new_int_vars(0, 17, 4).each do |i|
+ @space.new_int_vars([0, 17], 4).each do |i|
@space.int_var(i).should_not be_nil
end
end
it 'should not return nil for created int variables' do
@@ -34,10 +34,14 @@
end
it 'should return nil when requesting bool variables with negative indices' do
@space.bool_var(-1).should be_nil
end
+
+ it 'should raise an error if given a domain of incorrect type' do
+ lambda{ @space.new_int_vars(17) }.should raise_error(TypeError)
+ end
end
describe Gecode::Raw::Space, ' (new)' do
before do
@space = Gecode::Raw::Space.new
@@ -55,11 +59,11 @@
end
describe Gecode::Raw::Space, ' (with items)' do
before do
@space = Gecode::Raw::Space.new
- @first = @space.new_int_vars(1, 4).first
- @second = @space.new_int_vars(-5, 5).first
+ @first = @space.new_int_vars([1, 4]).first
+ @second = @space.new_int_vars([-5, 5]).first
end
it_should_behave_like 'Space'
it 'should give int variables with the correct domains' do
\ No newline at end of file