diff options
| author | Paolo Bosetti <[email protected]> | 2012-08-06 15:02:03 +0200 |
|---|---|---|
| committer | Paolo Bosetti <[email protected]> | 2012-08-06 15:02:56 +0200 |
| commit | aa0d2f91447c49363059f2e95cb9023f65a6fbef (patch) | |
| tree | 2cfa325956e62648f2161564adfdf6dddc45b737 /test/assert.rb | |
| parent | fd097b8aff7b91bd105fc1daec5a4050a947b763 (diff) | |
| parent | 193c98ae540d43d082795fd77ea81a4f6f7fd0f6 (diff) | |
| download | mruby-aa0d2f91447c49363059f2e95cb9023f65a6fbef.tar.gz mruby-aa0d2f91447c49363059f2e95cb9023f65a6fbef.zip | |
Updated Xcode project build settings in conformity with 10.8/Xcode 4.4
Diffstat (limited to 'test/assert.rb')
| -rw-r--r-- | test/assert.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/assert.rb b/test/assert.rb index 239730cb9..89e820a00 100644 --- a/test/assert.rb +++ b/test/assert.rb @@ -2,6 +2,7 @@ $ok_test = 0 $ko_test = 0 $kill_test = 0 $asserts = [] +$test_start = Time.now if Object.const_defined?(:Time) ## # Print the assertion in a readable way @@ -32,7 +33,7 @@ def assert(str = 'Assertion failed', iso = '') $ok_test += 1 print('.') end - rescue => e + rescue Exception => e $asserts.push(['Error: ', str, iso, e]) $kill_test += 1 print('X') @@ -68,18 +69,24 @@ def report() print('Crash: ') print($kill_test) print("\n") + + if Object.const_defined?(:Time) + print(' Time: ') + print(Time.now - $test_start) + print(" seconds\n") + end end ## # Performs fuzzy check for equality on methods returning floats # on the basis of the Math::TOLERANCE constant. def check_float(a, b) + tolerance = Math::TOLERANCE a = a.to_f b = b.to_f if a.finite? and b.finite? - (a-b).abs < Math::TOLERANCE + (a-b).abs < tolerance else true end end - |
