Sha256: 52b017f08b717020c6b0ae523166c475d964a0903eed338b70baf37ce284c883

Contents?: true

Size: 1.51 KB

Versions: 5

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'
class Predicate
  describe Predicate, "and_split" do

    let(:p){ Predicate }
    subject{ pred.and_split([:x]) }

    context "on tautology" do
      let(:pred){ p.tautology }

      it{ should eq([p.tautology, p.tautology]) }
    end

    context "on contradiction" do
      let(:pred){ p.contradiction }

      it{ should eq([p.tautology, pred]) }
    end

    context "on identifier (included)" do
      let(:pred){ p.identifier(:x) }

      it{ should eq([ pred, p.tautology ]) }
    end

    context "on identifier (excluded)" do
      let(:pred){ p.identifier(:y) }

      it{ should eq([ p.tautology, pred ]) }
    end

    context "on not (included)" do
      let(:pred){ p.not(:x) }

      it{ should eq([ pred, p.tautology ]) }
    end

    context "on not (excluded)" do
      let(:pred){ p.not(:y) }

      it{ should eq([ p.tautology, pred ]) }
    end

    context "on eq (included)" do
      let(:pred){ p.eq(:x, 2) }

      it{ should eq([ pred, p.tautology ]) }
    end

    context "on eq (excluded)" do
      let(:pred){ p.eq(:y, 2) }

      it{ should eq([ p.tautology, pred ]) }
    end

    context "on match (included)" do
      let(:pred){ p.match(:x, "London") }

      it{ should eq([ pred, p.tautology ]) }
    end

    context "on match (excluded)" do
      let(:pred){ p.match(:y, "London") }

      it{ should eq([ p.tautology, pred ]) }
    end

    context "on match (included on right)" do
      let(:pred){ p.match(:y, :x) }

      it{ should eq([ pred, p.tautology ]) }
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
predicate-2.2.1 spec/predicate/test_and_split.rb
predicate-2.2.0 spec/predicate/test_and_split.rb
predicate-2.1.0 spec/predicate/test_and_split.rb
predicate-2.0.1 spec/predicate/test_and_split.rb
predicate-2.0.0 spec/predicate/test_and_split.rb