Sha256: 72e912aa8b47cd42f86ee588db0a426e658905aba702b97a89f74cfb9fb19856

Contents?: true

Size: 648 Bytes

Versions: 2

Compression:

Stored size: 648 Bytes

Contents

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

    let(:intType) { BuiltinType.new(Integer) }
    let(:intType2){ BuiltinType.new(Integer) }
    let(:fltType) { BuiltinType.new(Float)   }

    it 'should apply structural equality' do
      (intType == intType2).should be_true
    end

    it 'should apply distinguish different types' do
      (intType == fltType).should be_false
    end

    it 'should be a total function, with nil for non types' do
      (intType == 12).should be_false
    end

    it 'should implement hash accordingly' do
      (intType.hash == intType2.hash).should be_true
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finitio-0.4.1 spec/unit/type/builtin_type/test_equality.rb
finitio-0.4.0 spec/unit/type/builtin_type/test_equality.rb