comparison OrthancFramework/UnitTestsSources/ToolboxTests.cpp @ 4397:3aeb5171fbd4

new function Toolbox::ReadJsonWithoutComments()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 22 Dec 2020 08:59:23 +0100
parents f7104e9d044c
children d9473bd5ed43
comparison
equal deleted inserted replaced
4396:d07a65100a95 4397:3aeb5171fbd4
62 **/ 62 **/
63 ASSERT_EQ(Toolbox::StripSpaces(d), "{\"hello\":\"world\"}"); 63 ASSERT_EQ(Toolbox::StripSpaces(d), "{\"hello\":\"world\"}");
64 ASSERT_EQ(Toolbox::StripSpaces(f), "{\n \"hello\" : \"world\"\n}"); 64 ASSERT_EQ(Toolbox::StripSpaces(f), "{\n \"hello\" : \"world\"\n}");
65 } 65 }
66 66
67 TEST(Toolbox, JsonComments)
68 {
69 std::string a = "/* a */ { /* b */ \"hello\" : /* c */ \"world\" /* d */ } // e";
70
71 Json::Value b;
72 ASSERT_TRUE(Toolbox::ReadJsonWithoutComments(b, a));
73
74 std::string c;
75 Toolbox::WriteFastJson(c, b);
76 ASSERT_EQ(Toolbox::StripSpaces(c), "{\"hello\":\"world\"}");
77
78 Toolbox::WriteStyledJson(c, b);
79 ASSERT_EQ(Toolbox::StripSpaces(c), "{\n \"hello\" : \"world\"\n}");
80 }
81
67 TEST(Toolbox, Base64_allByteValues) 82 TEST(Toolbox, Base64_allByteValues)
68 { 83 {
69 std::string toEncode; 84 std::string toEncode;
70 std::string base64Result; 85 std::string base64Result;
71 std::string decodedResult; 86 std::string decodedResult;