Sha256: e2fb6bef2d49acc71c7dd46bfb74a9dad331b6cefe54aa7041cdc1f3aed84eab

Contents?: true

Size: 748 Bytes

Versions: 2

Compression:

Stored size: 748 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Optimizer::Function::Unary::ConstantOperand, '#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::ConstantOperand }
  end

  context 'when the operand is a constant' do
    let(:operand) { 1 }

    it { should be(true) }
  end

  context 'when the operand is not a constant' do
    let(:operand) { proc {} }

    it { should be(false) }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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