Sha256: e6eb1f88ce5ae40772bb423878d843798a138ef835c0c0b1ffbd63ce8199598d

Contents?: true

Size: 746 Bytes

Versions: 4

Compression:

Stored size: 746 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Function::Connective::Binary::RedundantRightOperand, '#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 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

4 entries across 4 versions & 1 rubygems

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