OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (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 |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 |
| 15 #include "util/misc/uuid.h" |
| 16 |
| 17 #include <stdint.h> |
| 18 |
| 19 #include "gtest/gtest.h" |
| 20 |
| 21 namespace { |
| 22 |
| 23 using namespace crashpad; |
| 24 |
| 25 TEST(UUID, InitializeFromBytes) { |
| 26 const uint8_t kBytes[16] = {0x00, |
| 27 0x01, |
| 28 0x02, |
| 29 0x03, |
| 30 0x04, |
| 31 0x05, |
| 32 0x06, |
| 33 0x07, |
| 34 0x08, |
| 35 0x09, |
| 36 0x0a, |
| 37 0x0b, |
| 38 0x0c, |
| 39 0x0d, |
| 40 0x0e, |
| 41 0x0f}; |
| 42 |
| 43 UUID uuid; |
| 44 uuid.InitializeFromBytes(kBytes); |
| 45 |
| 46 EXPECT_EQ(0x00010203u, uuid.data_1); |
| 47 EXPECT_EQ(0x0405u, uuid.data_2); |
| 48 EXPECT_EQ(0x0607u, uuid.data_3); |
| 49 EXPECT_EQ(0x08u, uuid.data_4[0]); |
| 50 EXPECT_EQ(0x09u, uuid.data_4[1]); |
| 51 EXPECT_EQ(0x0au, uuid.data_4[2]); |
| 52 EXPECT_EQ(0x0bu, uuid.data_4[3]); |
| 53 EXPECT_EQ(0x0cu, uuid.data_4[4]); |
| 54 EXPECT_EQ(0x0du, uuid.data_4[5]); |
| 55 EXPECT_EQ(0x0eu, uuid.data_4[6]); |
| 56 EXPECT_EQ(0x0fu, uuid.data_4[7]); |
| 57 } |
| 58 |
| 59 } // namespace |
OLD | NEW |