Sha256: 420db4b8bea8deb46dffe69a5b54c3f03232428d3fa7a7f65bdaeff431e9af73

Contents?: true

Size: 790 Bytes

Versions: 3

Compression:

Stored size: 790 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Function::Unary::UnoptimizedOperand, '#optimizable?' do
  subject { object.optimizable? }

  let(:described_class) { Class.new(Optimizer) { include Optimizer::Function::Unary }  }
  let(:function)        { Class.new(Function) { include Function::Unary }.new(operand) }
  let(:object)          { described_class.new(function)                                }

  before do
    described_class.class_eval { include Optimizer::Function::Unary::UnoptimizedOperand }
  end

  context 'when the operand is optimizable' do
    let(:operand) { Axiom::Function::Numeric::Absolute.new(1) }

    it { should be(true) }
  end

  context 'when the operand is not optimizable' do
    let(:operand) { 1 }

    it { should be(false) }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
axiom-optimizer-0.2.0 spec/unit/axiom/optimizer/function/unary/unoptimized_operand/optimizable_predicate_spec.rb
axiom-optimizer-0.1.1 spec/unit/axiom/optimizer/function/unary/unoptimized_operand/optimizable_predicate_spec.rb
axiom-optimizer-0.1.0 spec/unit/axiom/optimizer/function/unary/unoptimized_operand/optimizable_predicate_spec.rb