Sha256: 8f07dd2b2b3fd4e05d65c9047f8b7c25a8523541a34d2901ad7ef2b90ae80415

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

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

      let(:p){ Predicate }
      subject{ pred.and_split(AttrList[: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

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-predicate/predicate/test_and_split.rb