about summary refs log tree commit diff
path: root/test/lib
diff options
context:
space:
mode:
authorPjotr Prins2021-08-25 10:55:14 +0200
committerPjotr Prins2021-08-25 10:55:14 +0200
commitb0c7f0ed464b134d1fdf6acd050f122a5ca96801 (patch)
tree6b61ad9790332fe5b001348b1c306f481bdf7943 /test/lib
parentbda453acb2aa202a0703e8863fead0f2289c0192 (diff)
downloadpangemma-b0c7f0ed464b134d1fdf6acd050f122a5ca96801.tar.gz
New test suite is working and takes account of round-off problems.
Closes #247
Closes #242
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/test-helpers.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/lib/test-helpers.rb b/test/lib/test-helpers.rb
index d2989e0..672a2c2 100644
--- a/test/lib/test-helpers.rb
+++ b/test/lib/test-helpers.rb
@@ -2,7 +2,7 @@ module TestHelpers
 
   # Runs gemma and returns true if successful
   def gemma(opts)
-    system("./bin/gemma #{opts}")
+    assert system("./bin/gemma #{opts}")
   end
 
   def read(fn, line=0)
@@ -18,11 +18,15 @@ module TestHelpers
     lines = lines.map { |l| l.split("\t") } # avoid this for large files
     list.each do | l |
       line,colnum,value = l
-      if line == :max
-        cols = lines.max_by {|a| a[colnum].to_f}
-      else
-        cols = lines[line]
+      if colnum.is_a? String
+        colnum = lines[0].index(colnum)
       end
+      cols =
+        if line == :max
+          lines.max_by {|a| a[colnum].to_f}
+        else
+          lines[line]
+        end
       # assert_equal value,cols[colnum]
       assert_in_delta value.to_f,cols[colnum].to_f, 0.001
     end