migrate from dynamic::Value to dv::value & total erase namespace 'dynamic'

This commit is contained in:
MihailRis
2024-09-18 23:31:18 +03:00
parent d3ba4b2e3e
commit 34d2e6d400
69 changed files with 1247 additions and 2248 deletions
+3 -38
View File
@@ -8,42 +8,7 @@ TEST(JSON, EncodeDecode) {
const int bytesSize = 20;
const int year = 2019;
const float score = 3.141592;
dynamic::ByteBuffer srcBytes(bytesSize);
for (int i = 0; i < bytesSize; i ++) {
srcBytes[i] = rand();
}
std::string text;
{
dynamic::Map map;
map.put("name", name);
map.put("year", year);
map.put("score", score);
map.put("data", &srcBytes);
text = json::stringify(&map, false, "");
}
{
auto map = json::parse(text);
EXPECT_EQ(map->get<std::string>("name"), name);
EXPECT_EQ(map->get<integer_t>("year"), year);
EXPECT_FLOAT_EQ(map->get<number_t>("score"), score);
auto b64string = map->get<std::string>("data");
auto bytes = util::base64_decode(b64string);
EXPECT_EQ(bytes.size(), bytesSize);
for (int i = 0; i < bytesSize; i++) {
EXPECT_EQ(bytes[i], srcBytes[i]);
}
}
}
TEST(JSON, EncodeDecodeDV) {
const std::string name = "JSON-encoder";
const int bytesSize = 20;
const int year = 2019;
const float score = 3.141592;
dynamic::ByteBuffer srcBytes(bytesSize);
dv::objects::Bytes srcBytes(bytesSize);
for (int i = 0; i < bytesSize; i ++) {
srcBytes[i] = rand();
}
@@ -56,10 +21,10 @@ TEST(JSON, EncodeDecodeDV) {
object["score"] = score;
object["data"] = srcBytes;
text = json::stringifyDV(object, false, "");
text = json::stringify(object, false, "");
}
{
auto object = json::parseDV(text);
auto object = json::parse(text);
EXPECT_EQ(object["name"].asString(), name);
EXPECT_EQ(object["year"].asInteger(), year);
EXPECT_FLOAT_EQ(object["score"].asNumber(), score);