Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <utility> | |
| 6 #include <gtest/gtest.h> | |
| 7 #include "update_engine/graph_utils.h" | |
| 8 | |
| 9 using std::make_pair; | |
| 10 | |
| 11 namespace chromeos_update_engine { | |
| 12 | |
| 13 class GraphUtilsTest : public ::testing::Test {}; | |
| 14 | |
| 15 TEST(GraphUtilsTest, SimpleTest) { | |
| 16 Graph graph(2); | |
| 17 | |
| 18 graph[0].out_edges.insert(make_pair(1, EdgeProperties())); | |
|
Daniel Erat
2010/02/05 17:55:19
this would all be a bit more readable if you just
adlr
2010/02/22 23:27:31
Did a little cleanup. Created a reference to avoid
| |
| 19 EXPECT_EQ(0, graph[0].out_edges[1].extents.size()); | |
| 20 AppendBlockToExtents(0, &graph[0].out_edges[1].extents); | |
| 21 EXPECT_EQ(1, graph[0].out_edges[1].extents.size()); | |
| 22 AppendBlockToExtents(1, &graph[0].out_edges[1].extents); | |
| 23 AppendBlockToExtents(2, &graph[0].out_edges[1].extents); | |
| 24 EXPECT_EQ(1, graph[0].out_edges[1].extents.size()); | |
| 25 AppendBlockToExtents(4, &graph[0].out_edges[1].extents); | |
| 26 | |
| 27 EXPECT_EQ(2, graph[0].out_edges[1].extents.size()); | |
| 28 EXPECT_EQ(0, graph[0].out_edges[1].extents[0].start_block()); | |
| 29 EXPECT_EQ(3, graph[0].out_edges[1].extents[0].num_blocks()); | |
| 30 EXPECT_EQ(4, graph[0].out_edges[1].extents[1].start_block()); | |
| 31 EXPECT_EQ(1, graph[0].out_edges[1].extents[1].num_blocks()); | |
| 32 | |
| 33 EXPECT_EQ(4, EdgeWeight(graph, make_pair(0, 1))); | |
| 34 } | |
| 35 | |
| 36 } // namespace chromeos_update_engine | |
| OLD | NEW |