Sha256: aeed6192a3097d09b43f16fef8cf09b9330969ba22dde4934009f116b8e4d440
Contents?: true
Size: 1.66 KB
Versions: 5
Compression:
Stored size: 1.66 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Optimizer::Function::Connective::Conjunction::Contradiction, '#optimizable?' do subject { object.optimizable? } let(:attribute) { Attribute::Integer.new(:id) } let(:connective) { Function::Connective::Conjunction.new(left, right) } let(:object) { described_class.new(connective) } before do object.operation.should be_kind_of(Function::Connective::Conjunction) end context 'when left is a contradiction' do let(:left) { Function::Proposition::Contradiction.instance } let(:right) { attribute.eq(1) } it { should be(true) } end context 'when right is a contradiction' do let(:left) { attribute.eq(1) } let(:right) { Function::Proposition::Contradiction.instance } it { should be(true) } end context 'when left and right are equality predicates with the same attribute and constant values' do let(:left) { attribute.eq(1) } let(:right) { attribute.eq(2) } it { should be(true) } end context 'when left and right are inverses' do let(:left) { attribute.eq(1) } let(:right) { attribute.ne(1) } it { should be(true) } end context 'when left and right are procs' do let(:left) { proc {} } let(:right) { proc {} } it { should be(false) } end context 'when left is a proc' do let(:left) { proc {} } let(:right) { attribute.ne(1) } it { should be(false) } end context 'when right is a proc' do let(:left) { attribute.eq(1) } let(:right) { proc {} } it { should be(false) } end end
Version data entries
5 entries across 5 versions & 2 rubygems