summaryrefslogtreecommitdiffhomepage
path: root/test/t
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-08-26 02:24:18 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-08-26 02:24:18 +0900
commitecc77829ce76ad18995095bd39ffeae3e3663fac (patch)
treecaef850b5a733fe952c2a8a41752d01a591f0608 /test/t
parentb01b3c44728f66e0db1a9ab66fca7f6e8213f5e5 (diff)
parentbd6dc0da77470c2dfca7fbccf543cb94b17624af (diff)
downloadmruby-ecc77829ce76ad18995095bd39ffeae3e3663fac.tar.gz
mruby-ecc77829ce76ad18995095bd39ffeae3e3663fac.zip
Merge pull request #2562 from cubicdaiya/issues/pow_flo
Fix and add test for Numeric#pow behavior.
Diffstat (limited to 'test/t')
-rw-r--r--test/t/numeric.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/t/numeric.rb b/test/t/numeric.rb
index 2b01611a7..120cc960d 100644
--- a/test/t/numeric.rb
+++ b/test/t/numeric.rb
@@ -18,6 +18,14 @@ assert('Numeric#abs', '15.2.7.4.3') do
assert_equal(1.0, -1.abs)
end
+assert('Numeric#pow') do
+ assert_equal(8, 2 ** 3)
+ assert_equal(-8, -2 ** 3)
+ assert_equal(1, 2 ** 0)
+ assert_equal(1, 2.2 ** 0)
+ assert_equal(0.5, 2 ** -1)
+end
+
assert('Numeric#/', '15.2.8.3.4') do
n = Class.new(Numeric){ def /(x); 15.1;end }.new