add comments
This commit is contained in:
parent
05c6008995
commit
4f222be7f2
@ -5,13 +5,14 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using osrm::util::escape_JSON;
|
using osrm::util::EscapeJSONString;
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size)
|
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size)
|
||||||
{
|
{
|
||||||
const std::string in(reinterpret_cast<const char *>(data), size);
|
const std::string in(reinterpret_cast<const char *>(data), size);
|
||||||
|
|
||||||
const auto escaped = escape_JSON(in);
|
std::string escaped;
|
||||||
|
EscapeJSONString(in, escaped);
|
||||||
escape(escaped.data());
|
escape(escaped.data());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -12,12 +12,15 @@ using namespace osrm::util;
|
|||||||
BOOST_AUTO_TEST_CASE(json_escaping)
|
BOOST_AUTO_TEST_CASE(json_escaping)
|
||||||
{
|
{
|
||||||
std::string input{"\b\\"};
|
std::string input{"\b\\"};
|
||||||
std::string output{escape_JSON(input)};
|
std::string output;
|
||||||
|
EscapeJSONString(input, output);
|
||||||
|
|
||||||
|
BOOST_CHECK_EQUAL(SizeOfEscapedJSONString(input), 4);
|
||||||
BOOST_CHECK_EQUAL(output, "\\b\\\\");
|
BOOST_CHECK_EQUAL(output, "\\b\\\\");
|
||||||
|
|
||||||
input = "Aleja \"Solidarnosci\"";
|
input = "Aleja \"Solidarnosci\"";
|
||||||
output = escape_JSON(input);
|
EscapeJSONString(input, output);
|
||||||
|
BOOST_CHECK_EQUAL(SizeOfEscapedJSONString(input), 24);
|
||||||
BOOST_CHECK_EQUAL(output, "Aleja \\\"Solidarnosci\\\"");
|
BOOST_CHECK_EQUAL(output, "Aleja \\\"Solidarnosci\\\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user