summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authorYukihiro Matsumoto <matz@ruby-lang.org>1997-10-03 10:51:10 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 22:09:33 +0900
commit7ad198827b6029d5338c6a2dfe68248da25e9db5 (patch)
tree2fc097b92bcbb5daba091852b40ef1c2640bb457 /sample
parent10d21745c8c1c3c78678ea7e0b62c0a7433ccfce (diff)
version 1.0-971003v1_0_971003
https://cache.ruby-lang.org/pub/ruby/1.0/ruby-1.0-971003.tar.gz Fri Oct 3 10:51:10 1997 Yukihiro Matsumoto <matz@netlab.co.jp> * version 1.0-971003 * eval.c (ruby_options): f_require() called too early. * eval.c (rb_provide): module extentions should always be `.o'.
Diffstat (limited to 'sample')
-rw-r--r--sample/test.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/sample/test.rb b/sample/test.rb
index c940f00..382ca94 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -434,7 +434,6 @@ def fact(n)
f *= n
n -= 1
end
- p f
return f
end
fact(3)
@@ -453,14 +452,14 @@ ok(2-(2**32) == -(2**32-2))
ok(2**32 - 5 == (2**32-3)-2)
$good = TRUE;
-for i in 1000..3000
+for i in 1000..1024
$good = FALSE if ((1<<i) != (2**i))
end
ok($good)
$good = TRUE;
-n1=1
-for i in 0..3000
+n1=1<<1000
+for i in 1000..1024
$good = FALSE if ((1<<i) != n1)
n1 *= 2
end
@@ -468,7 +467,7 @@ ok($good)
$good = TRUE;
n2=n1
-for i in 3000..-1
+for i in 1..10
n1 = n1 / 2
n2 = n2 >> 1
$good = FALSE if (n1 != n2)
@@ -476,7 +475,7 @@ end
ok($good)
$good = TRUE;
-for i in 3500..4000
+for i in 4000..4192
n1 = 1 << i;
$good = FALSE if ((n1**2-1) / (n1+1) != (n1-1))
end