aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_numeric.rb
Commit message (Collapse)AuthorAgeFilesLines
* * test/ruby/test_numeric.rb (test_step): Use Integer::FIXNUM_MAX.akr2016-05-011-2/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* assertions.rb: set default internal encodingnobu2016-04-091-12/+8
| | | | | | | | | | * test/lib/test/unit/assertions.rb (assert_raise_with_message): set default internal encoding to the excpected message, which affects String#inspect in messages. * test/lib/test/unit/assertions.rb (assert_warning): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: wrong type step should raise TypeErrornobu2016-02-261-2/+2
| | | | | | | | * numeric.c (num_step_scan_args): comparison String with Numeric should raise TypeError. it is an invalid type, but not a mismatch the number of arguments. [ruby-core:62430] [Bug #9810] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: fix segfaultnobu2016-02-161-0/+10
| | | | | | | * numeric.c (compare_with_zero): fix variable name, rb_cmperr requires VALUEs but not an ID. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_numeric.rb (test_nonzero_p): added test for String#nonzero?hsbt2016-01-051-0/+12
| | | | | | [fix GH-1187] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: Numeric#positive? and Numeric#negative?nobu2015-05-171-0/+24
| | | | | | | | | | | | * numeric.c (num_positive_p, num_negative_p): add methods Numeric#positive? and Numeric#negative?. [ruby-core:69173] [Feature #11151] * numeric.c (flo_positive_p, flo_negative_p): specialiazed functions for Float. * complex.c (Init_Complex): Complex do not have positive? and negative? methods git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_numeric.rb: separate dummy classesnobu2015-05-171-87/+35
| | | | | | | * test/ruby/test_numeric.rb: use separate dummy classes for each test cases. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_numeric.rb (TestNumeric#test_coerce): fixed wrong message.usa2015-01-121-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: correct error message when coerce failsnormal2015-01-121-0/+4
| | | | | | | | * numeric.c (bit_coerce): use original value for error message [ruby-core:67405] [Bug #10711] * test/ruby/test_numeric.rb (test_coerce): check error message git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/lib/envutil.rb: Moved from test/ruby/.akr2014-11-131-1/+0
| | | | | | | | | | | | | | * test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (do_coerce): Add a warning when an exception is raisederegon2014-06-071-0/+17
| | | | | | | | | | | | or an invalid value is returned in #coerce called by numeric comparison operators and the exception thrown by the caller has no information on the failure. In the next release such exception should not be rescued or should be the cause of the caller exception. nil is accepted as the "no possible coercion" return value. See #7688. * test/ruby/test_numeric.rb: Add corresponding test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: check keyword argumentsnobu2014-05-071-0/+8
| | | | | | | | * numeric.c (num_step_scan_args): check keyword arguments and fail if they conflict with positional arguments. [ruby-dev:48177] [Bug #9811] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: float overflownobu2014-02-281-0/+8
| | | | | | | * numeric.c (ruby_num_interval_step_size): get rid of float conversion overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: integer overflownobu2014-02-281-1/+5
| | | | | | | * numeric.c (ruby_num_interval_step_size): get rid of integer overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c: Fix Numeric#step with 0 unit [#9575]marcandre2014-02-281-0/+14
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test_numeric: Strengthen tests on 64 bit platformsmarcandre2014-02-281-4/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: check signs before divisionnobu2014-02-271-0/+2
| | | | | | | | * numeric.c (ruby_num_interval_step_size): check signs and get rid of implementation dependent behavior of negative division. [ruby-core:61106] [Bug #9570] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_numeric.rb: default_externalnobu2014-01-151-4/+13
| | | | | | | * test/ruby/test_numeric.rb (test_coerce): manage Encoding.default_external. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: preserve encodingnobu2014-01-151-1/+10
| | | | | | * numeric.c (num_init_copy): preserve encoding of error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: preserve encodingnobu2014-01-151-2/+2
| | | | | | * numeric.c (num_sadded): preserve encoding of error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: preserve encodingnobu2014-01-151-0/+5
| | | | | | * numeric.c (coerce_failed): preserve encoding of error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_numeric.rb: coercion failuresnobu2014-01-151-0/+5
| | | | | | | * test/ruby/test_numeric.rb (test_coerce): new assertions for failure of coercion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby: better assertionsnobu2013-12-131-7/+7
| | | | | | * test/ruby: use better assertions instead of mere assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* numeric.c: no extra checksnobu2013-09-071-2/+2
| | | | | | | * numeric.c (NUM_STEP_SCAN_ARGS): remove extra class checks, which cause the incompatibilities. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Retain behavior of Numeric#step when nil is given as second argument.knu2013-09-021-2/+2
| | | | | | | | | | | | | * numeric.c (NUM_STEP_SCAN_ARGS): On sencond thought, keep Numeral#step backward compatible in that it raises TypeError when nil is given as second argument. * test/ruby/test_float.rb (TestFloat#test_num2dbl): Revert. * test/ruby/test_numeric.rb (TestNumeric#test_step): Fix test cases for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix and add tests for Numeric#step.knu2013-09-021-0/+10
| | | | | | | | | | * test/ruby/test_float.rb (TestFloat#test_num2dbl): Allow nil as step, as with the keyword argument. * test/ruby/test_numeric.rb (TestNumeric#test_step): Add tests for nil as step or limit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Enhance Numeric#step.knu2013-09-021-32/+55
| | | | | | | | | | | * numeric.c (num_step): Default the limit argument to infinity and allow it to be omitted. Keyword arguments (by: and to:) are introduced for ease of use. [Feature #8838] [ruby-dev:47662] [ruby-dev:42194] * numeric.c (num_step): Optimize for infinite loop. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_quo): Use to_r method to convert the receiver tomrkn2013-06-061-1/+14
| | | | | | | | rational. [ruby-core:41575] [Bug #5736] * test/ruby/test_numeric.rb: add a test for the above change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_numeric.rb (test_num2long): modify a test agaist themrkn2011-08-291-1/+1
| | | | | | change by r33108. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (ruby_float_step): fix Numeric#step with infinity unitnaruse2010-10-131-0/+13
| | | | | | doesn't works well. [ruby-core:32779] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_method.c (rb_remove_method_id): exported.nobu2009-08-271-0/+1
| | | | | | | * numeric.c (num_sadded): fix for non-ascii method name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_div): don't use num_floor which is actuallytadf2009-06-201-0/+4
| | | | | | | | | | | | | | | | flo_floor. * numeric.c (num_modulo): don't call '%'. * numeric.c (num_divmod): use num_modulo. * numeric.c: defined '%'. * rational.c (nurat_idiv,nurat_mod,nurat_divmod,nurat_rem): removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c: provides predicate real? instead of scalar?.tadf2008-09-161-2/+2
| | | | | | | | | | * complex.c: follows the above change. * lib/cmath.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_div): should raise ZeroDivisionError.matz2008-05-271-3/+3
| | | | | | | | | * numeric.c (fix_divide): ditto. * test/ruby/test_numeric.rb (TestNumeric::test_divmod): avoid ZeroDivisionError in tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (bit_coerce): float should not be a valid operand ofmatz2008-05-071-3/+3
| | | | | | bitwise operations. [ruby-dev:34583] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (rb_big_fdiv): flo.fdiv(NaN) should result NaN.matz2008-05-071-10/+1
| | | | | | | | | | | | | | * numeric.c (num_quo): renamed and moved from bignum.c. [ruby-dev:34582] * bignum.c (rb_big_fdiv): update RDoc description * rational.c (nurat_s_new_m): small refactoring. * bignum.c (rb_big2dbl): no need for forceful warning when converting to float. overflow is a nature of float values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c: cancelled recent changes (except to remove rdiv).tadf2008-04-071-1/+10
| | | | | | | | | | * bignum.c: ditto. * bignum.c: added rb_big_idiv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * numeric.c (num_rdiv): should always return rational number.matz2008-04-021-10/+1
| | | | | | | | | | | * rational.c (nurat_add, nurat_sub, nurat_mul, nurat_fdiv, nurat_cmp): use rb_num_coerce_bin(). * rational.c (nurat_division): does / and rdiv. * .gdbinit (rp): no longer use rb_p(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15887 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_numeric.rb (TestNumeric::test_num2long): bit-andmatz2008-03-131-4/+2
| | | | | | should not raise RangeError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add a test for [ruby-dev:34006].akr2008-03-081-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* code duplication removed.akr2008-03-081-223/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_pack.rb: fix tests for 64bit CPU.mame2008-02-101-1/+4
| | | | | | | | | | | | | | | | | * test/ruby/test_bignum.rb: ditto. * test/ruby/test_file_exhaustive.rb: ditto. * test/ruby/test_integer.rb: ditto. * test/ruby/test_time.rb: ditto. * test/ruby/test_numeric.rb: ditto. * test/ruby/test_fixnum.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_file_exhaustive.rb: add tests to achive over 80% test ↵mame2008-02-031-0/+446
coverage of file.c. * test/ruby/test_numeric.rb: forgot to add this (at r15360). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e