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

Unified Diff: util/misc/uuid_test.cc

Issue 535343004: Add MachOImageReader and its test (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/misc/uuid.cc ('k') | util/test/mac/dyld.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/misc/uuid_test.cc
diff --git a/util/misc/uuid_test.cc b/util/misc/uuid_test.cc
index 2e3bea32344a2dea24c980468987cfb2c62ef6b1..5d515cc6dc0fcbde463039ebe1f2776778407531 100644
--- a/util/misc/uuid_test.cc
+++ b/util/misc/uuid_test.cc
@@ -70,6 +70,39 @@ TEST(UUID, UUID) {
EXPECT_EQ(0x0fu, uuid.data_5[5]);
EXPECT_EQ("00010203-0405-0607-0809-0a0b0c0d0e0f", uuid.ToString());
+ // Test both operator== and operator!=.
+ EXPECT_FALSE(uuid == uuid_zero);
+ EXPECT_NE(uuid, uuid_zero);
+
+ UUID uuid_2(kBytes);
+ EXPECT_EQ(uuid, uuid_2);
+ EXPECT_FALSE(uuid != uuid_2);
+
+ // Make sure that operator== and operator!= check the entire UUID.
+ ++uuid.data_1;
+ EXPECT_NE(uuid, uuid_2);
+ --uuid.data_1;
+ ++uuid.data_2;
+ EXPECT_NE(uuid, uuid_2);
+ --uuid.data_2;
+ ++uuid.data_3;
+ EXPECT_NE(uuid, uuid_2);
+ --uuid.data_3;
+ for (size_t index = 0; index < arraysize(uuid.data_4); ++index) {
+ ++uuid.data_4[index];
+ EXPECT_NE(uuid, uuid_2);
+ --uuid.data_4[index];
+ }
+ for (size_t index = 0; index < arraysize(uuid.data_5); ++index) {
+ ++uuid.data_5[index];
+ EXPECT_NE(uuid, uuid_2);
+ --uuid.data_5[index];
+ }
+
+ // Make sure that the UUIDs are equal again, otherwise the test above may not
+ // have been valid.
+ EXPECT_EQ(uuid, uuid_2);
+
const uint8_t kMoreBytes[16] = {0xff,
0xee,
0xdd,
@@ -100,6 +133,9 @@ TEST(UUID, UUID) {
EXPECT_EQ(0x00u, uuid.data_5[5]);
EXPECT_EQ("ffeeddcc-bbaa-9988-7766-554433221100", uuid.ToString());
+ EXPECT_NE(uuid, uuid_2);
+ EXPECT_NE(uuid, uuid_zero);
+
// Test that UUID is standard layout.
memset(&uuid, 0x45, 16);
EXPECT_EQ(0x45454545u, uuid.data_1);
« no previous file with comments | « util/misc/uuid.cc ('k') | util/test/mac/dyld.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698