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

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

Issue 2101863004: net: Change auto to not deduce raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « net/base/ip_address_unittest.cc ('k') | net/cert/cert_verifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/parse_number.h" 5 #include "net/base/parse_number.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // When testing ParseUint*() the |format| parameter is not applicable and 119 // When testing ParseUint*() the |format| parameter is not applicable and
120 // should be passed as NON_NEGATIVE. 120 // should be passed as NON_NEGATIVE.
121 template <typename T, typename ParseFunc> 121 template <typename T, typename ParseFunc>
122 void TestParseIntUsingFormat(ParseFunc func, ParseIntFormat format) { 122 void TestParseIntUsingFormat(ParseFunc func, ParseIntFormat format) {
123 // Test valid non-negative inputs 123 // Test valid non-negative inputs
124 for (const auto& test : kValidNonNegativeTests) { 124 for (const auto& test : kValidNonNegativeTests) {
125 ExpectParseIntSuccess<T>(func, test.input, format, test.expected_output); 125 ExpectParseIntSuccess<T>(func, test.input, format, test.expected_output);
126 } 126 }
127 127
128 // Test invalid inputs (invalid regardless of parsing format) 128 // Test invalid inputs (invalid regardless of parsing format)
129 for (const auto& input : kInvalidParseTests) { 129 for (auto* input : kInvalidParseTests) {
130 ExpectParseIntFailure<T>(func, input, format, ParseIntError::FAILED_PARSE); 130 ExpectParseIntFailure<T>(func, input, format, ParseIntError::FAILED_PARSE);
131 } 131 }
132 132
133 // Test valid negative inputs (constructed from the valid non-negative test 133 // Test valid negative inputs (constructed from the valid non-negative test
134 // cases). 134 // cases).
135 for (const auto& test : kValidNonNegativeTests) { 135 for (const auto& test : kValidNonNegativeTests) {
136 std::string negative_input = std::string("-") + test.input; 136 std::string negative_input = std::string("-") + test.input;
137 int expected_negative_output = -test.expected_output; 137 int expected_negative_output = -test.expected_output;
138 138
139 // The result depends on the format. 139 // The result depends on the format.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 TEST(ParseNumberTest, ParseUint32) { 242 TEST(ParseNumberTest, ParseUint32) {
243 TestParseUint<uint32_t>(ParseUint32); 243 TestParseUint<uint32_t>(ParseUint32);
244 } 244 }
245 245
246 TEST(ParseNumberTest, ParseUint64) { 246 TEST(ParseNumberTest, ParseUint64) {
247 TestParseUint<uint64_t>(ParseUint64); 247 TestParseUint<uint64_t>(ParseUint64);
248 } 248 }
249 249
250 } // namespace 250 } // namespace
251 } // namespace net 251 } // namespace net
OLDNEW
« no previous file with comments | « net/base/ip_address_unittest.cc ('k') | net/cert/cert_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698