From b4e5bff89dbacfe59219a3430e7c7f2e09a18028 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 19 May 2015 04:10:12 +0000 Subject: numeric.c: Bignum 0 is not positive * numeric.c (num_positive_p): should false on Bignum 0. http://twitter.com/rafaelfranca/status/600509783427391488 [ruby-core:69173] [Feature #11151] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_bignum.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb index 2c6eda0d8e..012a5624d0 100644 --- a/test/ruby/test_bignum.rb +++ b/test/ruby/test_bignum.rb @@ -268,6 +268,18 @@ class TestBignum < Test::Unit::TestCase assert_equal(2**180, (2**80) * o) end + def test_positive_p + assert_predicate(T_ONE, :positive?) + assert_not_predicate(T_MONE, :positive?) + assert_not_predicate(T_ZERO, :positive?) + end + + def test_negative_p + assert_not_predicate(T_ONE, :negative?) + assert_predicate(T_MONE, :negative?) + assert_not_predicate(T_ZERO, :negative?) + end + def test_mul_balance assert_equal(3**7000, (3**5000) * (3**2000)) end -- cgit v1.2.3