Sha256: d8bd3698c3a951018edec76d725326b711ee5f827356928b9cd610a07b513fa2

Contents?: true

Size: 795 Bytes

Versions: 2

Compression:

Stored size: 795 Bytes

Contents

require 'spec_helper'
module Finitio
  describe Heading, "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)])                             }

    it 'should apply structural equality' do
      (h1 == h2).should be_true
      (h2 == h1).should be_true
    end

    it 'should apply distinguish different types' do
      (h1 == h3).should be_false
      (h2 == h3).should be_false
    end

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

    it 'should implement hash accordingly' do
      [h1, h2].map(&:hash).uniq.size.should eq(1)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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