Go to the source code of this file.
|
| TEST (Bser, RoundTrip) |
|
| TEST (Bser, Template) |
|
| TEST (Bser, PduLength) |
|
| TEST (Bser, CursorLength) |
|
TEST |
( |
Bser |
, |
|
|
RoundTrip |
|
|
) |
| |
Definition at line 57 of file BserTest.cpp.
References folly::basic_fbstring< E, T, A, Storage >::data(), EXPECT_EQ, folly::hexDump(), folly::bser::parseBser(), folly::basic_fbstring< E, T, A, Storage >::size(), folly::bser::toBser(), and folly::dynamic::typeName().
67 }
catch (
const std::exception& err) {
68 LOG(ERROR) << err.what() <<
"\nInput: " << dyn.typeName() <<
": " << dyn
69 <<
" decoded back as " << decoded.typeName() <<
": " << decoded
static const dynamic roundtrips[]
#define EXPECT_EQ(val1, val2)
const value_type * data() const
void hexDump(const void *ptr, size_t size, OutIt out)
folly::dynamic parseBser(folly::StringPiece)
folly::fbstring toBser(folly::dynamic const &, const serialization_opts &)
Definition at line 77 of file BserTest.cpp.
References folly::dynamic::array(), folly::basic_fbstring< E, T, A, Storage >::data(), EXPECT_EQ, folly::hexDump(), folly::bser::parseBser(), folly::basic_fbstring< E, T, A, Storage >::size(), template_blob, folly::bser::serialization_opts::templates, folly::bser::toBser(), folly::dynamic::typeName(), and uint8_t.
84 <<
"Didn't load template value.\n" 86 <<
" decoded back as " << decoded.
typeName() <<
": " << decoded <<
"\n"
const char * typeName() const
#define EXPECT_EQ(val1, val2)
const uint8_t template_blob[]
const value_type * data() const
void hexDump(const void *ptr, size_t size, OutIt out)
static const dynamic template_dynamic
static void array(EmptyArrayTag)
folly::Optional< TemplateMap > templates
std::unordered_map< const folly::dynamic *, folly::dynamic > TemplateMap
folly::dynamic parseBser(folly::StringPiece)
folly::fbstring toBser(folly::dynamic const &, const serialization_opts &)
TEST |
( |
Bser |
, |
|
|
PduLength |
|
|
) |
| |
Definition at line 104 of file BserTest.cpp.
References folly::bser::decodePduLength(), EXPECT_EQ, EXPECT_THROW, template_blob, and folly::IOBuf::wrapBuffer().
112 LOG(ERROR) <<
"managed to return a length, but only had 3 bytes";
118 EXPECT_EQ(len, 44) <<
"PduLength should be 44, got " << len;
#define EXPECT_THROW(statement, expected_exception)
static std::unique_ptr< IOBuf > wrapBuffer(const void *buf, std::size_t capacity)
#define EXPECT_EQ(val1, val2)
size_t decodePduLength(const folly::IOBuf *)
const uint8_t template_blob[]
TEST |
( |
Bser |
, |
|
|
CursorLength |
|
|
) |
| |
Definition at line 121 of file BserTest.cpp.
References folly::IOBufQueue::append(), folly::bser::decodePduLength(), EXPECT_EQ, folly::IOBufQueue::front(), i, folly::bser::parseBser(), folly::IOBufQueue::split(), string, folly::bser::toBser(), uint32_t, and folly::IOBuf::wrapBuffer().
130 for (
uint32_t i = 1;
i < longSerialized.size(); ++
i) {
135 while (j < longSerialized.size()) {
141 auto buf = q.
split(pdu_len);
std::unique_ptr< folly::IOBuf > split(size_t n)
const folly::IOBuf * front() const
void append(std::unique_ptr< folly::IOBuf > &&buf, bool pack=false)
static std::unique_ptr< IOBuf > wrapBuffer(const void *buf, std::size_t capacity)
#define EXPECT_EQ(val1, val2)
size_t decodePduLength(const folly::IOBuf *)
folly::dynamic parseBser(folly::StringPiece)
folly::fbstring toBser(folly::dynamic const &, const serialization_opts &)
Initial value:= {
1,
bool(true),
bool(false),
nullptr,
1.5,
"hello",
}
static void array(EmptyArrayTag)
Definition at line 24 of file BserTest.cpp.
Initial value:=
"\x00\x01\x03\x28"
"\x0b\x00\x03\x02\x02\x03\x04\x6e\x61\x6d\x65\x02"
"\x03\x03\x61\x67\x65\x03\x03\x02\x03\x04\x66\x72"
"\x65\x64\x03\x14\x02\x03\x04\x70\x65\x74\x65\x03"
"\x1e\x0c\x03\x19"
Definition at line 44 of file BserTest.cpp.
Referenced by TEST().
Initial value:
static void array(EmptyArrayTag)
Definition at line 52 of file BserTest.cpp.