Skip to content

Commit

Permalink
lab 4 update
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-anastasiia committed Nov 25, 2024
1 parent 85dcec1 commit 278448a
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions LibraryCPPTemplate/Tests/graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,36 +112,36 @@ int main() {
}
}
////////////Edge removal check//////////////////////////////////////////
//graph.remove_Edge(0, 1);
//std::cout << "After deletion:" << std::endl;
//for (size_t i = 0; i < graph.get_VertexAmount(); ++i) {
// std::cout << "Vertex " << i << ": ";
// Graph<int>::Iterator it = graph.get_Iterator(i);
// while (it.hasNext()) {
// std::cout << it.next() << " ";
// }
// std::cout << std::endl;
//}

//bool edgeExists = false;
//Graph<int>::Iterator it = graph.get_Iterator(0);
//while (it.hasNext()) {
// if (it.next() == 1) {
// edgeExists = true;
// break;
// }
//}

//if (!edgeExists) {
// std::cout << "Test passed: Edge (0, 1) was successfully removed." << std::endl;
//}
//else {
// std::cout << "Test failed: Edge (0, 1) still exists!" << std::endl;
// return 1;
//}
//
graph.remove_Edge(0, 1);
std::cout << "After deletion:" << std::endl;
for (size_t i = 0; i < graph.get_VertexAmount(); ++i) {
std::cout << "Vertex " << i << ": ";
Graph<int>::Iterator it = graph.get_Iterator(i);
while (it.hasNext()) {
std::cout << it.next() << " ";
}
std::cout << std::endl;
}

bool edgeExists = false;
Graph<int>::Iterator it = graph.get_Iterator(0);
while (it.hasNext()) {
if (it.next() == 1) {
edgeExists = true;
break;
}
}

if (!edgeExists) {
std::cout << "Test passed: Edge (0, 1) was successfully removed." << std::endl;
}
else {
std::cout << "Test failed: Edge (0, 1) still exists!" << std::endl;
return 1;
}

//////////Vertex removal check//////////////////////////////////////////
graph.add_Edge(2, 3, 5);
/*graph.add_Edge(2, 3, 5);
graph.add_Edge(0, 4, 1);
int index1 = 3;
Expand All @@ -153,7 +153,7 @@ int main() {
}
else {
std::cout << "valid vertex removal" << std::endl;
}
}*/


return 0;
Expand Down

0 comments on commit 278448a

Please sign in to comment.