aboutsummaryrefslogtreecommitdiff
path: root/test/lib/test-helpers.rb
diff options
context:
space:
mode:
authorPjotr Prins2021-08-25 09:54:44 +0200
committerPjotr Prins2021-08-25 09:54:44 +0200
commitbda453acb2aa202a0703e8863fead0f2289c0192 (patch)
treecc69771dce2ce8d1e3ec19440fe9548fa2a33d3a /test/lib/test-helpers.rb
parentc2681ce7969f24083243a3cb6cd2cb63a774a025 (diff)
downloadpangemma-bda453acb2aa202a0703e8863fead0f2289c0192.tar.gz
More tests and some flexibility with testing floats
Diffstat (limited to 'test/lib/test-helpers.rb')
-rw-r--r--test/lib/test-helpers.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/lib/test-helpers.rb b/test/lib/test-helpers.rb
index 72b9cd9..d2989e0 100644
--- a/test/lib/test-helpers.rb
+++ b/test/lib/test-helpers.rb
@@ -14,11 +14,17 @@ module TestHelpers
end
def expect(fn, list)
- lines = File.read(fn).split("\n") # avoid this for large files
+ lines = File.read(fn).split("\n")
+ lines = lines.map { |l| l.split("\t") } # avoid this for large files
list.each do | l |
line,colnum,value = l
- cols = lines[line].chomp.split("\t")
- assert_equal value,cols[colnum]
+ if line == :max
+ cols = lines.max_by {|a| a[colnum].to_f}
+ else
+ cols = lines[line]
+ end
+ # assert_equal value,cols[colnum]
+ assert_in_delta value.to_f,cols[colnum].to_f, 0.001
end
end
end