Skip to content

Commit

Permalink
Add tests for Reducer#sum with simple values
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 30, 2015
1 parent 9d3a77d commit 8c22eb9
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/unit/test_reducer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,40 @@ def create_record(*columns)
end
end

data(
:int => {
:expected => 3,
:left => 1,
:right => 2,
},
:float => {
:expected => 3.0,
:left => 1.0,
:right => 2.0,
},
:string => {
:expected => "ab",
:left => "a",
:right => "b",
},
:array => {
:expected => [0, 1],
:left => [0],
:right => [1],
},
:hash => {
:expected => [0, 1],
:left => [0],
:right => [1],
},
)
def test_sum(data)
reduced = reduce_value({ "type" => "sum" },
data[:left],
data[:right])
assert_equal(data[:expected], reduced)
end

data(
:int => {
:expected => 1.5,
Expand Down

0 comments on commit 8c22eb9

Please sign in to comment.