Sha256: 6b6a6d99855fc96a37e9552cac08c1b5bd8959e2c166c74c879dbd79514d56fc

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

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

describe Gecode::SelectedSet::SelectedSetOperand do
  before do
    @model = Gecode::Model.new
    set_enum = @model.set_var_array(5, [], 0..9)
    set = @model.set_var([], 0..4)
    @operand = Gecode::SelectedSet::SelectedSetOperand.new(
      set_enum, set)
  end

  it 'should implement #model' do
    @operand.model.should be_kind_of(Gecode::Model)
  end

  it 'should implement #to_selected_set' do
    enum, set = @operand.to_selected_set
    enum.should be_respond_to(:to_set_enum)
    set.should be_respond_to(:to_set_var)
    @model.solve!
    set_var = set.to_set_var
    ((set_var.lower_bound == []) && 
     (set_var.upper_bound == Gecode::Model::LARGEST_SET_BOUND)).should_not(
      be_true)
    enum.each do |element|
      set_var = element.to_set_var
      ((set_var.lower_bound == []) && 
       (set_var.upper_bound == Gecode::Model::LARGEST_SET_BOUND)).should_not(
        be_true)
    end
  end

  it 'should implement #must' do
    receiver = @operand.must
    receiver.should be_kind_of(
      Gecode::SelectedSet::SelectedSetConstraintReceiver)
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
gecoder-0.9.0 specs/selected_set.rb
gecoder-with-gecode-0.9.0-x86-mswin32-60 specs/selected_set.rb
gecoder-with-gecode-0.9.0 specs/selected_set.rb