Sha256: 479935fd64c2c0dfd08e5af93eee8b35ce5d0341b83347a30abdb5d9aaf44e58

Contents?: true

Size: 981 Bytes

Versions: 19

Compression:

Stored size: 981 Bytes

Contents

require 'spec_helper'
module Finitio
  describe RelationType, "equality" do

    let(:h1){ Heading.new([Attribute.new(:r, intType), Attribute.new(:b, intType)]) }
    let(:h2){ Heading.new([Attribute.new(:b, intType), Attribute.new(:r, intType)]) }
    let(:h3){ Heading.new([Attribute.new(:b, intType)])                             }

    let(:type1)  { RelationType.new(h1) }
    let(:type2)  { RelationType.new(h2) }
    let(:type3)  { RelationType.new(h3) }

    it 'should apply structural equality' do
      expect(type1 == type2).to eq(true)
      expect(type2 == type1).to eq(true)
    end

    it 'should apply distinguish different types' do
      expect(type1 == type3).to eq(false)
      expect(type2 == type3).to eq(false)
    end

    it 'should be a total function, with nil for non types' do
      expect(type1 == 12).to eq(false)
    end

    it 'should implement hash accordingly' do
      expect([type1, type2].map(&:hash).uniq.size).to eq(1)
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
finitio-0.12.0 spec/type/relation_type/test_equality.rb
finitio-0.11.4 spec/type/relation_type/test_equality.rb
finitio-0.11.3 spec/type/relation_type/test_equality.rb
finitio-0.11.2 spec/type/relation_type/test_equality.rb
finitio-0.11.1 spec/type/relation_type/test_equality.rb
finitio-0.10.0 spec/type/relation_type/test_equality.rb
finitio-0.9.1 spec/type/relation_type/test_equality.rb
finitio-0.9.0 spec/type/relation_type/test_equality.rb
finitio-0.8.0 spec/type/relation_type/test_equality.rb
finitio-0.7.0 spec/type/relation_type/test_equality.rb
finitio-0.7.0.pre.rc4 spec/type/relation_type/test_equality.rb
finitio-0.7.0.pre.rc3 spec/type/relation_type/test_equality.rb
finitio-0.7.0.pre.rc2 spec/type/relation_type/test_equality.rb
finitio-0.7.0.pre.rc1 spec/type/relation_type/test_equality.rb
finitio-0.6.1 spec/type/relation_type/test_equality.rb
finitio-0.6.0 spec/type/relation_type/test_equality.rb
finitio-0.5.2 spec/type/relation_type/test_equality.rb
finitio-0.5.1 spec/type/relation_type/test_equality.rb
finitio-0.5.0 spec/type/relation_type/test_equality.rb