Sha256: ab7e6b31f3eaa9cc5707ef2315202cf24028ef2a61c82a43e2321b571c35a2cf
Contents?: true
Size: 1.67 KB
Versions: 18
Compression:
Stored size: 1.67 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' describe 'non-empty bool variable', :shared => true do it 'should give a NoMethodError when calling a method that doesn\'t exist' do lambda{ @var.this_method_does_not_exists }.should raise_error(NoMethodError) end end describe Gecode::FreeBoolVar, '(not assigned)' do before do model = Gecode::Model.new @var = model.bool_var end it_should_behave_like 'non-empty bool variable' it 'should not be assigned' do @var.should_not be_assigned end it "should say that it's not assigned when inspecting" do @var.inspect.should include('unassigned') end it 'should raise error when trying to access assigned value' do lambda{ @var.value }.should raise_error(RuntimeError) end end describe Gecode::FreeBoolVar, '(assigned true)' do before do model = Gecode::Model.new @var = model.bool_var @var.must_be.true model.solve! end it_should_behave_like 'non-empty bool variable' it 'should be assigned' do @var.should be_assigned end it 'should have valye true' do @var.value.should be_true end it "should say that it's true when inspecting" do @var.inspect.should include('true') end end describe Gecode::FreeBoolVar, '(assigned false)' do before do model = Gecode::Model.new @var = model.bool_var @var.must_be.false model.solve! end it_should_behave_like 'non-empty bool variable' it 'should be assigned' do @var.should be_assigned end it 'should have value false ' do @var.value.should_not be_true end it "should say that it's false when inspecting" do @var.inspect.should include('false') end end
Version data entries
18 entries across 18 versions & 2 rubygems