Sha256: 79d2cf86fa5ce9356b8bc666113f2de8771d88dfb0d37ebceb186385235c48ff

Contents?: true

Size: 862 Bytes

Versions: 12

Compression:

Stored size: 862 Bytes

Contents

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

require 'hamster/set'

describe Hamster::Set do

  describe "#superset?" do

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

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

        before do
          @result = Hamster.set(*a).superset?(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/superset_spec.rb
hamster-0.3.5 spec/hamster/set/superset_spec.rb
hamster-0.3.4 spec/hamster/set/superset_spec.rb
hamster-0.3.3 spec/hamster/set/superset_spec.rb
hamster-0.3.2 spec/hamster/set/superset_spec.rb
hamster-0.3.1 spec/hamster/set/superset_spec.rb
hamster-0.3.0 spec/hamster/set/superset_spec.rb
hamster-0.2.13 spec/hamster/set/superset_spec.rb
hamster-0.2.12 spec/hamster/set/superset_spec.rb
hamster-0.2.11 spec/hamster/set/superset_spec.rb
hamster-0.2.9 spec/hamster/set/superset_spec.rb
hamster-0.2.8 spec/hamster/set/superset_spec.rb