diff options
Diffstat (limited to 'test/lib/test-helpers.rb')
-rw-r--r-- | test/lib/test-helpers.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/lib/test-helpers.rb b/test/lib/test-helpers.rb new file mode 100644 index 0000000..72b9cd9 --- /dev/null +++ b/test/lib/test-helpers.rb @@ -0,0 +1,24 @@ +module TestHelpers + + # Runs gemma and returns true if successful + def gemma(opts) + system("./bin/gemma #{opts}") + end + + def read(fn, line=0) + count = 0 + File.open(fn, "r:utf-8").each_line { |ln| + return ln.chomp.split("\t") if count == line + count += 1 + } + end + + def expect(fn, list) + lines = File.read(fn).split("\n") # avoid this for large files + list.each do | l | + line,colnum,value = l + cols = lines[line].chomp.split("\t") + assert_equal value,cols[colnum] + end + end +end |