YUKI Hiroshi
null+****@clear*****
Thu Apr 30 16:59:34 JST 2015
YUKI Hiroshi 2015-04-30 16:59:34 +0900 (Thu, 30 Apr 2015) New Revision: 8c22eb98dc59ff043da2a1bbd5193dceeb2fd9fb https://github.com/droonga/droonga-engine/commit/8c22eb98dc59ff043da2a1bbd5193dceeb2fd9fb Message: Add tests for Reducer#sum with simple values Modified files: test/unit/test_reducer.rb Modified: test/unit/test_reducer.rb (+34 -0) =================================================================== --- test/unit/test_reducer.rb 2015-04-30 16:59:06 +0900 (2dd2926) +++ test/unit/test_reducer.rb 2015-04-30 16:59:34 +0900 (b81bd62) @@ -34,6 +34,40 @@ class ReducerTest < Test::Unit::TestCase 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, :left => 1, :right => 2, -------------- next part -------------- HTML����������������������������... 다운로드