Sha256: 08015bdd6823fd98176387446bb74c6c6521194553582fc9aee1070c68bab21e
Contents?: true
Size: 880 Bytes
Versions: 19
Compression:
Stored size: 880 Bytes
Contents
require 'spec_helper' module Finitio describe UnionType, "equality" do let(:uType) { UnionType.new([intType, floatType]) } let(:uType2) { UnionType.new([floatType, intType]) } let(:uType3) { UnionType.new([floatType, intType]) } let(:uType4) { UnionType.new([intType]) } it 'should apply structural equality' do expect(uType == uType2).to eq(true) expect(uType == uType3).to eq(true) expect(uType2 == uType3).to eq(true) end it 'should apply distinguish different types' do expect(uType == uType4).to eq(false) expect(uType == intType).to eq(false) end it 'should be a total function, with nil for non types' do expect(uType == 12).to eq(false) end it 'should implement hash accordingly' do expect([uType, uType2, uType3].map(&:hash).uniq.size).to eq(1) end end end
Version data entries
19 entries across 19 versions & 1 rubygems