bneradt commented on code in PR #10997: URL: https://github.com/apache/trafficserver/pull/10997#discussion_r1470445371
########## src/proxy/hdrs/unit_tests/test_XPACK.cc: ########## @@ -125,4 +125,186 @@ TEST_CASE("XPACK_String", "[xpack]") REQUIRE(memcmp(actual, i.raw_string, actual_len) == 0); } } + + SECTION("Dynamic Table") + { + constexpr uint16_t MAX_SIZE = 128; + XpackDynamicTable dt(MAX_SIZE); + XpackLookupResult result; + const char *name = nullptr; + size_t name_len = 0; + const char *value = nullptr; + size_t value_len = 0; + + // Check the initial state + REQUIRE(dt.size() == 0); + REQUIRE(dt.maximum_size() == MAX_SIZE); + REQUIRE(dt.is_empty()); + REQUIRE(dt.count() == 0); + result = dt.lookup(0, &name, &name_len, &value, &value_len); + REQUIRE(result.match_type == XpackLookupResult::MatchType::NONE); + result = dt.lookup(1, &name, &name_len, &value, &value_len); + REQUIRE(result.match_type == XpackLookupResult::MatchType::NONE); + result = dt.lookup(MAX_SIZE - 1, &name, &name_len, &value, &value_len); + REQUIRE(result.match_type == XpackLookupResult::MatchType::NONE); + result = dt.lookup(MAX_SIZE, &name, &name_len, &value, &value_len); + REQUIRE(result.match_type == XpackLookupResult::MatchType::NONE); + result = dt.lookup(MAX_SIZE + 1, &name, &name_len, &value, &value_len); + REQUIRE(result.match_type == XpackLookupResult::MatchType::NONE); + + // Insdert one entry Review Comment: "Insdert" -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@trafficserver.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org