Changeset View
Changeset View
Standalone View
Standalone View
src/test/torcontrol_tests.cpp
Show First 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | CheckParseTorReplyMapping("OneOctal=\"OneEnd\\1\" TwoOctal=\"TwoEnd\\11\"", | ||||
{"OneOctal", "OneEnd\1"}, | {"OneOctal", "OneEnd\1"}, | ||||
{"TwoOctal", "TwoEnd\11"}, | {"TwoOctal", "TwoEnd\11"}, | ||||
}); | }); | ||||
// Special handling for null case | // Special handling for null case | ||||
// (needed because string comparison reads the null as end-of-string) | // (needed because string comparison reads the null as end-of-string) | ||||
BOOST_TEST_MESSAGE(std::string("CheckParseTorReplyMapping(Null=\"\\0\")")); | BOOST_TEST_MESSAGE(std::string("CheckParseTorReplyMapping(Null=\"\\0\")")); | ||||
auto ret = ParseTorReplyMapping("Null=\"\\0\""); | auto ret = ParseTorReplyMapping("Null=\"\\0\""); | ||||
BOOST_CHECK_EQUAL(ret.size(), 1); | BOOST_CHECK_EQUAL(ret.size(), 1U); | ||||
auto r_it = ret.begin(); | auto r_it = ret.begin(); | ||||
BOOST_CHECK_EQUAL(r_it->first, "Null"); | BOOST_CHECK_EQUAL(r_it->first, "Null"); | ||||
BOOST_CHECK_EQUAL(r_it->second.size(), 1); | BOOST_CHECK_EQUAL(r_it->second.size(), 1U); | ||||
BOOST_CHECK_EQUAL(r_it->second[0], '\0'); | BOOST_CHECK_EQUAL(r_it->second[0], '\0'); | ||||
// A more complex valid grammar. PROTOCOLINFO accepts a VersionLine that | // A more complex valid grammar. PROTOCOLINFO accepts a VersionLine that | ||||
// takes a key=value pair followed by an OptArguments, making this valid. | // takes a key=value pair followed by an OptArguments, making this valid. | ||||
// Because an OptArguments contains no semantic data, there is no point in | // Because an OptArguments contains no semantic data, there is no point in | ||||
// parsing it. | // parsing it. | ||||
CheckParseTorReplyMapping("SOME=args,here MORE optional=arguments here", | CheckParseTorReplyMapping("SOME=args,here MORE optional=arguments here", | ||||
{ | { | ||||
Show All 18 Lines |