From b0c7f0ed464b134d1fdf6acd050f122a5ca96801 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Wed, 25 Aug 2021 10:55:14 +0200 Subject: New test suite is working and takes account of round-off problems. Closes #247 Closes #242 --- test/lib/test-helpers.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'test/lib') 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 -- cgit v1.2.3