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

Side by Side Diff: base/guid_unittest.cc

Issue 1280473002: Update ToLower/UpperASCII API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « base/files/file_util_unittest.cc ('k') | base/strings/string_util.h » ('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 (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 "base/guid.h" 5 #include "base/guid.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 25 matching lines...) Expand all
36 std::string clientid = RandomDataToGUIDString(bytes); 36 std::string clientid = RandomDataToGUIDString(bytes);
37 EXPECT_EQ("01234567-89AB-CDEF-FEDC-BA9876543210", clientid); 37 EXPECT_EQ("01234567-89AB-CDEF-FEDC-BA9876543210", clientid);
38 } 38 }
39 #endif 39 #endif
40 40
41 TEST(GUIDTest, GUIDCorrectlyFormatted) { 41 TEST(GUIDTest, GUIDCorrectlyFormatted) {
42 const int kIterations = 10; 42 const int kIterations = 10;
43 for (int it = 0; it < kIterations; ++it) { 43 for (int it = 0; it < kIterations; ++it) {
44 std::string guid = GenerateGUID(); 44 std::string guid = GenerateGUID();
45 EXPECT_TRUE(IsValidGUID(guid)); 45 EXPECT_TRUE(IsValidGUID(guid));
46 EXPECT_TRUE(IsValidGUID(StringToLowerASCII(guid))); 46 EXPECT_TRUE(IsValidGUID(ToLowerASCII(guid)));
47 EXPECT_TRUE(IsValidGUID(StringToUpperASCII(guid))); 47 EXPECT_TRUE(IsValidGUID(ToUpperASCII(guid)));
48 } 48 }
49 } 49 }
50 50
51 TEST(GUIDTest, GUIDBasicUniqueness) { 51 TEST(GUIDTest, GUIDBasicUniqueness) {
52 const int kIterations = 10; 52 const int kIterations = 10;
53 for (int it = 0; it < kIterations; ++it) { 53 for (int it = 0; it < kIterations; ++it) {
54 std::string guid1 = GenerateGUID(); 54 std::string guid1 = GenerateGUID();
55 std::string guid2 = GenerateGUID(); 55 std::string guid2 = GenerateGUID();
56 EXPECT_EQ(36U, guid1.length()); 56 EXPECT_EQ(36U, guid1.length());
57 EXPECT_EQ(36U, guid2.length()); 57 EXPECT_EQ(36U, guid2.length());
58 EXPECT_NE(guid1, guid2); 58 EXPECT_NE(guid1, guid2);
59 #if defined(OS_POSIX) 59 #if defined(OS_POSIX)
60 EXPECT_TRUE(IsGUIDv4(guid1)); 60 EXPECT_TRUE(IsGUIDv4(guid1));
61 EXPECT_TRUE(IsGUIDv4(guid2)); 61 EXPECT_TRUE(IsGUIDv4(guid2));
62 #endif 62 #endif
63 } 63 }
64 } 64 }
65 65
66 } // namespace base 66 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_util_unittest.cc ('k') | base/strings/string_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698