File: numeric.rb

package info (click to toggle)
mruby 1.0.0%2B20141015%2Bgitb4cc962c-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,408 kB
  • ctags: 3,526
  • sloc: ansic: 25,319; ruby: 10,638; yacc: 5,738; sh: 14; makefile: 12
file content (18 lines) | stat: -rw-r--r-- 315 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
##
# Numeric(Ext) Test

assert('Integer#chr') do
  assert_equal("A", 65.chr)
  assert_equal("B", 0x42.chr)

  # multibyte encoding (not support yet)
  assert_raise(RangeError) { 256.chr }
end

assert('Integer#div') do
  assert_equal 52, 365.div(7)
end

assert('Float#div') do
  assert_float 52, 365.2425.div(7)
end