Sha256: 3b789fe97ebb42f6614d0df44ec845f3ae8c73c5fcd94c79d912f221e60cec07

Contents?: true

Size: 644 Bytes

Versions: 3

Compression:

Stored size: 644 Bytes

Contents

require 'spec_helper'
module Qrb
  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

3 entries across 3 versions & 1 rubygems

Version Path
qrb-0.3.0 spec/unit/type/builtin_type/test_equality.rb
qrb-0.2.0 spec/unit/type/builtin_type/test_equality.rb
qrb-0.1.0 spec/unit/type/builtin_type/test_equality.rb