Skip to content

Commit

Permalink
Updated makefile - printAll appears to be working - still needs furth…
Browse files Browse the repository at this point in the history
…er testing
  • Loading branch information
elijahbigk77 committed Apr 18, 2022
1 parent df9e4eb commit d8ba9da
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ 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-requirement1: project5
./project5 < test-data/requirement1.in > test-data/project4.out
diff test-data/project4.out test-data/requirement1.out
./project5 < test-data/requirement1.in > test-data/project5.out
diff test-data/project5.out test-data/requirement1.out
Binary file modified project5
Binary file not shown.
6 changes: 3 additions & 3 deletions province.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,22 @@ void Province::printAll(int start, std::ostream & output) {
queue <int> toVisit; // use queue to keep track of which town to visit next
toVisit.push(start);
scheduled[start] = true;
output << "The input data is:" << endl << endl;
output << "The input data is :" << endl << endl;

// Visit every town in the queue
while (!toVisit.empty()) {
int current = toVisit.front();
toVisit.pop();

output << " ";
output << " ";
output << _towns[current]._name << endl;

// Add current town's(vertex's) unscheduled neighbors to the queue
for (Town::RoadList::iterator neighbor = _towns[current]._roads.begin();
neighbor != _towns[current]._roads.end(); neighbor++) {
std::string neighborName = _towns[neighbor->_head]._name;

output << " ";
output << " ";
output << neighborName << " " << neighbor->_length << " mi";

// if the type is bridge, then add to output
Expand Down
39 changes: 0 additions & 39 deletions test-data/project4.out

This file was deleted.

39 changes: 39 additions & 0 deletions test-data/project5.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

------------------------------------------------
---------------- New DataSet: ------------------
------------------------------------------------

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



------------------------------------------------
---------------- New DataSet: ------------------
------------------------------------------------

The input data is :

Wenham
Hamilton 1 mi
Hamilton
Wenham 1 mi


0 comments on commit d8ba9da

Please sign in to comment.