Sha256: d504a7b84dff4ea263ab86215c14107d635f6e1f12a6e377c2b44e94f48ece6b

Contents?: true

Size: 1.14 KB

Versions: 34

Compression:

Stored size: 1.14 KB

Contents

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

describe Gecode::Util::EnumMatrix do
  before do
    @matrix = Gecode::Util::EnumMatrix[[0, 1], [1, 0]]
  end
  
  it 'should be enumerable' do
    @matrix.should be_kind_of(Enumerable)
  end
  
  it 'should produce rows that are enumerable' do
    @matrix.row(0).should be_kind_of(Enumerable)
    @matrix.row(0).inject([]){ |arr, e| arr << e }.should == [0, 1]
  end
  
  it 'should produce columns that are enumerable' do
    @matrix.column(0).should be_kind_of(Enumerable)
  end
  
  it 'should produce submatrices that are enumerable' do
    @matrix.minor(0,1,0,1).should be_kind_of(Enumerable)
  end
end

describe Gecode::Util::EnumMatrix, ' (when wrapped)' do
  before do
    @model = Gecode::Model.new
    @matrix = @model.wrap_enum(Gecode::Util::EnumMatrix[[0, 1], [1, 0]])
  end
  
  it 'should produce rows that are wrapped' do
    @matrix.row(0).should respond_to(:model)
  end
  
  it 'should produce columns that are enumerable' do
    @matrix.column(0).should respond_to(:model)
  end
  
  it 'should produce submatrices that are enumerable' do
    @matrix.minor(0,1,0,1).should respond_to(:model)
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
gecoder-with-gecode-1.1.1.1 specs/enum_matrix.rb
gecoder-with-gecode-1.1.1 specs/enum_matrix.rb
gecoder-1.1.1 specs/enum_matrix.rb
gecoder-with-gecode-1.1.0 specs/enum_matrix.rb
gecoder-1.1.0 specs/enum_matrix.rb
gecoder-with-gecode-0.8.3-mswin32 specs/enum_matrix.rb
gecoder-with-gecode-0.8.2-mswin32 specs/enum_matrix.rb
gecoder-with-gecode-0.8.1-mswin32 specs/enum_matrix.rb
gecoder-with-gecode-0.8.0-mswin32 specs/enum_matrix.rb
gecoder-with-gecode-0.7.1-mswin32 specs/enum_matrix.rb
gecoder-0.5.0 specs/enum_matrix.rb
gecoder-0.4.0 specs/enum_matrix.rb
gecoder-0.8.0 specs/enum_matrix.rb
gecoder-0.6.0 specs/enum_matrix.rb
gecoder-0.6.1 specs/enum_matrix.rb
gecoder-0.7.0 specs/enum_matrix.rb
gecoder-0.7.1 specs/enum_matrix.rb
gecoder-0.8.1 specs/enum_matrix.rb
gecoder-0.8.2 specs/enum_matrix.rb
gecoder-0.8.3 specs/enum_matrix.rb