Sha256: a52587196739058ad126433771f8389350aee6cc94a8c10981d415bd8dab9b27
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Optimizer::Function::Connective::Disjunction::Tautology, '#optimizable?' do subject { object.optimizable? } let(:attribute) { Attribute::Integer.new(:id) } let(:connective) { Function::Connective::Disjunction.new(left, right) } let(:object) { described_class.new(connective) } before do expect(object.operation).to be_kind_of(Function::Connective::Disjunction) end context 'when left is a tautology' do let(:left) { Function::Proposition::Tautology.instance } let(:right) { attribute.eq(1) } it { should be(true) } end context 'when right is a tautology' do let(:left) { attribute.eq(1) } let(:right) { Function::Proposition::Tautology.instance } it { should be(true) } end context 'when left and right are inequality predicates with the same attribute and constant values' do let(:left) { attribute.ne(1) } let(:right) { attribute.ne(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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-optimizer-0.2.0 | spec/unit/axiom/optimizer/function/connective/disjunction/tautology/optimizable_predicate_spec.rb |