#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "base/pickle.h"
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <string>
#include <string_view>
#include <tuple>
#include "base/containers/heap_array.h"
#include "base/containers/span.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace {
const bool testbool1 = …;
const bool testbool2 = …;
const int testint = …;
const long testlong = …;
const uint16_t testuint16 = …;
const uint32_t testuint32 = …;
const int64_t testint64 = …;
const uint64_t testuint64 = …;
const float testfloat = …;
const double testdouble = …;
const std::string teststring("Hello world");
const std::wstring testwstring(L"Hello, world");
const std::u16string teststring16(u"Hello, world");
const char testrawstring[] = …;
const char16_t testrawstring16[] = …;
const char testdata[] = …;
const size_t testdatalen = …;
void VerifyResult(const Pickle& pickle) { … }
}
TEST(PickleTest, UnownedVsOwned) { … }
TEST(PickleTest, EncodeDecode) { … }
TEST(PickleTest, LongFrom64Bit) { … }
TEST(PickleTest, SmallBuffer) { … }
TEST(PickleTest, BigSize) { … }
TEST(PickleTest, CopyWithInvalidHeader) { … }
TEST(PickleTest, UnalignedSize) { … }
TEST(PickleTest, ZeroLenStr) { … }
TEST(PickleTest, ZeroLenStr16) { … }
TEST(PickleTest, BadLenStr) { … }
TEST(PickleTest, BadLenStr16) { … }
TEST(PickleTest, PeekNext) { … }
TEST(PickleTest, PeekNextOverflow) { … }
TEST(PickleTest, FindNext) { … }
TEST(PickleTest, FindNextWithIncompleteHeader) { … }
#if defined(COMPILER_MSVC)
#pragma warning(push)
#pragma warning(disable: 4146)
#endif
TEST(PickleTest, FindNextOverflow) { … }
#if defined(COMPILER_MSVC)
#pragma warning(pop)
#endif
TEST(PickleTest, GetReadPointerAndAdvance) { … }
TEST(PickleTest, Resize) { … }
namespace {
struct CustomHeader : Pickle::Header { … };
}
TEST(PickleTest, HeaderPadding) { … }
TEST(PickleTest, EqualsOperator) { … }
TEST(PickleTest, EvilLengths) { … }
TEST(PickleTest, ZeroLength) { … }
TEST(PickleTest, ReadBytes) { … }
TEST(PickleTest, DeepCopyResize) { … }
namespace {
class TestingPickle : public Pickle { … };
}
TEST(PickleTest, ClaimBytesInitialization) { … }
TEST(PickleTest, ClaimBytes) { … }
TEST(PickleTest, ReachedEnd) { … }
TEST(PickleTest, NonCanonicalBool) { … }
}