Sha256: 0710df8f83be5b87d6af993ce18c18f221bcabb2343ba380b866f7a6b6b6620d

Contents?: true

Size: 1.06 KB

Versions: 11

Compression:

Stored size: 1.06 KB

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, 2) }

      it{ should be(right) }
    end

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

      it{ should eql(Factory.contradiction) }
    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]) }

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

    context 'with an eq 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

11 entries across 11 versions & 1 rubygems

Version Path
predicate-2.8.0 spec/nodes/in/test_and.rb
predicate-2.7.1 spec/nodes/in/test_and.rb
predicate-2.7.0 spec/nodes/in/test_and.rb
predicate-2.6.0 spec/nodes/in/test_and.rb
predicate-2.5.0 spec/nodes/in/test_and.rb
predicate-2.4.0 spec/nodes/in/test_and.rb
predicate-2.3.3 spec/nodes/in/test_and.rb
predicate-2.3.2 spec/nodes/in/test_and.rb
predicate-2.3.1 spec/nodes/in/test_and.rb
predicate-2.3.0 spec/nodes/in/test_and.rb
predicate-2.2.1 spec/nodes/in/test_and.rb