Refactor and cleanup codes. No functional changes.

This commit is contained in:
KongQun Yang
2019-01-23 15:16:31 -08:00
parent 84f66d2320
commit 93265ab9d1
207 changed files with 14893 additions and 3332 deletions

32
strings/serialize_test.cc Normal file
View File

@@ -0,0 +1,32 @@
////////////////////////////////////////////////////////////////////////////////
// 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 "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