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

Side by Side Diff: util/misc/uuid_test.cc

Issue 849193002: win: Some %zu to PRIuS (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: fix include order Created 5 years, 11 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 | « no previous file | util/numeric/checked_range_test.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 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "util/misc/uuid.h" 15 #include "util/misc/uuid.h"
16 16
17 #include <stdint.h> 17 #include <stdint.h>
18 18
19 #include <string> 19 #include <string>
20 20
21 #include "base/basictypes.h" 21 #include "base/basictypes.h"
22 #include "base/format_macros.h"
22 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
23 #include "gtest/gtest.h" 24 #include "gtest/gtest.h"
24 25
25 namespace crashpad { 26 namespace crashpad {
26 namespace test { 27 namespace test {
27 namespace { 28 namespace {
28 29
29 TEST(UUID, UUID) { 30 TEST(UUID, UUID) {
30 UUID uuid_zero; 31 UUID uuid_zero;
31 EXPECT_EQ(0u, uuid_zero.data_1); 32 EXPECT_EQ(0u, uuid_zero.data_1);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 {"", false}, 174 {"", false},
174 {"abcd", false}, 175 {"abcd", false},
175 // Trailing data: 176 // Trailing data:
176 {"6d247a34-53d5-40ec-a90d-d8dea9e94cc01", false} 177 {"6d247a34-53d5-40ec-a90d-d8dea9e94cc01", false}
177 }; 178 };
178 179
179 const std::string empty_uuid = UUID().ToString(); 180 const std::string empty_uuid = UUID().ToString();
180 181
181 for (size_t index = 0; index < arraysize(kCases); ++index) { 182 for (size_t index = 0; index < arraysize(kCases); ++index) {
182 const TestCase& test_case = kCases[index]; 183 const TestCase& test_case = kCases[index];
183 SCOPED_TRACE( 184 SCOPED_TRACE(base::StringPrintf(
184 base::StringPrintf("index %zu: %s", index, test_case.uuid_string)); 185 "index %" PRIuS ": %s", index, test_case.uuid_string));
185 186
186 UUID uuid; 187 UUID uuid;
187 EXPECT_EQ(test_case.success, 188 EXPECT_EQ(test_case.success,
188 uuid.InitializeFromString(test_case.uuid_string)); 189 uuid.InitializeFromString(test_case.uuid_string));
189 if (test_case.success) { 190 if (test_case.success) {
190 EXPECT_EQ(test_case.uuid_string, uuid.ToString()); 191 EXPECT_EQ(test_case.uuid_string, uuid.ToString());
191 } else { 192 } else {
192 EXPECT_EQ(empty_uuid, uuid.ToString()); 193 EXPECT_EQ(empty_uuid, uuid.ToString());
193 } 194 }
194 } 195 }
195 196
196 // Test for case insensitivty. 197 // Test for case insensitivty.
197 UUID uuid; 198 UUID uuid;
198 uuid.InitializeFromString("F32E5BDC-2681-4C73-A4E6-911FFD89B846"); 199 uuid.InitializeFromString("F32E5BDC-2681-4C73-A4E6-911FFD89B846");
199 EXPECT_EQ("f32e5bdc-2681-4c73-a4e6-911ffd89b846", uuid.ToString()); 200 EXPECT_EQ("f32e5bdc-2681-4c73-a4e6-911ffd89b846", uuid.ToString());
200 201
201 // Mixed case. 202 // Mixed case.
202 uuid.InitializeFromString("5762C15D-50b5-4171-a2e9-7429C9EC6CAB"); 203 uuid.InitializeFromString("5762C15D-50b5-4171-a2e9-7429C9EC6CAB");
203 EXPECT_EQ("5762c15d-50b5-4171-a2e9-7429c9ec6cab", uuid.ToString()); 204 EXPECT_EQ("5762c15d-50b5-4171-a2e9-7429c9ec6cab", uuid.ToString());
204 } 205 }
205 206
206 } // namespace 207 } // namespace
207 } // namespace test 208 } // namespace test
208 } // namespace crashpad 209 } // namespace crashpad
OLDNEW
« no previous file with comments | « no previous file | util/numeric/checked_range_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698