Sha256: 2ea2e9d6ad0779e9b5a4a9c36a0b2c4aa0d5f2d6f780d0b3b44075845e6521b2

Contents?: true

Size: 748 Bytes

Versions: 4

Compression:

Stored size: 748 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:attribute)  { Attribute::Integer.new(:id)     }
  let(:left)       { attribute.include([ 1 ])        }
  let(:right)      { attribute.exclude([ 2 ])        }
  let(:object)     { described_class.new(connective) }

  before do
    object.operation.should be_kind_of(Function::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

4 entries across 4 versions & 1 rubygems

Version Path
veritas-optimizer-0.0.7 spec/unit/veritas/optimizer/function/connective/binary/redundant_left_operand/optimizable_spec.rb
veritas-optimizer-0.0.6 spec/unit/veritas/optimizer/function/connective/binary/redundant_left_operand/optimizable_spec.rb
veritas-optimizer-0.0.5 spec/unit/veritas/optimizer/function/connective/binary/redundant_left_operand/optimizable_spec.rb
veritas-optimizer-0.0.4 spec/unit/veritas/optimizer/function/connective/binary/redundant_left_operand/optimizable_spec.rb