TEST_F(UndirectedGraphFixture, canBeCopied) { g_.addEdge(0, 1, 7); g_.addEdge(3, 2, 123); UndirectedGraph copy { g_ }; ASSERT_EQ(g_.getWeightOfEdge(0, 1), copy.getWeightOfEdge(0, 1)); ASSERT_EQ(g_.getWeightOfEdge(2, 3), copy.getWeightOfEdge(2, 3)); ASSERT_EQ(g_.getNumberOfEdges(), copy.getNumberOfEdges()); ASSERT_EQ(g_.getNumberOfVertices(), copy.getNumberOfVertices()); ASSERT_EQ(g_.getSumOfWeights(), copy.getSumOfWeights()); }
TEST_F(UndirectedGraphFixture, canBeMoved) { g_.addEdge(0, 1, 7); g_.addEdge(3, 2, 123); UndirectedGraph moved { std::move(g_) }; ASSERT_EQ(7, moved.getWeightOfEdge(0, 1)); ASSERT_EQ(123, moved.getWeightOfEdge(2, 3)); ASSERT_EQ(2, moved.getNumberOfEdges()); ASSERT_EQ(5, moved.getNumberOfVertices()); ASSERT_EQ(130, moved.getSumOfWeights()); ASSERT_FALSE(g_.edgeExists(0, 1)); ASSERT_FALSE(g_.edgeExists(1, 0)); ASSERT_FALSE(g_.edgeExists(2, 3)); ASSERT_FALSE(g_.edgeExists(3, 2)); ASSERT_EQ(0, g_.getNumberOfEdges()); ASSERT_EQ(0, g_.getNumberOfVertices()); ASSERT_EQ(0, g_.getSumOfWeights()); }