Skip to content

Commit

Permalink
Test for elijah. Run 'make test-requirement1' in the terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
jakedcolbert committed Apr 18, 2022
1 parent 7cec83d commit 23ca3b9
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ project5: project5.cc province.cc province.h

# test the code against an expected output file
# this test should grow into a spaceship and end with blinkers
test-nowhere:
./project5 < test-files/t01-nowhere.in > tests/project4.out
diff test-files/project4.out test-files/t01-nowhere.out > test.diff
wc -l test.diff
test-requirement1:
./project5 < test-data/requirement1.in > test-data/project4.out
diff test-data/project4.out test-data/requirement1.out
Binary file added project5
Binary file not shown.
4 changes: 4 additions & 0 deletions test-data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ code works. Remember: **if you haven't tested it, it doesn't work.**
* .out: expected output for matching input. Please match the format of each line exactly, by comparing your output to this with the "diff" command. Try to make the output line order match, too. But if you are confident your code is producing correct output in a different valid order, that is acceptable.

There is also a .jpg image of a diagram of some input.

Elijah:

To run a test from the make file, execute `make <test name>` where test name is the target name of the test. At the moment you read this, the only availible test target in the makefile is a test named "test-requirement1". To run this test target, execute `make test-requirement1` in the terminal. This will run the code with an imput file and compares the output of the test with the expected output using the diff unix command.
18 changes: 18 additions & 0 deletions test-data/project4.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
This is the name: 0x600000610008
This is the name: 0x600000610038
This is the name: 0x600000610068
This is the name: 0x600000610098
This is the name: 0x6000006100c8
The input data is:

Salem
This is the name: 0x600001110008
This is the name: 0x600001110038
The input data is:

Wenham
This is the name: 0x600001110078
This is the name: 0x6000011100a8
The input data is:


16 changes: 16 additions & 0 deletions test-data/requirement1.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
5 6
Salem
Wenham
Beverly
Danvers
Lynn
Beverly Danvers N 2.9
Beverly Salem B 2.4
Beverly Wenham N 5.2
Danvers Wenham N 4.2
Danvers Salem B 3.7
Lynn Salem N 4.9
2 1
Wenham
Hamilton
Wenham Hamilton N 1
19 changes: 19 additions & 0 deletions test-data/requirement1.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The input data is:

Salem
Beverly 2.4 mi via bridge
Danvers 3.7 mi via bridge
Lynn 4.9 mi
Beverly
Danvers 2.9 mi
Salem 2.4 mi via bridge
Wenham 5.2 mi
Danvers
Beverly 2.9 mi
Wenham 4.2 mi
Salem 3.7 mi via bridge
Lynn
Salem 4.9 mi
Wenham
Beverly 5.2 mi
Danvers 4.2 mi

0 comments on commit 23ca3b9

Please sign in to comment.