From 278448a33ecee38d7db13ee394d24d1746c0795f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B0=D1=81=D1=82=D0=B0=D1=81=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=A0=D1=8B=D0=B1=D0=BA=D0=B8=D0=BD=D0=B0?= Date: Tue, 26 Nov 2024 00:17:58 +0300 Subject: [PATCH] lab 4 update --- LibraryCPPTemplate/Tests/graph.cpp | 60 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/LibraryCPPTemplate/Tests/graph.cpp b/LibraryCPPTemplate/Tests/graph.cpp index 5467d720bc..1b77819a50 100644 --- a/LibraryCPPTemplate/Tests/graph.cpp +++ b/LibraryCPPTemplate/Tests/graph.cpp @@ -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::Iterator it = graph.get_Iterator(i); - // while (it.hasNext()) { - // std::cout << it.next() << " "; - // } - // std::cout << std::endl; - //} - - //bool edgeExists = false; - //Graph::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::Iterator it = graph.get_Iterator(i); + while (it.hasNext()) { + std::cout << it.next() << " "; + } + std::cout << std::endl; + } + + bool edgeExists = false; + Graph::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; @@ -153,7 +153,7 @@ int main() { } else { std::cout << "valid vertex removal" << std::endl; - } + }*/ return 0;