Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/test/seeder_tests.cpp
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(parse_name_tests) { | ||||
// Check behavior for a name that is the maximum length | // Check behavior for a name that is the maximum length | ||||
std::string maxLengthQName = maxLengthLabel + '.' + maxLengthLabel + '.' + | std::string maxLengthQName = maxLengthLabel + '.' + maxLengthLabel + '.' + | ||||
maxLengthLabel + '.' + maxLengthLabel; | maxLengthLabel + '.' + maxLengthLabel; | ||||
BOOST_CHECK_EQUAL(maxLengthQName.size(), MAX_QUERY_NAME_LENGTH); | BOOST_CHECK_EQUAL(maxLengthQName.size(), MAX_QUERY_NAME_LENGTH); | ||||
CheckParseName(maxLengthQName); | CheckParseName(maxLengthQName); | ||||
// Check that an oversized label causes an error | // Check that an oversized label causes an error | ||||
CheckParseNameError("www." + maxLengthLabel + "a.com", -1); | CheckParseNameError("www." + maxLengthLabel + "a.com", -1); | ||||
// Check that a query name that is too long causes an error | |||||
CheckParseNameError(maxLengthQName + ".com", -1, 2 * maxLengthQName.size()); | |||||
jasonbcox: Checking immediately beyond the boundary case would be more useful, otherwise this test will… | |||||
} | } | ||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |
Checking immediately beyond the boundary case would be more useful, otherwise this test will not fail for an off-by-one error.