I need to write a script to test a nsort c program. I have written 8 .txt files with different cases. Also 8 .txt files with expected outcome. The shell I have written always "test pass" for the first case but always "fail" for the rest... Here is a portion of my code (as I still don't know how to cut more than what's on the screen
#!/bin/sh
#
# test whether the nsort program is working alright
#
echo "Testing NSort..."
# run the output of our program
./nsort t1.txt > /tmp/test-A.$$
if
# use the diff(1) program to compare and see if
# there are any problems
diff -q /tmp/test-A.$$ t1a.txt
then
echo "TESTCASE: t1a - PASS"
else
echo "TESTCASE: T1A - FAIL"
fi
rm -f /tmp/test-A.$$
# run the output of our program
./nsort t2.txt > /tmp/test-B.$$
if
# use the diff(1) program to compare and see if
# there are any problems
diff -q /tmp/test-B.$$ t2a.txt
then
echo "TESTCASE: t2a - PASS"
else
echo "TESTCASE: t2a - FAIL"
fi
rm -f /tmp/test-B.$$
# run the output of our program
./nsort t3.txt > /tmp/test-C.$$
if
# use the diff(1) program to compare and see if
# there are any problems
diff -q /tmp/test-C.$$ t3a.txt
then
echo "TESTCASE: t3a - PASS"
BLA BLA BLA................. this continues til test 8...
Am I doing something wrong?