#!/bin/sh # tests -- test shell script for testing the road network (must be executable) # Author: Douglas Jones # Version: 2019-03-1 echo echo "test args<1, it ought to complain 'missing argument' and fail" java RoadNetwork read -p "Press Enter to continue" echo echo "test args>1, it ought to complain 'extra arguments' and not fail" echo "test 'cant open file' exception condition and fail" java RoadNetwork "nonsense file name" "random stuff" "more stuff" read -p "Press Enter to continue" echo echo "test args=1, with an empty file it can open, no output, success" touch testdata java RoadNetwork testdata rm -f testdata read -p "Press Enter to continue" echo echo "test args=1r, should complain about an invalid command, success?" echo "nonsense" > testdata java RoadNetwork testdata rm -f testdata read -p "Press Enter to continue" echo echo "test args=1, with an file with an incomplete command, success" echo "road" > testdata java RoadNetwork testdata rm -f testdata read -p "Press Enter to continue" echo echo "test args=1, with an file with no junk after the command, success" echo "stoplight z" > testdata java RoadNetwork testdata rm -f testdata read -p "Press Enter to continue" echo echo "test args=1, with an file with comment after the command, success" echo "stoplight z -- comment" > testdata java RoadNetwork testdata rm -f testdata read -p "Press Enter to continue" echo echo "test args=1, with an file with junk after the command, success" cat > testdata << EOF stoplight z junk road z z 2.5 more junk EOF java RoadNetwork testdata rm -f testdata read -p "Press Enter to continue"