//////////////////////////////////////////////////////////////////////////////// // Copyright 2017 Google LLC. // // This software is licensed under the terms defined in the Widevine Master // License Agreement. For a copy of this agreement, please contact // widevine-licensing@google.com. //////////////////////////////////////////////////////////////////////////////// // // Contains the test cases for EncodeUint64 and KeyToUint32. #include "strings/serialize.h" #include #include "testing/gunit.h" namespace widevine { namespace strings { TEST(SerializeTest, KeyToUint32) { std::string val = "\x12\x34\x56\x78"; EXPECT_EQ(0x12345678, KeyToUint32(val)); val = "\x87\x65\x43\x21"; EXPECT_EQ(0x87654321, KeyToUint32(val)); } TEST(SerializeTest, EncodeUint64) { uint64_t q1 = 0x4142434441424344; std::string uint64_str = EncodeUint64(q1); EXPECT_TRUE(uint64_str == "DCBADCBA" || uint64_str == "ABCDABCD"); } } // namespace strings } // namespace widevine