Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(850)

Unified Diff: src/platform/update_engine/graph_utils_unittest.cc

Issue 578009: AU: Some graph types and a couple utility functions (Closed)
Patch Set: Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/update_engine/graph_utils_unittest.cc
diff --git a/src/platform/update_engine/graph_utils_unittest.cc b/src/platform/update_engine/graph_utils_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a48efdc8fe427512ed7618b1fb9332140831273f
--- /dev/null
+++ b/src/platform/update_engine/graph_utils_unittest.cc
@@ -0,0 +1,36 @@
+// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <utility>
+#include <gtest/gtest.h>
+#include "update_engine/graph_utils.h"
+
+using std::make_pair;
+
+namespace chromeos_update_engine {
+
+class GraphUtilsTest : public ::testing::Test {};
+
+TEST(GraphUtilsTest, SimpleTest) {
+ Graph graph(2);
+
+ 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
+ EXPECT_EQ(0, graph[0].out_edges[1].extents.size());
+ AppendBlockToExtents(0, &graph[0].out_edges[1].extents);
+ EXPECT_EQ(1, graph[0].out_edges[1].extents.size());
+ AppendBlockToExtents(1, &graph[0].out_edges[1].extents);
+ AppendBlockToExtents(2, &graph[0].out_edges[1].extents);
+ EXPECT_EQ(1, graph[0].out_edges[1].extents.size());
+ AppendBlockToExtents(4, &graph[0].out_edges[1].extents);
+
+ EXPECT_EQ(2, graph[0].out_edges[1].extents.size());
+ EXPECT_EQ(0, graph[0].out_edges[1].extents[0].start_block());
+ EXPECT_EQ(3, graph[0].out_edges[1].extents[0].num_blocks());
+ EXPECT_EQ(4, graph[0].out_edges[1].extents[1].start_block());
+ EXPECT_EQ(1, graph[0].out_edges[1].extents[1].num_blocks());
+
+ EXPECT_EQ(4, EdgeWeight(graph, make_pair(0, 1)));
+}
+
+} // namespace chromeos_update_engine

Powered by Google App Engine
This is Rietveld 408576698