Sha256: 88bbc8d3e24120ccc67bbcbf42f381316330603077966d58e70a3bc97f922fb1

Contents?: true

Size: 919 Bytes

Versions: 4

Compression:

Stored size: 919 Bytes

Contents

shared_examples_for "an optimizable expression for restrict" do

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

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

  let(:middle){
    optimized.operand
  }

  let(:inside){
    middle.operand
  }

  # before(:all) do
  #   puts "\n--------"
  #   puts Support.to_lispy(restriction)
  #   puts Support.to_lispy(optimized)
  # end

  specify "optimized leads to a restrict[initial[restrict[...]]]" do
    optimized.should be_a(Alf::Algebra::Restrict)
    middle.should be_a(subject.class)
    inside.should be_a(Alf::Algebra::Restrict)
  end

  specify "middle's signature is kept unchanged" do
    middle.signature.collect_on(subject).should eq(subject.signature.collect_on(subject))
  end

  specify "first restriction only applies on split attributes" do
    optimized.predicate.free_variables.should eq(split_attributes)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

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