diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-01 13:16:09 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-12-01 13:16:09 +0000 |
commit | ac761cda209ded2ef48bec9fcc54a979bc6caafc (patch) | |
tree | 8000b2085994162b5fb597dc3c14c609681408f9 /sample/test.rb | |
parent | b0acbc4c9afd41602ec9f4b0ee6914b4461ccd32 (diff) |
* numeric.c (num_sadded): prohibit singleton method definition for
Numerics. fill yet another gap between Fixnum and Bignum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/test.rb')
-rw-r--r-- | sample/test.rb | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/sample/test.rb b/sample/test.rb index 6488558fd1..65cfcad475 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -1179,27 +1179,27 @@ test_ok(2.6.round == 3) test_ok((-2.4).truncate == -2) test_ok((13.4 % 1 - 0.4).abs < 0.0001) nan = 0.0/0 -def nan.test(v) - test_ok(self != v) - test_ok((self < v) == false) - test_ok((self > v) == false) - test_ok((self <= v) == false) - test_ok((self >= v) == false) -end -nan.test(nan) -nan.test(0) -nan.test(1) -nan.test(-1) -nan.test(1000) -nan.test(-1000) -nan.test(1_000_000_000_000) -nan.test(-1_000_000_000_000) -nan.test(100.0); -nan.test(-100.0); -nan.test(0.001); -nan.test(-0.001); -nan.test(1.0/0); -nan.test(-1.0/0); +def nan_test(x,y) + test_ok(x != y) + test_ok((x < y) == false) + test_ok((x > y) == false) + test_ok((x <= y) == false) + test_ok((x >= y) == false) +end +nan_test(nan, nan) +nan_test(nan, 0) +nan_test(nan, 1) +nan_test(nan, -1) +nan_test(nan, 1000) +nan_test(nan, -1000) +nan_test(nan, 1_000_000_000_000) +nan_test(nan, -1_000_000_000_000) +nan_test(nan, 100.0); +nan_test(nan, -100.0); +nan_test(nan, 0.001); +nan_test(nan, -0.001); +nan_test(nan, 1.0/0); +nan_test(nan, -1.0/0); #s = "3.7517675036461267e+17" #test_ok(s == sprintf("%.16e", s.to_f)) |