#!/usr/bin/bash function files() { if [ ! -f "$1.txt" ]; then echo "Creating $1.txt" touch "$1.txt" fi if [ ! -f "$1_Expected.txt" ]; then echo "Creating $1_Expected.txt" touch "$1_Expected.txt" fi if [ ! -f "$1_Result.txt" ]; then echo "Creating $1_Result.txt" touch "$1_Result.txt" fi } function test() { # Check if the files exist and if not, create them files "$1" "$(pwd)"/../build/Assignment1 < "$1.txt" > "$1_Result.txt" if diff -u "$1_Result.txt" "$1_Expected.txt"; then echo "$1 test passed" else echo "$1 test failed" fi } test "findAndReplace" test "add" test "delete" test "pdf1" test "pdf2" test "exit" test "deleteEmpty"