Commit 4ad0896b authored by Tomoyuki Sahara's avatar Tomoyuki Sahara

add Integer#div and Float#div.

parent 6b6277e2
module Integral
def div(other)
self.divmod(other)[0]
end
end
......@@ -13,3 +13,11 @@ assert('Integer#chr') do
assert_raise(RangeError) { 256.chr }
end
end
assert('Integer#div') do
assert_equal 52, 365.div(7)
end
assert('Float#div') do
assert_float 52, 365.2425.div(7)
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment