#!/usr/bin/perl if ((($#ARGV+1) < 1) || ($ARGV[0] =~ /[-|\/][?|h|H]/)) { print "USAGE:: perl batchTst.pl excecutable_file\n"; print " ex. perl batchTst.pl expr_tc3.exe\n\n"; print " perl [/|-][?|h|H] to see this message\n"; print " ex. perl /?\n\n"; exit; } if (!(-s $ARGV[0])) { print "The specified file $ARGV[0] does not exist!\n"; exit; } if (!(-x $ARGV[0])) { print "The specified file $ARGV[0] is not executable!\n"; exit; } ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $thisday = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime)[6]]; if (!(-s "result.log")) {`echo \n\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n > result.log`} else {`echo \n\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n >> result.log`} `echo $mon/$mday $thisday $hour:$min:$sec >> result.log`; &testExp("1+2=","3"); &testExp("1-2=","-1"); &testExp("121.213 - 12.21 =","109.003"); &testExp("1 + 2 * 3 / 4 - 5 =", "-2.5"); &testExp("21.256 / 17.11 - 31.445 * 2.3=","-71.081186"); #&testExp("",""); #&testExp("",""); #&testExp("",""); `del tmpdata.txt`; open RESULT, "result.log"; $i = 1; while () { print; $i++; if ($i % 23 == 0) { print "Press to continue..."; ; } } close RESULT; exit; sub testExp { print "$ARGV[0] $_[0]\n"; #open TMPFILE, ">tmpdata.txt"; #print TMPFILE < tmpdata.txt`; `echo \n============================ >> result.log`; `echo $_[0] $_[1]>> result.log`; `$ARGV[0] < tmpdata.txt >> result.log`; }