Sha256: 631ea68c612e7626bd07b5abd0e34ee65526eea041aa5aa01aea2be4cd5317b7
Contents?: true
Size: 969 Bytes
Versions: 19
Compression:
Stored size: 969 Bytes
Contents
require 'spec_helper' module Finitio describe TupleType, "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) { TupleType.new(h1) } let(:type2) { TupleType.new(h2) } let(:type3) { TupleType.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