specs/branch.rb in gecoder-0.8.2 vs specs/branch.rb in gecoder-0.8.3
- old
+ new
@@ -35,10 +35,20 @@
it 'should ensure that branched bool variables are assigned in a solution' do
@model.branch_on @bools
@model.solve!.bools.each{ |var| var.should be_assigned }
end
+ it 'should allow branching on a single integer variable' do
+ @model.branch_on @vars.first
+ @model.solve!.vars.first.should be_assigned
+ end
+
+ it 'should allow branching on a single boolean variable' do
+ @model.branch_on @bools.first
+ @model.solve!.bools.first.should be_assigned
+ end
+
supported_var_selectors = {
:none => Gecode::Raw::INT_VAR_NONE,
:smallest_min => Gecode::Raw::INT_VAR_MIN_MIN,
:largest_min => Gecode::Raw::INT_VAR_MIN_MAX,
:smallest_max => Gecode::Raw::INT_VAR_MAX_MIN,
@@ -118,10 +128,15 @@
it 'should ensure that branched set variables are assigned in a solution' do
@model.branch_on @sets
@model.solve!.sets.each{ |var| var.should be_assigned }
end
+
+ it 'should allow branching on a single set variable' do
+ @model.branch_on @sets.first
+ @model.solve!.sets.first.should be_assigned
+ end
supported_var_selectors = {
:none => Gecode::Raw::SET_VAR_NONE,
:smallest_cardinality => Gecode::Raw::SET_VAR_MIN_CARD,
:largest_cardinality => Gecode::Raw::SET_VAR_MAX_CARD,
@@ -165,6 +180,6 @@
it 'should raise errors for unrecognized options' do
lambda do
@model.branch_on @sets, :foo => 5
end.should raise_error(ArgumentError)
end
-end
\ No newline at end of file
+end