nullptr,
1.5,
"hello",
- {1, 2, 3},
+ folly::dynamic::array(1, 2, 3),
dynamic::object("key", "value")("otherkey", "otherval"),
};
"\x1e\x0c\x03\x19";
// and here's what it represents
-static const dynamic template_dynamic = {
+static const dynamic template_dynamic = folly::dynamic::array(
dynamic::object("name", "fred")("age", 20),
dynamic::object("name", "pete")("age", 30),
- dynamic::object("name", nullptr)("age", 25),
-};
+ dynamic::object("name", nullptr)("age", 25));
TEST(Bser, RoundTrip) {
dynamic decoded(nullptr);
// Now check that we can generate this same data representation
folly::bser::serialization_opts opts;
- folly::bser::serialization_opts::TemplateMap templates = {
- std::make_pair(&decoded, folly::dynamic{"name", "age"})};
+ folly::bser::serialization_opts::TemplateMap templates = {std::make_pair(
+ &decoded, folly::dynamic(folly::dynamic::array("name", "age")))};
opts.templates = templates;
str = folly::bser::toBser(decoded, opts);
TEST(Gen, Dynamic) {
dynamic array1 = dynamic::array(1, 2);
EXPECT_EQ(dynamic(3), from(array1) | sum);
- dynamic array2 = {{1}, {1, 2}};
+ dynamic array2 = folly::dynamic::array(
+ folly::dynamic::array(1), folly::dynamic::array(1, 2));
EXPECT_EQ(dynamic(4), from(array2) | rconcat | sum);
- dynamic array3 = {{{1}}, {{1}, {1, 2}}};
+ dynamic array3 = folly::dynamic::array(
+ folly::dynamic::array(folly::dynamic::array(1)),
+ folly::dynamic::array(
+ folly::dynamic::array(1), folly::dynamic::array(1, 2)));
EXPECT_EQ(dynamic(5), from(array3) | rconcat | rconcat | sum);
}