MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

unit_tests/util/string_util.cpp:12–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace osrm::util;
11
12BOOST_AUTO_TEST_CASE(json_escaping)
13{
14 std::string input{"\b\\"};
15 std::string output;
16 EscapeJSONString(input, output);
17
18 BOOST_CHECK(RequiresJSONStringEscaping(input));
19 BOOST_CHECK_EQUAL(output, "\\b\\\\");
20
21 input = "Aleja \"Solidarnosci\"";
22 output.clear();
23 EscapeJSONString(input, output);
24 BOOST_CHECK(RequiresJSONStringEscaping(input));
25 BOOST_CHECK_EQUAL(output, "Aleja \\\"Solidarnosci\\\"");
26
27 BOOST_CHECK(!RequiresJSONStringEscaping("Aleja Solidarnosci"));
28}
29
30BOOST_AUTO_TEST_SUITE_END()

Callers

nothing calls this directly

Calls 3

EscapeJSONStringFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected