Sha256: 9c6f6fc238db0e7273a5d5fb1b206e2b5686ba28d2aea12933cffb474e33b99b

Contents?: true

Size: 858 Bytes

Versions: 12

Compression:

Stored size: 858 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)

require 'hamster/set'

describe Hamster::Set do

  describe "#subset?" do

    [
      [[], [], true],
      [["A"], [], false],
      [[], ["A"], true],
      [["A"], ["A"], true],
      [["A", "B", "C"], ["B"], false],
      [["B"], ["A", "B", "C"], true],
      [["A", "B", "C"], ["A", "C"], false],
      [["A", "C"], ["A", "B", "C"], true],
      [["A", "B", "C"], ["A", "B", "C"], true],
      [["A", "B", "C"], ["A", "B", "C", "D"], true],
      [["A", "B", "C", "D"], ["A", "B", "C"], false],
    ].each do |a, b, expected|

      describe "for #{a.inspect} and #{b.inspect}" do

        before do
          @result = Hamster.set(*a).subset?(Hamster.set(*b))
        end

        it "returns #{expected}"  do
          @result.should == expected
        end

      end

    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hamster-0.3.6 spec/hamster/set/subset_spec.rb
hamster-0.3.5 spec/hamster/set/subset_spec.rb
hamster-0.3.4 spec/hamster/set/subset_spec.rb
hamster-0.3.3 spec/hamster/set/subset_spec.rb
hamster-0.3.2 spec/hamster/set/subset_spec.rb
hamster-0.3.1 spec/hamster/set/subset_spec.rb
hamster-0.3.0 spec/hamster/set/subset_spec.rb
hamster-0.2.13 spec/hamster/set/subset_spec.rb
hamster-0.2.12 spec/hamster/set/subset_spec.rb
hamster-0.2.11 spec/hamster/set/subset_spec.rb
hamster-0.2.9 spec/hamster/set/subset_spec.rb
hamster-0.2.8 spec/hamster/set/subset_spec.rb