| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include <gtest/gtest.h> | 9 #include <gtest/gtest.h> |
| 10 #include "chromeos/obsolete_logging.h" | 10 #include "chromeos/obsolete_logging.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_c, n_d)) || | 65 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_c, n_d)) || |
| 66 utils::SetContainsKey(broken_edges, make_pair(n_d, n_e)) || | 66 utils::SetContainsKey(broken_edges, make_pair(n_d, n_e)) || |
| 67 utils::SetContainsKey(broken_edges, make_pair(n_e, n_c))); | 67 utils::SetContainsKey(broken_edges, make_pair(n_e, n_c))); |
| 68 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_g, n_h)) || | 68 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_g, n_h)) || |
| 69 utils::SetContainsKey(broken_edges, make_pair(n_h, n_g))); | 69 utils::SetContainsKey(broken_edges, make_pair(n_h, n_g))); |
| 70 EXPECT_EQ(3, broken_edges.size()); | 70 EXPECT_EQ(3, broken_edges.size()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 namespace { | 73 namespace { |
| 74 pair<Vertex::Index, EdgeProperties> EdgeWithWeight(Vertex::Index dest, | 74 pair<Vertex::Index, EdgeProperties> EdgeWithWeight(Vertex::Index dest, |
| 75 uint64 weight) { | 75 uint64_t weight) { |
| 76 EdgeProperties props; | 76 EdgeProperties props; |
| 77 props.extents.resize(1); | 77 props.extents.resize(1); |
| 78 props.extents[0].set_num_blocks(weight); | 78 props.extents[0].set_num_blocks(weight); |
| 79 return make_pair(dest, props); | 79 return make_pair(dest, props); |
| 80 } | 80 } |
| 81 } // namespace {} | 81 } // namespace {} |
| 82 | 82 |
| 83 TEST(CycleBreakerTest, WeightTest) { | 83 TEST(CycleBreakerTest, WeightTest) { |
| 84 int counter = 0; | 84 int counter = 0; |
| 85 const Vertex::Index n_a = counter++; | 85 const Vertex::Index n_a = counter++; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 // These are required to be broken: | 123 // These are required to be broken: |
| 124 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_b, n_a))); | 124 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_b, n_a))); |
| 125 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_b, n_c))); | 125 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_b, n_c))); |
| 126 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_d, n_e))); | 126 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_d, n_e))); |
| 127 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_f, n_g))); | 127 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_f, n_g))); |
| 128 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_h, n_i))); | 128 EXPECT_TRUE(utils::SetContainsKey(broken_edges, make_pair(n_h, n_i))); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace chromeos_update_engine | 131 } // namespace chromeos_update_engine |
| OLD | NEW |