Sha256: 3ce59afa7dd60400d3cb2f651940fc447b473f3747398cefc24484b911c59891

Contents?: true

Size: 920 Bytes

Versions: 2

Compression:

Stored size: 920 Bytes

Contents

require 'spec_helper'

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

  let(:klass)      { Optimizer::Logic::Connective::Binary::RedundantLeftOperand }
  let(:attribute)  { Attribute::Integer.new(:id)                                }
  let(:left)       { attribute.include([ 1 ])                                   }
  let(:right)      { attribute.exclude([ 2 ])                                   }
  let(:object)     { klass.new(connective)                                      }

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

  context 'when the left operand is redundant' do
    let(:connective) { left.and(right).and(right) }

    it { should be(true) }
  end

  context 'when the left operand is not redundant' do
    let(:connective) { left.and(right) }

    it { should be(false) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/optimizer/logic/connective/binary/redundant_left_operand/optimizable_spec.rb
veritas-0.0.1 spec/unit/veritas/optimizer/logic/connective/binary/redundant_left_operand/optimizable_spec.rb