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

Side by Side Diff: net/base/priority_queue_unittest.cc

Issue 9924023: Readability review (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« net/base/priority_queue.h ('K') | « net/base/priority_queue.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 "net/base/priority_queue.h" 5 #include "net/base/priority_queue.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace net { 8 namespace net {
9 9
10 namespace { 10 namespace {
(...skipping 29 matching lines...) Expand all
40 for (size_t i = 0; i < kNumElements; ++i) { 40 for (size_t i = 0; i < kNumElements; ++i) {
41 EXPECT_EQ(kPriorities[i], pointers[i].priority()); 41 EXPECT_EQ(kPriorities[i], pointers[i].priority());
42 EXPECT_EQ(static_cast<int>(i), pointers[i].value()); 42 EXPECT_EQ(static_cast<int>(i), pointers[i].value());
43 } 43 }
44 44
45 queue.Clear(); 45 queue.Clear();
46 CheckEmpty(&queue); 46 CheckEmpty(&queue);
47 } 47 }
48 48
49 TEST(PriorityQueueTest, FirstMinOrder) { 49 TEST(PriorityQueueTest, FirstMinOrder) {
50 PriorityQueue<int> queue(kNumPriorities); 50 PriorityQueue<int> queue(kNumPriorities);
stevez 2012/04/11 16:13:58 Why not factor out a fixture here with this common
szym 2012/05/17 19:52:01 Done.
51 PriorityQueue<int>::Pointer pointers[kNumElements]; 51 PriorityQueue<int>::Pointer pointers[kNumElements];
52 52
53 for (size_t i = 0; i < kNumElements; ++i) { 53 for (size_t i = 0; i < kNumElements; ++i) {
54 pointers[i] = queue.Insert(static_cast<int>(i), kPriorities[i]); 54 pointers[i] = queue.Insert(static_cast<int>(i), kPriorities[i]);
55 } 55 }
56 56
57 for (size_t i = 0; i < kNumElements; ++i) { 57 for (size_t i = 0; i < kNumElements; ++i) {
58 EXPECT_EQ(kNumElements - i, queue.size()); 58 EXPECT_EQ(kNumElements - i, queue.size());
59 // Also check Equals. 59 // Also check Equals.
60 EXPECT_TRUE(queue.FirstMin().Equals(pointers[kFirstMinOrder[i]])); 60 EXPECT_TRUE(queue.FirstMin().Equals(pointers[kFirstMinOrder[i]]));
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 EXPECT_EQ(expected_order[i], queue.FirstMin().value()); 123 EXPECT_EQ(expected_order[i], queue.FirstMin().value());
124 queue.Erase(queue.FirstMin()); 124 queue.Erase(queue.FirstMin());
125 } 125 }
126 CheckEmpty(&queue); 126 CheckEmpty(&queue);
127 } 127 }
128 128
129 } // namespace 129 } // namespace
130 130
131 } // namespace net 131 } // namespace net
132 132
133
OLDNEW
« net/base/priority_queue.h ('K') | « net/base/priority_queue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698