Sha256: 0704a0089de8355725f04d6111bed0eccb932b710f64d3a0dfd09f55aa796371

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'

describe 'Veritas::Optimizer::Logic::Connective::Conjunction::AlwaysFalse#optimizable?' do
  subject { object.optimizable? }

  let(:klass)      { Optimizer::Logic::Connective::Conjunction::AlwaysFalse }
  let(:attribute)  { Attribute::Integer.new(:id)                            }
  let(:connective) { Logic::Connective::Conjunction.new(left, right)        }
  let(:object)     { klass.new(connective)                                  }

  before do
    object.operation.should be_kind_of(Logic::Connective::Conjunction)
  end

  context 'when left is false' do
    let(:left)  { Logic::Proposition::False.instance }
    let(:right) { attribute.eq(1)                    }

    it { should be(true) }
  end

  context 'when right is false' do
    let(:left)  { attribute.eq(1)                    }
    let(:right) { Logic::Proposition::False.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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/optimizer/logic/connective/conjunction/always_false/optimizable_spec.rb
veritas-0.0.1 spec/unit/veritas/optimizer/logic/connective/conjunction/always_false/optimizable_spec.rb