Index: util/misc/uuid_test.cc |
diff --git a/util/misc/uuid_test.cc b/util/misc/uuid_test.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d56a40a29b94dc299d27dba90c46612488e03c2b |
--- /dev/null |
+++ b/util/misc/uuid_test.cc |
@@ -0,0 +1,59 @@ |
+// Copyright 2014 The Crashpad Authors. All rights reserved. |
+// |
+// Licensed under the Apache License, Version 2.0 (the "License"); |
+// you may not use this file except in compliance with the License. |
+// You may obtain a copy of the License at |
+// |
+// http://www.apache.org/licenses/LICENSE-2.0 |
+// |
+// Unless required by applicable law or agreed to in writing, software |
+// distributed under the License is distributed on an "AS IS" BASIS, |
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+// See the License for the specific language governing permissions and |
+// limitations under the License. |
+ |
+#include "util/misc/uuid.h" |
+ |
+#include <stdint.h> |
+ |
+#include "gtest/gtest.h" |
+ |
+namespace { |
+ |
+using namespace crashpad; |
+ |
+TEST(UUID, InitializeFromBytes) { |
+ const uint8_t kBytes[16] = {0x00, |
+ 0x01, |
+ 0x02, |
+ 0x03, |
+ 0x04, |
+ 0x05, |
+ 0x06, |
+ 0x07, |
+ 0x08, |
+ 0x09, |
+ 0x0a, |
+ 0x0b, |
+ 0x0c, |
+ 0x0d, |
+ 0x0e, |
+ 0x0f}; |
+ |
+ UUID uuid; |
+ uuid.InitializeFromBytes(kBytes); |
+ |
+ EXPECT_EQ(0x00010203u, uuid.data_1); |
+ EXPECT_EQ(0x0405u, uuid.data_2); |
+ EXPECT_EQ(0x0607u, uuid.data_3); |
+ EXPECT_EQ(0x08u, uuid.data_4[0]); |
+ EXPECT_EQ(0x09u, uuid.data_4[1]); |
+ EXPECT_EQ(0x0au, uuid.data_4[2]); |
+ EXPECT_EQ(0x0bu, uuid.data_4[3]); |
+ EXPECT_EQ(0x0cu, uuid.data_4[4]); |
+ EXPECT_EQ(0x0du, uuid.data_4[5]); |
+ EXPECT_EQ(0x0eu, uuid.data_4[6]); |
+ EXPECT_EQ(0x0fu, uuid.data_4[7]); |
+} |
+ |
+} // namespace |