[前][次][番号順一覧][スレッド一覧]

ruby-changes:42507

From: akr <ko1@a...>
Date: Fri, 15 Apr 2016 00:22:56 +0900 (JST)
Subject: [ruby-changes:42507] akr:r54581 (trunk): add assertions.

akr	2016-04-15 01:19:33 +0900 (Fri, 15 Apr 2016)

  New Revision: 54581

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54581

  Log:
    add assertions.

  Modified files:
    trunk/test/ruby/test_array.rb
Index: test/ruby/test_array.rb
===================================================================
--- test/ruby/test_array.rb	(revision 54580)
+++ test/ruby/test_array.rb	(revision 54581)
@@ -2726,7 +2726,6 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L2726
 
   def test_sum
     assert_int_equal(0, [].sum)
-    assert_float_equal(0.0, [].sum(0.0))
     assert_int_equal(3, [3].sum)
     assert_int_equal(8, [3, 5].sum)
     assert_int_equal(15, [3, 5, 7].sum)
@@ -2737,10 +2736,17 @@ class TestArray < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_array.rb#L2736
     assert_int_equal(0, ([FIXNUM_MAX, 1, -FIXNUM_MAX, -1]*10).sum)
     assert_int_equal(FIXNUM_MAX*10, ([FIXNUM_MAX+1, -1]*10).sum)
     assert_int_equal(2*FIXNUM_MIN, Array.new(2, FIXNUM_MIN).sum)
+
+    assert_float_equal(0.0, [].sum(0.0))
+    assert_float_equal(3.0, [3].sum(0.0))
+    assert_float_equal(3.5, [3].sum(0.5))
+    assert_float_equal(8.5, [3.5, 5].sum)
+    assert_float_equal(10.5, [2, 8.5].sum)
     assert_float_equal((FIXNUM_MAX+1).to_f, [FIXNUM_MAX, 1, 0.0].sum)
-    assert_float_equal(8.0, [3.0, 5].sum)
     assert_float_equal((FIXNUM_MAX+1).to_f, [0.0, FIXNUM_MAX+1].sum)
+
     assert_equal(2.0+3.0i, [2.0, 3.0i].sum)
+
     assert_int_equal(13, [1, 2].sum(10))
     assert_int_equal(16, [1, 2].sum(10) {|v| v * 2 })
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]