mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge branch 'tests' of github.com:pbosetti/mruby into tests
This commit is contained in:
+1
-1
@@ -22,7 +22,7 @@ end
|
||||
# iso : The ISO reference code of the feature
|
||||
# which will be tested by this
|
||||
# assertion
|
||||
def assert(str = 'Assertion failed', iso = '')
|
||||
def assert(str = 'Assertion failed', iso = 'No ISO')
|
||||
begin
|
||||
if(!yield)
|
||||
$asserts.push([str, iso])
|
||||
|
||||
+2
-3
@@ -1,12 +1,11 @@
|
||||
##
|
||||
# Math Test
|
||||
|
||||
MATH_TOLERANCE = 1E-12
|
||||
def check(a,b)
|
||||
a = a.to_f
|
||||
b = b.to_f
|
||||
if a.finite? and b.finite?
|
||||
(a-b).abs < MATH_TOLERANCE
|
||||
(a-b).abs < Math::TOLERANCE
|
||||
else
|
||||
true
|
||||
end
|
||||
@@ -14,7 +13,7 @@ end
|
||||
|
||||
|
||||
assert('Math.sin 0') do
|
||||
check(Math.sin(0), 0)
|
||||
check(Math.sin(0), 1)
|
||||
end
|
||||
|
||||
assert('Math.sin PI/2') do
|
||||
|
||||
Reference in New Issue
Block a user