icp/oer/courses/c-basics/sections/26-files/02-write/test.sh

26 lines
396 B
Bash
Executable File

#!/bin/bash
correct=true
./program This is a test
program_out=$(cat output.txt)
./solution This is a test
solution_out=$(cat output.txt)
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
if [ "$correct" = true ]
then
echo "PASS";
else
echo "FAIL";
fi