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

Side by Side Diff: test/unittests/counters-unittest.cc

Issue 1128043002: Fix more -Werror=sign-compare bugs with GCC 4.9.2 (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Rebase and fix new sign comparison errors Created 5 years, 7 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
« no previous file with comments | « src/heap/identity-map.cc ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project 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 <vector> 5 #include <vector>
6 6
7 #include "src/counters.h" 7 #include "src/counters.h"
8 #include "src/handles-inl.h" 8 #include "src/handles-inl.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 MockHistogram mock_; 42 MockHistogram mock_;
43 }; 43 };
44 44
45 } // namespace 45 } // namespace
46 46
47 47
48 TEST_F(AggregatedMemoryHistogramTest, OneSample1) { 48 TEST_F(AggregatedMemoryHistogramTest, OneSample1) {
49 FLAG_histogram_interval = 10; 49 FLAG_histogram_interval = 10;
50 AddSample(10, 1000); 50 AddSample(10, 1000);
51 AddSample(20, 1000); 51 AddSample(20, 1000);
52 EXPECT_EQ(1, samples()->size()); 52 EXPECT_EQ(1U, samples()->size());
53 EXPECT_EQ(1000, (*samples())[0]); 53 EXPECT_EQ(1000, (*samples())[0]);
54 } 54 }
55 55
56 56
57 TEST_F(AggregatedMemoryHistogramTest, OneSample2) { 57 TEST_F(AggregatedMemoryHistogramTest, OneSample2) {
58 FLAG_histogram_interval = 10; 58 FLAG_histogram_interval = 10;
59 AddSample(10, 500); 59 AddSample(10, 500);
60 AddSample(20, 1000); 60 AddSample(20, 1000);
61 EXPECT_EQ(1, samples()->size()); 61 EXPECT_EQ(1U, samples()->size());
62 EXPECT_EQ(750, (*samples())[0]); 62 EXPECT_EQ(750, (*samples())[0]);
63 } 63 }
64 64
65 65
66 TEST_F(AggregatedMemoryHistogramTest, OneSample3) { 66 TEST_F(AggregatedMemoryHistogramTest, OneSample3) {
67 FLAG_histogram_interval = 10; 67 FLAG_histogram_interval = 10;
68 AddSample(10, 500); 68 AddSample(10, 500);
69 AddSample(15, 500); 69 AddSample(15, 500);
70 AddSample(15, 1000); 70 AddSample(15, 1000);
71 AddSample(20, 1000); 71 AddSample(20, 1000);
72 EXPECT_EQ(1, samples()->size()); 72 EXPECT_EQ(1U, samples()->size());
73 EXPECT_EQ(750, (*samples())[0]); 73 EXPECT_EQ(750, (*samples())[0]);
74 } 74 }
75 75
76 76
77 TEST_F(AggregatedMemoryHistogramTest, OneSample4) { 77 TEST_F(AggregatedMemoryHistogramTest, OneSample4) {
78 FLAG_histogram_interval = 10; 78 FLAG_histogram_interval = 10;
79 AddSample(10, 500); 79 AddSample(10, 500);
80 AddSample(15, 750); 80 AddSample(15, 750);
81 AddSample(20, 1000); 81 AddSample(20, 1000);
82 EXPECT_EQ(1, samples()->size()); 82 EXPECT_EQ(1U, samples()->size());
83 EXPECT_EQ(750, (*samples())[0]); 83 EXPECT_EQ(750, (*samples())[0]);
84 } 84 }
85 85
86 86
87 TEST_F(AggregatedMemoryHistogramTest, TwoSamples1) { 87 TEST_F(AggregatedMemoryHistogramTest, TwoSamples1) {
88 FLAG_histogram_interval = 10; 88 FLAG_histogram_interval = 10;
89 AddSample(10, 1000); 89 AddSample(10, 1000);
90 AddSample(30, 1000); 90 AddSample(30, 1000);
91 EXPECT_EQ(2, samples()->size()); 91 EXPECT_EQ(2U, samples()->size());
92 EXPECT_EQ(1000, (*samples())[0]); 92 EXPECT_EQ(1000, (*samples())[0]);
93 EXPECT_EQ(1000, (*samples())[1]); 93 EXPECT_EQ(1000, (*samples())[1]);
94 } 94 }
95 95
96 96
97 TEST_F(AggregatedMemoryHistogramTest, TwoSamples2) { 97 TEST_F(AggregatedMemoryHistogramTest, TwoSamples2) {
98 FLAG_histogram_interval = 10; 98 FLAG_histogram_interval = 10;
99 AddSample(10, 1000); 99 AddSample(10, 1000);
100 AddSample(20, 1000); 100 AddSample(20, 1000);
101 AddSample(30, 1000); 101 AddSample(30, 1000);
102 EXPECT_EQ(2, samples()->size()); 102 EXPECT_EQ(2U, samples()->size());
103 EXPECT_EQ(1000, (*samples())[0]); 103 EXPECT_EQ(1000, (*samples())[0]);
104 EXPECT_EQ(1000, (*samples())[1]); 104 EXPECT_EQ(1000, (*samples())[1]);
105 } 105 }
106 106
107 107
108 TEST_F(AggregatedMemoryHistogramTest, TwoSamples3) { 108 TEST_F(AggregatedMemoryHistogramTest, TwoSamples3) {
109 FLAG_histogram_interval = 10; 109 FLAG_histogram_interval = 10;
110 AddSample(10, 1000); 110 AddSample(10, 1000);
111 AddSample(20, 1000); 111 AddSample(20, 1000);
112 AddSample(20, 500); 112 AddSample(20, 500);
113 AddSample(30, 500); 113 AddSample(30, 500);
114 EXPECT_EQ(2, samples()->size()); 114 EXPECT_EQ(2U, samples()->size());
115 EXPECT_EQ(1000, (*samples())[0]); 115 EXPECT_EQ(1000, (*samples())[0]);
116 EXPECT_EQ(500, (*samples())[1]); 116 EXPECT_EQ(500, (*samples())[1]);
117 } 117 }
118 118
119 119
120 TEST_F(AggregatedMemoryHistogramTest, TwoSamples4) { 120 TEST_F(AggregatedMemoryHistogramTest, TwoSamples4) {
121 FLAG_histogram_interval = 10; 121 FLAG_histogram_interval = 10;
122 AddSample(10, 1000); 122 AddSample(10, 1000);
123 AddSample(30, 0); 123 AddSample(30, 0);
124 EXPECT_EQ(2, samples()->size()); 124 EXPECT_EQ(2U, samples()->size());
125 EXPECT_EQ(750, (*samples())[0]); 125 EXPECT_EQ(750, (*samples())[0]);
126 EXPECT_EQ(250, (*samples())[1]); 126 EXPECT_EQ(250, (*samples())[1]);
127 } 127 }
128 128
129 129
130 TEST_F(AggregatedMemoryHistogramTest, TwoSamples5) { 130 TEST_F(AggregatedMemoryHistogramTest, TwoSamples5) {
131 FLAG_histogram_interval = 10; 131 FLAG_histogram_interval = 10;
132 AddSample(10, 0); 132 AddSample(10, 0);
133 AddSample(30, 1000); 133 AddSample(30, 1000);
134 EXPECT_EQ(2, samples()->size()); 134 EXPECT_EQ(2U, samples()->size());
135 EXPECT_EQ(250, (*samples())[0]); 135 EXPECT_EQ(250, (*samples())[0]);
136 EXPECT_EQ(750, (*samples())[1]); 136 EXPECT_EQ(750, (*samples())[1]);
137 } 137 }
138 138
139 139
140 TEST_F(AggregatedMemoryHistogramTest, TwoSamples6) { 140 TEST_F(AggregatedMemoryHistogramTest, TwoSamples6) {
141 FLAG_histogram_interval = 10; 141 FLAG_histogram_interval = 10;
142 AddSample(10, 0); 142 AddSample(10, 0);
143 AddSample(15, 1000); 143 AddSample(15, 1000);
144 AddSample(30, 1000); 144 AddSample(30, 1000);
145 EXPECT_EQ(2, samples()->size()); 145 EXPECT_EQ(2U, samples()->size());
146 EXPECT_EQ((500 + 1000) / 2, (*samples())[0]); 146 EXPECT_EQ((500 + 1000) / 2, (*samples())[0]);
147 EXPECT_EQ(1000, (*samples())[1]); 147 EXPECT_EQ(1000, (*samples())[1]);
148 } 148 }
149 149
150 150
151 TEST_F(AggregatedMemoryHistogramTest, TwoSamples7) { 151 TEST_F(AggregatedMemoryHistogramTest, TwoSamples7) {
152 FLAG_histogram_interval = 10; 152 FLAG_histogram_interval = 10;
153 AddSample(10, 0); 153 AddSample(10, 0);
154 AddSample(15, 1000); 154 AddSample(15, 1000);
155 AddSample(25, 0); 155 AddSample(25, 0);
156 AddSample(30, 1000); 156 AddSample(30, 1000);
157 EXPECT_EQ(2, samples()->size()); 157 EXPECT_EQ(2U, samples()->size());
158 EXPECT_EQ((500 + 750) / 2, (*samples())[0]); 158 EXPECT_EQ((500 + 750) / 2, (*samples())[0]);
159 EXPECT_EQ((250 + 500) / 2, (*samples())[1]); 159 EXPECT_EQ((250 + 500) / 2, (*samples())[1]);
160 } 160 }
161 161
162 162
163 TEST_F(AggregatedMemoryHistogramTest, TwoSamples8) { 163 TEST_F(AggregatedMemoryHistogramTest, TwoSamples8) {
164 FLAG_histogram_interval = 10; 164 FLAG_histogram_interval = 10;
165 AddSample(10, 1000); 165 AddSample(10, 1000);
166 AddSample(15, 0); 166 AddSample(15, 0);
167 AddSample(25, 1000); 167 AddSample(25, 1000);
168 AddSample(30, 0); 168 AddSample(30, 0);
169 EXPECT_EQ(2, samples()->size()); 169 EXPECT_EQ(2U, samples()->size());
170 EXPECT_EQ((500 + 250) / 2, (*samples())[0]); 170 EXPECT_EQ((500 + 250) / 2, (*samples())[0]);
171 EXPECT_EQ((750 + 500) / 2, (*samples())[1]); 171 EXPECT_EQ((750 + 500) / 2, (*samples())[1]);
172 } 172 }
173 173
174 174
175 TEST_F(AggregatedMemoryHistogramTest, ManySamples1) { 175 TEST_F(AggregatedMemoryHistogramTest, ManySamples1) {
176 FLAG_histogram_interval = 10; 176 FLAG_histogram_interval = 10;
177 const int kMaxSamples = 1000; 177 const int kMaxSamples = 1000;
178 AddSample(0, 0); 178 AddSample(0, 0);
179 AddSample(10 * kMaxSamples, 10 * kMaxSamples); 179 AddSample(10 * kMaxSamples, 10 * kMaxSamples);
180 EXPECT_EQ(kMaxSamples, samples()->size()); 180 EXPECT_EQ(static_cast<unsigned>(kMaxSamples), samples()->size());
181 for (int i = 0; i < kMaxSamples; i++) { 181 for (int i = 0; i < kMaxSamples; i++) {
182 EXPECT_EQ(i * 10 + 5, (*samples())[i]); 182 EXPECT_EQ(i * 10 + 5, (*samples())[i]);
183 } 183 }
184 } 184 }
185 185
186 186
187 TEST_F(AggregatedMemoryHistogramTest, ManySamples2) { 187 TEST_F(AggregatedMemoryHistogramTest, ManySamples2) {
188 FLAG_histogram_interval = 10; 188 FLAG_histogram_interval = 10;
189 const int kMaxSamples = 1000; 189 const int kMaxSamples = 1000;
190 AddSample(0, 0); 190 AddSample(0, 0);
191 AddSample(10 * (2 * kMaxSamples), 10 * (2 * kMaxSamples)); 191 AddSample(10 * (2 * kMaxSamples), 10 * (2 * kMaxSamples));
192 EXPECT_EQ(kMaxSamples, samples()->size()); 192 EXPECT_EQ(static_cast<unsigned>(kMaxSamples), samples()->size());
193 for (int i = 0; i < kMaxSamples; i++) { 193 for (int i = 0; i < kMaxSamples; i++) {
194 EXPECT_EQ(i * 10 + 5, (*samples())[i]); 194 EXPECT_EQ(i * 10 + 5, (*samples())[i]);
195 } 195 }
196 } 196 }
197 197
198 198
199 } // namespace internal 199 } // namespace internal
200 } // namespace v8 200 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/identity-map.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698