🔨 moved serialization functions to serializer class

The class is currently just a wrapper for an std::ostream and collects
all functions related to serialization. The next step should be
recycling of variables to avoid repetitive initialization for each
recursive dump call.
parent 9c4919ff
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -49,44 +49,44 @@ TEST_CASE("convenience functions") ...@@ -49,44 +49,44 @@ TEST_CASE("convenience functions")
SECTION("string escape") SECTION("string escape")
{ {
CHECK(json::escape_string("\"") == "\\\""); CHECK(json::serializer::escape_string("\"") == "\\\"");
CHECK(json::escape_string("\\") == "\\\\"); CHECK(json::serializer::escape_string("\\") == "\\\\");
CHECK(json::escape_string("\b") == "\\b"); CHECK(json::serializer::escape_string("\b") == "\\b");
CHECK(json::escape_string("\f") == "\\f"); CHECK(json::serializer::escape_string("\f") == "\\f");
CHECK(json::escape_string("\n") == "\\n"); CHECK(json::serializer::escape_string("\n") == "\\n");
CHECK(json::escape_string("\r") == "\\r"); CHECK(json::serializer::escape_string("\r") == "\\r");
CHECK(json::escape_string("\t") == "\\t"); CHECK(json::serializer::escape_string("\t") == "\\t");
CHECK(json::escape_string("\x01") == "\\u0001"); CHECK(json::serializer::escape_string("\x01") == "\\u0001");
CHECK(json::escape_string("\x02") == "\\u0002"); CHECK(json::serializer::escape_string("\x02") == "\\u0002");
CHECK(json::escape_string("\x03") == "\\u0003"); CHECK(json::serializer::escape_string("\x03") == "\\u0003");
CHECK(json::escape_string("\x04") == "\\u0004"); CHECK(json::serializer::escape_string("\x04") == "\\u0004");
CHECK(json::escape_string("\x05") == "\\u0005"); CHECK(json::serializer::escape_string("\x05") == "\\u0005");
CHECK(json::escape_string("\x06") == "\\u0006"); CHECK(json::serializer::escape_string("\x06") == "\\u0006");
CHECK(json::escape_string("\x07") == "\\u0007"); CHECK(json::serializer::escape_string("\x07") == "\\u0007");
CHECK(json::escape_string("\x08") == "\\b"); CHECK(json::serializer::escape_string("\x08") == "\\b");
CHECK(json::escape_string("\x09") == "\\t"); CHECK(json::serializer::escape_string("\x09") == "\\t");
CHECK(json::escape_string("\x0a") == "\\n"); CHECK(json::serializer::escape_string("\x0a") == "\\n");
CHECK(json::escape_string("\x0b") == "\\u000b"); CHECK(json::serializer::escape_string("\x0b") == "\\u000b");
CHECK(json::escape_string("\x0c") == "\\f"); CHECK(json::serializer::escape_string("\x0c") == "\\f");
CHECK(json::escape_string("\x0d") == "\\r"); CHECK(json::serializer::escape_string("\x0d") == "\\r");
CHECK(json::escape_string("\x0e") == "\\u000e"); CHECK(json::serializer::escape_string("\x0e") == "\\u000e");
CHECK(json::escape_string("\x0f") == "\\u000f"); CHECK(json::serializer::escape_string("\x0f") == "\\u000f");
CHECK(json::escape_string("\x10") == "\\u0010"); CHECK(json::serializer::escape_string("\x10") == "\\u0010");
CHECK(json::escape_string("\x11") == "\\u0011"); CHECK(json::serializer::escape_string("\x11") == "\\u0011");
CHECK(json::escape_string("\x12") == "\\u0012"); CHECK(json::serializer::escape_string("\x12") == "\\u0012");
CHECK(json::escape_string("\x13") == "\\u0013"); CHECK(json::serializer::escape_string("\x13") == "\\u0013");
CHECK(json::escape_string("\x14") == "\\u0014"); CHECK(json::serializer::escape_string("\x14") == "\\u0014");
CHECK(json::escape_string("\x15") == "\\u0015"); CHECK(json::serializer::escape_string("\x15") == "\\u0015");
CHECK(json::escape_string("\x16") == "\\u0016"); CHECK(json::serializer::escape_string("\x16") == "\\u0016");
CHECK(json::escape_string("\x17") == "\\u0017"); CHECK(json::serializer::escape_string("\x17") == "\\u0017");
CHECK(json::escape_string("\x18") == "\\u0018"); CHECK(json::serializer::escape_string("\x18") == "\\u0018");
CHECK(json::escape_string("\x19") == "\\u0019"); CHECK(json::serializer::escape_string("\x19") == "\\u0019");
CHECK(json::escape_string("\x1a") == "\\u001a"); CHECK(json::serializer::escape_string("\x1a") == "\\u001a");
CHECK(json::escape_string("\x1b") == "\\u001b"); CHECK(json::serializer::escape_string("\x1b") == "\\u001b");
CHECK(json::escape_string("\x1c") == "\\u001c"); CHECK(json::serializer::escape_string("\x1c") == "\\u001c");
CHECK(json::escape_string("\x1d") == "\\u001d"); CHECK(json::serializer::escape_string("\x1d") == "\\u001d");
CHECK(json::escape_string("\x1e") == "\\u001e"); CHECK(json::serializer::escape_string("\x1e") == "\\u001e");
CHECK(json::escape_string("\x1f") == "\\u001f"); CHECK(json::serializer::escape_string("\x1f") == "\\u001f");
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment