#!/usr/bin/perl -w # run with: # $perl run # change this to the name of your program $prog = 'graph'; $test_dir = 'tests'; @tests = `ls $test_dir | grep 't[0-9][0-9]\$'`; foreach (@tests) { chomp($_); `./$prog < $test_dir/$_ > $test_dir/$_.myout 2>/dev/null`; `diff $test_dir/$_.myout $test_dir/$_.out > /dev/null 2>&1`; if($? == 0) { print "passed $_\n"; } else { print "failed $_\n"; } }