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

Side by Side Diff: content/browser/gpu/gpu_control_list_number_info_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/gpu/gpu_control_list.h" 5 #include "content/browser/gpu/gpu_control_list.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace content { 8 namespace content {
9 9
10 class NumberInfoTest : public testing::Test { 10 class NumberInfoTest : public testing::Test {
(...skipping 28 matching lines...) Expand all
39 39
40 const std::string value[] = { 40 const std::string value[] = {
41 "1.0E12", 41 "1.0E12",
42 "1.0e12", 42 "1.0e12",
43 "2013", 43 "2013",
44 "1.0e-12", 44 "1.0e-12",
45 "2.1400", 45 "2.1400",
46 "-2.14", 46 "-2.14",
47 }; 47 };
48 for (size_t i = 0; i < arraysize(value); ++i) { 48 for (size_t i = 0; i < arraysize(value); ++i) {
49 FloatInfo info("=", value[i], ""); 49 FloatInfo info("=", value[i], std::string());
50 EXPECT_TRUE(info.IsValid()); 50 EXPECT_TRUE(info.IsValid());
51 } 51 }
52 } 52 }
53 53
54 TEST_F(NumberInfoTest, InvalidFloatInfo) { 54 TEST_F(NumberInfoTest, InvalidFloatInfo) {
55 const std::string op[] = { 55 const std::string op[] = {
56 "=", 56 "=",
57 "<", 57 "<",
58 "<=", 58 "<=",
59 ">", 59 ">",
60 ">=", 60 ">=",
61 }; 61 };
62 for (size_t i = 0; i < arraysize(op); ++i) { 62 for (size_t i = 0; i < arraysize(op); ++i) {
63 FloatInfo info(op[i], "", ""); 63 FloatInfo info(op[i], std::string(), std::string());
64 EXPECT_FALSE(info.IsValid()); 64 EXPECT_FALSE(info.IsValid());
65 } 65 }
66 { 66 {
67 FloatInfo info("between", "3.14", ""); 67 FloatInfo info("between", "3.14", std::string());
68 EXPECT_FALSE(info.IsValid()); 68 EXPECT_FALSE(info.IsValid());
69 } 69 }
70 const std::string value[] = { 70 const std::string value[] = {
71 "1.0 E12", 71 "1.0 E12",
72 "1.0e 12", 72 "1.0e 12",
73 " 2013", 73 " 2013",
74 "2013 ", 74 "2013 ",
75 "- 2.14", 75 "- 2.14",
76 }; 76 };
77 for (size_t i = 0; i < arraysize(value); ++i) { 77 for (size_t i = 0; i < arraysize(value); ++i) {
78 FloatInfo info("=", value[i], ""); 78 FloatInfo info("=", value[i], std::string());
79 EXPECT_FALSE(info.IsValid()); 79 EXPECT_FALSE(info.IsValid());
80 } 80 }
81 } 81 }
82 82
83 TEST_F(NumberInfoTest, FloatComparison) { 83 TEST_F(NumberInfoTest, FloatComparison) {
84 { 84 {
85 FloatInfo info("=", "3.14", ""); 85 FloatInfo info("=", "3.14", std::string());
86 EXPECT_TRUE(info.Contains(3.14f)); 86 EXPECT_TRUE(info.Contains(3.14f));
87 EXPECT_TRUE(info.Contains(3.1400f)); 87 EXPECT_TRUE(info.Contains(3.1400f));
88 EXPECT_FALSE(info.Contains(3.1f)); 88 EXPECT_FALSE(info.Contains(3.1f));
89 EXPECT_FALSE(info.Contains(3)); 89 EXPECT_FALSE(info.Contains(3));
90 } 90 }
91 { 91 {
92 FloatInfo info(">", "3.14", ""); 92 FloatInfo info(">", "3.14", std::string());
93 EXPECT_FALSE(info.Contains(3.14f)); 93 EXPECT_FALSE(info.Contains(3.14f));
94 EXPECT_TRUE(info.Contains(3.141f)); 94 EXPECT_TRUE(info.Contains(3.141f));
95 EXPECT_FALSE(info.Contains(3.1f)); 95 EXPECT_FALSE(info.Contains(3.1f));
96 } 96 }
97 { 97 {
98 FloatInfo info("<=", "3.14", ""); 98 FloatInfo info("<=", "3.14", std::string());
99 EXPECT_TRUE(info.Contains(3.14f)); 99 EXPECT_TRUE(info.Contains(3.14f));
100 EXPECT_FALSE(info.Contains(3.141f)); 100 EXPECT_FALSE(info.Contains(3.141f));
101 EXPECT_TRUE(info.Contains(3.1f)); 101 EXPECT_TRUE(info.Contains(3.1f));
102 } 102 }
103 { 103 {
104 FloatInfo info("any", "", ""); 104 FloatInfo info("any", std::string(), std::string());
105 EXPECT_TRUE(info.Contains(3.14f)); 105 EXPECT_TRUE(info.Contains(3.14f));
106 } 106 }
107 { 107 {
108 FloatInfo info("between", "3.14", "5.4"); 108 FloatInfo info("between", "3.14", "5.4");
109 EXPECT_TRUE(info.Contains(3.14f)); 109 EXPECT_TRUE(info.Contains(3.14f));
110 EXPECT_TRUE(info.Contains(5.4f)); 110 EXPECT_TRUE(info.Contains(5.4f));
111 EXPECT_TRUE(info.Contains(4)); 111 EXPECT_TRUE(info.Contains(4));
112 EXPECT_FALSE(info.Contains(5.6f)); 112 EXPECT_FALSE(info.Contains(5.6f));
113 EXPECT_FALSE(info.Contains(3.12f)); 113 EXPECT_FALSE(info.Contains(3.12f));
114 } 114 }
(...skipping 18 matching lines...) Expand all
133 value2 = "9"; 133 value2 = "9";
134 IntInfo info(op[i], value1, value2); 134 IntInfo info(op[i], value1, value2);
135 EXPECT_TRUE(info.IsValid()); 135 EXPECT_TRUE(info.IsValid());
136 } 136 }
137 137
138 const std::string value[] = { 138 const std::string value[] = {
139 "12", 139 "12",
140 "-12", 140 "-12",
141 }; 141 };
142 for (size_t i = 0; i < arraysize(value); ++i) { 142 for (size_t i = 0; i < arraysize(value); ++i) {
143 IntInfo info("=", value[i], ""); 143 IntInfo info("=", value[i], std::string());
144 EXPECT_TRUE(info.IsValid()); 144 EXPECT_TRUE(info.IsValid());
145 } 145 }
146 } 146 }
147 147
148 TEST_F(NumberInfoTest, InvalidIntInfo) { 148 TEST_F(NumberInfoTest, InvalidIntInfo) {
149 const std::string op[] = { 149 const std::string op[] = {
150 "=", 150 "=",
151 "<", 151 "<",
152 "<=", 152 "<=",
153 ">", 153 ">",
154 ">=", 154 ">=",
155 }; 155 };
156 for (size_t i = 0; i < arraysize(op); ++i) { 156 for (size_t i = 0; i < arraysize(op); ++i) {
157 IntInfo info(op[i], "", ""); 157 IntInfo info(op[i], std::string(), std::string());
158 EXPECT_FALSE(info.IsValid()); 158 EXPECT_FALSE(info.IsValid());
159 } 159 }
160 { 160 {
161 IntInfo info("between", "3", ""); 161 IntInfo info("between", "3", std::string());
162 EXPECT_FALSE(info.IsValid()); 162 EXPECT_FALSE(info.IsValid());
163 } 163 }
164 const std::string value[] = { 164 const std::string value[] = {
165 " 12", 165 " 12",
166 "12 ", 166 "12 ",
167 "- 12", 167 "- 12",
168 " -12", 168 " -12",
169 "3.14" 169 "3.14"
170 }; 170 };
171 for (size_t i = 0; i < arraysize(value); ++i) { 171 for (size_t i = 0; i < arraysize(value); ++i) {
172 IntInfo info("=", value[i], ""); 172 IntInfo info("=", value[i], std::string());
173 EXPECT_FALSE(info.IsValid()); 173 EXPECT_FALSE(info.IsValid());
174 } 174 }
175 } 175 }
176 176
177 TEST_F(NumberInfoTest, IntComparison) { 177 TEST_F(NumberInfoTest, IntComparison) {
178 { 178 {
179 IntInfo info("=", "3", ""); 179 IntInfo info("=", "3", std::string());
180 EXPECT_TRUE(info.Contains(3)); 180 EXPECT_TRUE(info.Contains(3));
181 EXPECT_FALSE(info.Contains(4)); 181 EXPECT_FALSE(info.Contains(4));
182 } 182 }
183 { 183 {
184 IntInfo info(">", "3", ""); 184 IntInfo info(">", "3", std::string());
185 EXPECT_FALSE(info.Contains(2)); 185 EXPECT_FALSE(info.Contains(2));
186 EXPECT_FALSE(info.Contains(3)); 186 EXPECT_FALSE(info.Contains(3));
187 EXPECT_TRUE(info.Contains(4)); 187 EXPECT_TRUE(info.Contains(4));
188 } 188 }
189 { 189 {
190 IntInfo info("<=", "3", ""); 190 IntInfo info("<=", "3", std::string());
191 EXPECT_TRUE(info.Contains(2)); 191 EXPECT_TRUE(info.Contains(2));
192 EXPECT_TRUE(info.Contains(3)); 192 EXPECT_TRUE(info.Contains(3));
193 EXPECT_FALSE(info.Contains(4)); 193 EXPECT_FALSE(info.Contains(4));
194 } 194 }
195 { 195 {
196 IntInfo info("any", "", ""); 196 IntInfo info("any", std::string(), std::string());
197 EXPECT_TRUE(info.Contains(3)); 197 EXPECT_TRUE(info.Contains(3));
198 } 198 }
199 { 199 {
200 IntInfo info("between", "3", "5"); 200 IntInfo info("between", "3", "5");
201 EXPECT_TRUE(info.Contains(3)); 201 EXPECT_TRUE(info.Contains(3));
202 EXPECT_TRUE(info.Contains(5)); 202 EXPECT_TRUE(info.Contains(5));
203 EXPECT_TRUE(info.Contains(4)); 203 EXPECT_TRUE(info.Contains(4));
204 EXPECT_FALSE(info.Contains(6)); 204 EXPECT_FALSE(info.Contains(6));
205 EXPECT_FALSE(info.Contains(2)); 205 EXPECT_FALSE(info.Contains(2));
206 } 206 }
207 } 207 }
208 208
209 } // namespace content 209 } // namespace content
210 210
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698