Sha256: 110cdd366fab119816f9158196473e62d883408497ba6569acbf3939caf2b69b

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'
module Alf
  module Algebra
    describe Signature, "#collect_on" do

      subject{ op.class.signature.collect_on(op) }

      let(:suppliers){ an_operand }
      let(:cities)   { an_operand }

      let(:operands)  { subject[0] }
      let(:arguments) { subject[1] }
      let(:options)   { subject[2] }

      describe "on a nullary op" do
        let(:op){ a_lispy.generator(10, :id) }

        it{ should eq([[], [10, :id], {}]) }
      end

      describe "on a monadic op, with one arg" do
        let(:op){ a_lispy.autonum(suppliers, :id) }

        it{ should eq([ [suppliers], [:id], {} ]) }
      end

      describe "on a monadic op, with one arg and an option" do
        let(:op){ a_lispy.project(suppliers, [:name, :city], :allbut => true) }

        it{ should eq([[suppliers], [AttrList[:name, :city]], {:allbut => true}]) }
      end

      describe "on a dyadic op" do
        let(:op){ a_lispy.join(suppliers, cities) }

        it{ should eq([[suppliers, cities], [], {}]) }
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-algebra/support/signature/test_collect_on.rb
alf-core-0.14.0 spec/unit/alf-algebra/support/signature/test_collect_on.rb
alf-core-0.13.1 spec/unit/alf-algebra/support/signature/test_collect_on.rb
alf-core-0.13.0 spec/unit/alf-algebra/support/signature/test_collect_on.rb