specs/model.rb in gecoder-0.6.0 vs specs/model.rb in gecoder-0.6.1
- old
+ new
@@ -8,26 +8,27 @@
it 'should allow the creation of int variables with range' do
range = 0..3
@model.int_var(range).should have_domain(range)
end
- # This currently fails, see specs/int_var for an explanation.
+ it 'should allow the creation of int variables without specified domain' do
+ var = @model.int_var
+ var.should be_range
+ var.min.should == Gecode::Raw::Limits::Int::INT_MIN
+ var.max.should == Gecode::Raw::Limits::Int::INT_MAX
+ end
+
it 'should allow the creation of int variables with non-range domains' do
domain = [1, 3, 5]
- @model.int_var(*domain).should have_domain(domain)
+ @model.int_var(domain).should have_domain(domain)
end
it 'should allow the creation of int variables with single element domains' do
domain = 3
@model.int_var(domain).should have_domain([domain])
end
- it 'should not accept empty domains' do
- lambda{ @model.int_var }.should raise_error(ArgumentError)
- lambda{ @model.int_var_array(1) }.should raise_error(ArgumentError)
- end
-
it 'should allow the creation of int-var arrays with range domains' do
range = 0..3
count = 5
vars = @model.int_var_array(count, range)
vars.size.should equal(count)
@@ -35,11 +36,11 @@
end
it 'should allow the creation of int-var arrays with non-range domains' do
domain = [1,3,5]
count = 5
- vars = @model.int_var_array(count, *domain)
+ vars = @model.int_var_array(count, domain)
vars.size.should equal(count)
vars.each{ |var| var.should have_domain(domain) }
end
it 'should allow the creation of int-var matrices with range domains' do
@@ -54,10 +55,10 @@
it 'should allow the creation of int-var matrices with non-range domains' do
domain = [1,3,5]
rows = 5
columns = 4
- vars = @model.int_var_matrix(rows, columns, *domain)
+ vars = @model.int_var_matrix(rows, columns, domain)
vars.row_size.should equal(rows)
vars.column_size.should equal(columns)
vars.each{ |var| var.should have_domain(domain) }
end
end
\ No newline at end of file