Sha256: 2fc1345749e8ae0bef68736b904d9237124b052c958643566c6bd42b42bee79a

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

shared_examples_for "a split-able expression for restrict" do

  let(:split_pred){
    Alf::Predicate.eq(split_attributes.to_a.first, 12)
  }
  let(:stay_pred){
    Alf::Predicate.eq(:a_non_split_attribute, 12)
  }

  context 'with a native predicate' do
    let(:predicate){ Alf::Predicate.native(lambda{ true }) }

    it_should_behave_like "an unoptimizable expression for restrict"
  end

  context 'with no split attributes' do
    let(:predicate){ stay_pred }

    it_should_behave_like "a pass-through expression for restrict"
  end

  context 'with only split attributes' do
    let(:predicate){ split_pred }

    it_should_behave_like "an unoptimizable expression for restrict"
  end

  context 'with split and non-split in a OR' do
    let(:predicate){ split_pred | stay_pred }

    it_should_behave_like "an unoptimizable expression for restrict"
  end

  context 'with split and non-split in a COMP' do
    let(:predicate){ split_pred & stay_pred }

    it_should_behave_like "an optimizable expression for restrict"
  end

  context 'with split and non-split in the same EXPR' do
    let(:predicate){ Alf::Predicate.eq(split_attributes.to_a.first, :a_non_split_attribute) }

    it_should_behave_like "an unoptimizable expression for restrict"
  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_split_able_expression_for_restrict.rb
alf-core-0.14.0 spec/unit/alf-optimizer/shared/a_split_able_expression_for_restrict.rb
alf-core-0.13.1 spec/unit/alf-optimizer/shared/a_split_able_expression_for_restrict.rb
alf-core-0.13.0 spec/unit/alf-optimizer/shared/a_split_able_expression_for_restrict.rb