forked from nus-cs2113-AY2223S2/Circus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
I'm a Duck | ||
Quack Quack | ||
I'm a parrot | ||
Polly wants a cracker | ||
Adding item value: 25 | ||
Ignoring low value item: 1 | ||
Adding item value: 33 | ||
Total value of equipments 58 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@ECHO OFF | ||
|
||
REM create bin directory if it doesn't exist | ||
if not exist ..\bin mkdir ..\bin | ||
|
||
REM delete output from previous run | ||
del ACTUAL.TXT | ||
|
||
REM compile the code into the bin folder | ||
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\*.java | ||
IF ERRORLEVEL 1 ( | ||
echo ********** BUILD FAILURE ********** | ||
exit /b 1 | ||
) | ||
REM no error here, errorlevel == 0 | ||
|
||
REM run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT | ||
java -classpath ..\bin Circus > ACTUAL.TXT | ||
|
||
REM compare the output to the expected output | ||
FC ACTUAL.TXT EXPECTED.TXT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
|
||
# create bin directory if it doesn't exist | ||
if [ ! -d "../bin" ] | ||
then | ||
mkdir ../bin | ||
fi | ||
|
||
# delete output from previous run | ||
if [ -e "./ACTUAL.TXT" ] | ||
then | ||
rm ACTUAL.TXT | ||
fi | ||
|
||
# compile the code into the bin folder, terminates if error occurred | ||
if ! javac -cp ../src -Xlint:none -d ../bin ../src/main/java/*.java | ||
then | ||
echo "********** BUILD FAILURE **********" | ||
exit 1 | ||
fi | ||
|
||
# run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT | ||
java -classpath ../bin Circus > ACTUAL.TXT | ||
|
||
# compare the output to the expected output | ||
diff ACTUAL.TXT EXPECTED.TXT | ||
if [ $? -eq 0 ] | ||
then | ||
echo "Test result: PASSED" | ||
exit 0 | ||
else | ||
echo "Test result: FAILED" | ||
exit 1 | ||
fi |