Sha256: f80f14e59615304bb7ac872374d61aef5b584dfd1bf2a0f5e3df0e84d9a823cb

Contents?: true

Size: 758 Bytes

Versions: 9

Compression:

Stored size: 758 Bytes

Contents

require 'spec_helper'
class Predicate
  describe In, "&" do

    let(:left){
      Factory.in(:x, [2, 4, 8])
    }

    subject{ left & right }

    context 'with an eq on same variable' do
      let(:right){ Factory.eq(:x, 3) }

      it{ should be(right) }
    end

    context 'with an in on same variable' do
      let(:right){ Factory.in(:x, [2, 4, 5]) }

      it{ should eql(Factory.in(:x, [2, 4])) }
    end

    context 'with an in on same variable, leading to a singleton' do
      let(:right){ Factory.in(:x, [2, 5]) }

      it{ should eql(Factory.eq(:x, 2)) }
    end

    context 'with an in on same variable, leading to a empty set' do
      let(:right){ Factory.in(:x, [5]) }

      it{ should eql(Factory.contradiction) }
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
predicate-2.2.0 spec/nodes/in/test_and.rb
predicate-2.1.0 spec/nodes/in/test_and.rb
predicate-2.0.1 spec/nodes/in/test_and.rb
predicate-2.0.0 spec/nodes/in/test_and.rb
predicate-1.3.4 spec/nodes/in/test_and.rb
predicate-1.3.3 spec/nodes/in/test_and.rb
predicate-1.3.2 spec/nodes/in/test_and.rb
predicate-1.3.1 spec/nodes/in/test_and.rb
predicate-1.3.0 spec/nodes/in/test_and.rb