diff --git a/test/test-android/app/main.rb b/test/test-android/app/main.rb index b1129062..93eff57f 100644 --- a/test/test-android/app/main.rb +++ b/test/test-android/app/main.rb @@ -181,6 +181,17 @@ class Object end end + TOLERANCE = 0.00003 + def be_close(expected, tolerance) + lambda do |obj, res| + if ((obj - expected).abs < tolerance) != res + puts "Expectation failed (expected `#{obj}' to be within #{expected} of tolerance #{tolerance}')" + $expectations_failures += 1 + end + $expectations_total += 1 + end + end + def mock(obj) # XXX we probably should be smarter here. obj