Sha256: 77d628830ee19c9cf0d8bea2089746c8aa344d1cbe2286507331026211f2dcbb

Contents?: true

Size: 891 Bytes

Versions: 12

Compression:

Stored size: 891 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require File.dirname(__FILE__) + '/constraint_helper'

describe Gecode::Constraints::IntEnum::Equality do
  before do
    @model = Gecode::Model.new
    @vars = @model.int_var_array(4, -2..2)
    @invoke_options = lambda do |hash| 
      @vars.must_be.equal(hash)
      @model.solve!
    end
    @expect_options = option_expectation do |strength, kind, reif_var|
      Gecode::Raw.should_receive(:eq).once.with(
        an_instance_of(Gecode::Raw::Space), 
        anything, strength, kind)
    end
  end
  
  it 'should translate equality constraints' do
    @expect_options.call({})
    @invoke_options.call({})
    @vars.must_be.equal
  end

  it 'should not allow negation' do
    lambda{ @vars.must_not_be.equal }.should raise_error(
      Gecode::MissingConstraintError)
  end
  
  it_should_behave_like 'non-reifiable constraint'
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
gecoder-with-gecode-0.8.3-mswin32 specs/constraints/equality.rb
gecoder-with-gecode-0.8.2-mswin32 specs/constraints/equality.rb
gecoder-with-gecode-0.8.1-mswin32 specs/constraints/equality.rb
gecoder-with-gecode-0.8.0-mswin32 specs/constraints/equality.rb
gecoder-0.8.0 specs/constraints/equality.rb
gecoder-0.8.1 specs/constraints/equality.rb
gecoder-0.8.2 specs/constraints/equality.rb
gecoder-0.8.3 specs/constraints/equality.rb
gecoder-with-gecode-0.8.0 specs/constraints/equality.rb
gecoder-with-gecode-0.8.1 specs/constraints/equality.rb
gecoder-with-gecode-0.8.2 specs/constraints/equality.rb
gecoder-with-gecode-0.8.3 specs/constraints/equality.rb