diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-04 17:04:47 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-06-04 17:04:47 -0700 |
| commit | 114168a551ffe4c429f9eeb2b2ccc09471b403a5 (patch) | |
| tree | 3b4a9483b6993a471de6a1096caaa92114e14755 /test | |
| parent | 2778058a8aaf119a032f689fb36d77f9787ab13d (diff) | |
| parent | 2c7cee8a1a7886691f5103a4319fca411408b500 (diff) | |
| download | mruby-114168a551ffe4c429f9eeb2b2ccc09471b403a5.tar.gz mruby-114168a551ffe4c429f9eeb2b2ccc09471b403a5.zip | |
Merge pull request #245 from pbosetti/tests
Added Math.sqrt() that was missing in math.c, and added relevant test case
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/math.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/t/math.rb b/test/t/math.rb index 5b9da4cb3..47a3bf527 100644 --- a/test/t/math.rb +++ b/test/t/math.rb @@ -76,6 +76,16 @@ assert('Math.log10 10**100') do check_float(Math.log10(10**100), 100.0) end +assert('Math.sqrt') do + num = [0.0, 1.0, 2.0, 3.0, 4.0] + sqr = [0, 1, 4, 9, 16] + result = true + sqr.each_with_index do |v,i| + result &= check_float(Math.sqrt(v), num[i]) + end + result +end + assert('Math.cbrt') do num = [-2.0, -1.0, 0.0, 1.0, 2.0] cub = [-8, -1, 0, 1, 8] |
