From 6871825565d0ba24436dbd5b92cc09e02f93af6a Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 26 Oct 2026 16:59:39 +0100 Subject: First run of making variable names more readable --- tests/t_scan_urlencoded_query.c | 12 ++++++------ tests/t_vector.c | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'tests') diff --git a/tests/t_scan_urlencoded_query.c b/tests/t_scan_urlencoded_query.c index f660ea3..cb6c982 100644 --- a/tests/t_scan_urlencoded_query.c +++ b/tests/t_scan_urlencoded_query.c @@ -265,7 +265,7 @@ static void case_fmt_passes_safe_bytes(void) { size_t n; test_case("alphanumerics and the safe punctuation pass through"); - n = fmt_urlencoded(dest, src, 11); + n = urlencoded_format(dest, src, 11); dest[n] = 0; CHECK_INT(n, 11); CHECK_STR(dest, "aZ09$-./=_~"); @@ -277,7 +277,7 @@ static void case_fmt_escapes_the_rest(void) { size_t n; test_case("everything else becomes a percent escape"); - n = fmt_urlencoded(dest, src, sizeof(src)); + n = urlencoded_format(dest, src, sizeof(src)); dest[n] = 0; CHECK_INT(n, 18); CHECK_STR(dest, "%20%25%26%2b%3a%3f"); @@ -289,7 +289,7 @@ static void case_fmt_hex_is_lower_case(void) { size_t n; test_case("escapes use lower case hex digits"); - n = fmt_urlencoded(dest, src, sizeof(src)); + n = urlencoded_format(dest, src, sizeof(src)); dest[n] = 0; CHECK_INT(n, 9); CHECK_STR(dest, "%00%ab%ff"); @@ -300,7 +300,7 @@ static void case_fmt_zero_length(void) { test_case("a zero length input writes nothing"); memset(dest, 0x5a, sizeof(dest)); - CHECK_INT(fmt_urlencoded(dest, (const uint8_t *)"abc", 0), 0); + CHECK_INT(urlencoded_format(dest, (const uint8_t *)"abc", 0), 0); CHECK_MEM(dest, "\x5a\x5a\x5a\x5a", 4); } @@ -312,7 +312,7 @@ static void case_fmt_worst_case_fits(void) { test_case("a hash of entirely unsafe bytes needs three times its length"); for (i = 0; i < sizeof(src); ++i) src[i] = 0xff; - n = fmt_urlencoded(dest, src, sizeof(src)); + n = urlencoded_format(dest, src, sizeof(src)); dest[n] = 0; CHECK_INT(n, 60); for (i = 0; i < 20; ++i) @@ -338,7 +338,7 @@ static void case_fmt_decoder_disagrees_on_dollar(void) { ssize_t got; test_case("the encoder passes '$' but the decoder rejects it"); - n = fmt_urlencoded(dest, src, sizeof(src)); + n = urlencoded_format(dest, src, sizeof(src)); dest[n] = 0; CHECK_STR(dest, "a$b"); diff --git a/tests/t_vector.c b/tests/t_vector.c index a8186b2..541a6da 100644 --- a/tests/t_vector.c +++ b/tests/t_vector.c @@ -13,7 +13,7 @@ #include "trackerlogic.h" #include "test.h" -/* binary_search returns the matching member when there is one, and otherwise +/* vector_binary_search returns the matching member when there is one, and otherwise the position at which the key would have to be inserted to keep the vector sorted. exactmatch distinguishes the two. */ @@ -25,7 +25,7 @@ static void case_search_finds_member(void) { void *found; test_case("an existing key is found"); - found = binary_search(key, sorted, 5, 4, 4, &exactmatch); + found = vector_binary_search(key, sorted, 5, 4, 4, &exactmatch); CHECK(exactmatch != 0); CHECK_PTR(found, sorted[2]); } @@ -36,9 +36,9 @@ static void case_search_finds_first_and_last(void) { int exactmatch; test_case("the first and last members are found"); - CHECK_PTR(binary_search(first, sorted, 5, 4, 4, &exactmatch), sorted[0]); + CHECK_PTR(vector_binary_search(first, sorted, 5, 4, 4, &exactmatch), sorted[0]); CHECK(exactmatch != 0); - CHECK_PTR(binary_search(last, sorted, 5, 4, 4, &exactmatch), sorted[4]); + CHECK_PTR(vector_binary_search(last, sorted, 5, 4, 4, &exactmatch), sorted[4]); CHECK(exactmatch != 0); } @@ -49,11 +49,11 @@ static void case_search_insert_position(void) { void *slot; test_case("a missing key yields its insert position"); - slot = binary_search(middle, sorted, 5, 4, 4, &exactmatch); + slot = vector_binary_search(middle, sorted, 5, 4, 4, &exactmatch); CHECK_INT(exactmatch, 0); CHECK_PTR(slot, sorted[2]); - slot = binary_search(before, sorted, 5, 4, 4, &exactmatch); + slot = vector_binary_search(before, sorted, 5, 4, 4, &exactmatch); CHECK_INT(exactmatch, 0); CHECK_PTR(slot, sorted[0]); } @@ -64,7 +64,7 @@ static void case_search_past_the_end(void) { void *slot; test_case("a key above every member yields the position past the end"); - slot = binary_search(beyond, sorted, 5, 4, 4, &exactmatch); + slot = vector_binary_search(beyond, sorted, 5, 4, 4, &exactmatch); CHECK_INT(exactmatch, 0); CHECK_PTR(slot, sorted[5]); } @@ -74,7 +74,7 @@ static void case_search_empty(void) { void *base = (void *)sorted; test_case("searching an empty vector reports no match at the base"); - CHECK_PTR(binary_search(sorted[0], base, 0, 4, 4, &exactmatch), base); + CHECK_PTR(vector_binary_search(sorted[0], base, 0, 4, 4, &exactmatch), base); CHECK_INT(exactmatch, 0); } -- cgit v1.3