icp/oer/courses/c-basics/sections/03-functions/07-funktions/test.sh

32 lines
487 B
Bash
Raw Normal View History

2018-05-05 22:18:02 +00:00
#!/bin/bash
correct=true
for (( i = 0; i < 3; i++ )); do
a=$(( ( RANDOM % 9 ) + 1))
b=$(( ( RANDOM % a ) + 1))
c=$(( ( RANDOM % a ) + 1))
program_out=$(./program $a $b $c)
solution_out=$(./solution $a $b $c)
if [ "$program_out" == "$solution_out" ]
then
echo "PASS " $program_out " equals " $solution_out
else
echo "FAIL " $program_out " DOES NOT EQUAL " $solution_out
correct=false
fi
done
if [ "$correct" = true ]
then
echo "PASS";
else
echo "FAIL";
fi