Sha256: 725d0fe6c0a033c752653c22ed1db002f381cd56f495c2ad4dd9577f8e8bd571

Contents?: true

Size: 965 Bytes

Versions: 4

Compression:

Stored size: 965 Bytes

Contents

shared_examples_for "a pass-through expression for restrict" do

  let(:the_predicate){
    defined?(predicate) ? predicate : Alf::Predicate.native(lambda{})
  }

  let(:restriction){
    restrict(subject, the_predicate)
  }

  let(:optimized){
    Alf::Optimizer::Restrict.new.call(restriction)
  }

  # before(:all) do
  #   puts Support.to_lispy(restriction)
  #   puts Support.to_lispy(optimized)
  # end

  specify "optimized leads to the initial operator" do
    optimized.should be_a(subject.class)
  end

  specify "optimized signature is unchanged" do
    optimized.signature.collect_on(subject).should eq(subject.signature.collect_on(subject))
  end

  specify "the restriction has been pushed with same predicate" do
    optimized.operands.each do |operand|
      operand.should be_a(Alf::Algebra::Restrict)
      repl = defined?(replaced_predicate) ? replaced_predicate : restriction.predicate
      operand.predicate.should eq(repl)
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-optimizer/shared/a_pass_through_expression_for_restrict.rb
alf-core-0.14.0 spec/unit/alf-optimizer/shared/a_pass_through_expression_for_restrict.rb
alf-core-0.13.1 spec/unit/alf-optimizer/shared/a_pass_through_expression_for_restrict.rb
alf-core-0.13.0 spec/unit/alf-optimizer/shared/a_pass_through_expression_for_restrict.rb