Line data Source code
1 : /** 2 : * Unit tests for Graph related methods 3 : */ 4 : #include <gtest/gtest.h> 5 : #include <iostream> 6 : #include <openGPMP/disct/graphs.hpp> 7 : 8 : namespace { 9 : 10 4 : TEST(GraphTest, AddEdge) { 11 1 : gpmp::Graph graph(4); 12 : 13 1 : graph.add_edge(0, 1, 10); 14 1 : graph.add_edge(1, 2, 20); 15 1 : graph.add_edge(2, 3, 30); 16 : 17 : // check if the adjacency list has been updated correctly 18 1 : ASSERT_EQ(graph.adj_list[0].size(), 1); 19 1 : ASSERT_EQ(graph.adj_list[1].size(), 2); 20 1 : ASSERT_EQ(graph.adj_list[2].size(), 2); 21 1 : } 22 : } // namespace