Sha256: 70a9e831ffada5f3b38dcfe1ed9b9b5e99577d8f64d1f17b166229587dc367ff

Contents?: true

Size: 927 Bytes

Versions: 2

Compression:

Stored size: 927 Bytes

Contents

require 'spec_helper'

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

  let(:klass)      { Optimizer::Logic::Connective::Binary::RedundantRightOperand }
  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 right operand is redundant' do
    let(:connective) { left.and(left.and(right)) }

    it { should be(true) }
  end

  context 'when the right 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_right_operand/optimizable_spec.rb
veritas-0.0.1 spec/unit/veritas/optimizer/logic/connective/binary/redundant_right_operand/optimizable_spec.rb