Sha256: 580f637d52237336bef1c7be85920d38c56138f31219e010a0f6bef87e0b83a3
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
require 'compiler_helper' module Alf class Compiler describe Default, "frame" do subject{ compiler.call(expr) } let(:ordering){ Ordering.new([[:a, :asc]]) } shared_examples_for "the expected Take" do it_should_behave_like "a traceable compiled" it 'has a Take cog' do subject.should be_a(Engine::Take) end it 'has the correct take attributes' do subject.offset.should eq(10) subject.limit.should eq(20) end end context 'when not already sorted' do let(:expr){ frame(an_operand(leaf), ordering, 10, 20) } it_should_behave_like "the expected Take" it_should_behave_like "a compiled based on an added sub Sort" end context 'when not already sorted (inference possible)' do let(:expr){ op = an_operand(leaf).with_heading(a: String, b: String) .with_keys([:b]) frame(op, ordering, 10, 20) } let(:total_ordering){ Ordering.new([[:a, :asc], [:b, :asc]]) } it_should_behave_like "the expected Take" it_should_behave_like "a compiled based on an added sub Sort with total ordering" end context 'when already sorted' do let(:expr){ frame(sort(an_operand(leaf), subordering), ordering, 10, 20) } context 'in a compatible way' do let(:subordering){ Ordering.new([[:a, :asc], [:b, :desc]]) } it_should_behave_like "the expected Take" it_should_behave_like "a compiled reusing a sub Sort" end context 'in incompatible way' do let(:subordering){ Ordering.new([[:a, :desc]]) } it_should_behave_like "the expected Take" it_should_behave_like "a compiled not reusing a sub Sort" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alf-core-0.15.0 | spec/unit/alf-compiler/default/test_frame.rb |