Sha256: efc42f4b5542b54d91e6dd49bd0317af4d912aefcbd1beec1b274146f5e3e6b6

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

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

      subject{ !pred }

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

        it{ should eq(Predicate.contradiction) }
      end

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

        it{ should eq(Predicate.tautology) }
      end

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

        it{ should eq(Predicate.identifier(:x)) }
      end

      context "on comp" do
        let(:pred){ Predicate.comp(:eq, :x => 2) }

        it{ should eq(Predicate.comp(:neq, :x => 2)) }
      end

      context "on eq" do
        let(:pred){ Predicate.eq(:x => 2) }

        it{ should eq(Predicate.neq(:x => 2)) }
      end

      context "on neq" do
        let(:pred){ Predicate.neq(:x => 2) }

        it{ should eq(Predicate.eq(:x => 2)) }
      end

      context "on lt" do
        let(:pred){ Predicate.lt(:x => 2) }

        it{ should eq(Predicate.gte(:x => 2)) }
      end

      context "on lte" do
        let(:pred){ Predicate.lte(:x => 2) }

        it{ should eq(Predicate.gt(:x => 2)) }
      end

      context "on gt" do
        let(:pred){ Predicate.gt(:x => 2) }

        it{ should eq(Predicate.lte(:x => 2)) }
      end

      context "on gte" do
        let(:pred){ Predicate.gte(:x => 2) }

        it{ should eq(Predicate.lt(:x => 2)) }
      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_bool_not.rb