#!/usr/bin/ruby -w tests = [ "public_RE_to_str", "public_str_to_RE", "public_NFA_step", "public_NFA_accept", "public_RE_to_NFA", "public_str_to_NFA" ] tests.each { |x| system("ocaml #{x}.ml > #{x}.log") if $? != 0 puts "#{x} failed: run-time error" end system("diff #{x}.log #{x}.out") if $? != 0 puts "#{x} failed: incorrect output" else puts "#{x} passed" end }