Sha256: 2ea5ecd054d2f8b97f26cc71930e2adb2ef1519c9a8afb7b22957f87fd9bae01
Contents?: true
Size: 976 Bytes
Versions: 9
Compression:
Stored size: 976 Bytes
Contents
require 'spec_helper' module Alf module Engine describe Summarize::Cesure do let(:input) {[ {:a => "via_method", :time => 1}, {:a => "via_method", :time => 1}, {:a => "via_method", :time => 2}, {:a => "via_reader", :time => 4}, {:a => "via_reader", :time => 2}, ]} let(:expected) {[ {:a => "via_method", :time_sum => 4, :time_max => 2}, {:a => "via_reader", :time_sum => 6, :time_max => 4}, ].to_set} let(:aggs){Summarization.new( :time_sum => Aggregator.sum{ time }, :time_max => Aggregator.max{ time } )} it 'should summarize as expected' do sum = Summarize::Hash.new(input, AttrList[:a], aggs, false) sum.to_set.should eq(expected) end it 'should support allbut summarization' do sum = Summarize::Hash.new(input, AttrList[:time], aggs, true) sum.to_set.should eq(expected) end end end end
Version data entries
9 entries across 9 versions & 2 rubygems