summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-10-26 16:59:39 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-10-26 16:59:39 +0100
commit6871825565d0ba24436dbd5b92cc09e02f93af6a (patch)
tree0fbd4f05de5997d74bbc4f65d55a611e650ee83f /tests
parent5e86efde052760a53ca92ddd411db095fcf4a970 (diff)
First run of making variable names more readable
Diffstat (limited to 'tests')
-rw-r--r--tests/t_scan_urlencoded_query.c12
-rw-r--r--tests/t_vector.c16
2 files changed, 14 insertions, 14 deletions
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) {
265 size_t n; 265 size_t n;
266 266
267 test_case("alphanumerics and the safe punctuation pass through"); 267 test_case("alphanumerics and the safe punctuation pass through");
268 n = fmt_urlencoded(dest, src, 11); 268 n = urlencoded_format(dest, src, 11);
269 dest[n] = 0; 269 dest[n] = 0;
270 CHECK_INT(n, 11); 270 CHECK_INT(n, 11);
271 CHECK_STR(dest, "aZ09$-./=_~"); 271 CHECK_STR(dest, "aZ09$-./=_~");
@@ -277,7 +277,7 @@ static void case_fmt_escapes_the_rest(void) {
277 size_t n; 277 size_t n;
278 278
279 test_case("everything else becomes a percent escape"); 279 test_case("everything else becomes a percent escape");
280 n = fmt_urlencoded(dest, src, sizeof(src)); 280 n = urlencoded_format(dest, src, sizeof(src));
281 dest[n] = 0; 281 dest[n] = 0;
282 CHECK_INT(n, 18); 282 CHECK_INT(n, 18);
283 CHECK_STR(dest, "%20%25%26%2b%3a%3f"); 283 CHECK_STR(dest, "%20%25%26%2b%3a%3f");
@@ -289,7 +289,7 @@ static void case_fmt_hex_is_lower_case(void) {
289 size_t n; 289 size_t n;
290 290
291 test_case("escapes use lower case hex digits"); 291 test_case("escapes use lower case hex digits");
292 n = fmt_urlencoded(dest, src, sizeof(src)); 292 n = urlencoded_format(dest, src, sizeof(src));
293 dest[n] = 0; 293 dest[n] = 0;
294 CHECK_INT(n, 9); 294 CHECK_INT(n, 9);
295 CHECK_STR(dest, "%00%ab%ff"); 295 CHECK_STR(dest, "%00%ab%ff");
@@ -300,7 +300,7 @@ static void case_fmt_zero_length(void) {
300 300
301 test_case("a zero length input writes nothing"); 301 test_case("a zero length input writes nothing");
302 memset(dest, 0x5a, sizeof(dest)); 302 memset(dest, 0x5a, sizeof(dest));
303 CHECK_INT(fmt_urlencoded(dest, (const uint8_t *)"abc", 0), 0); 303 CHECK_INT(urlencoded_format(dest, (const uint8_t *)"abc", 0), 0);
304 CHECK_MEM(dest, "\x5a\x5a\x5a\x5a", 4); 304 CHECK_MEM(dest, "\x5a\x5a\x5a\x5a", 4);
305} 305}
306 306
@@ -312,7 +312,7 @@ static void case_fmt_worst_case_fits(void) {
312 test_case("a hash of entirely unsafe bytes needs three times its length"); 312 test_case("a hash of entirely unsafe bytes needs three times its length");
313 for (i = 0; i < sizeof(src); ++i) 313 for (i = 0; i < sizeof(src); ++i)
314 src[i] = 0xff; 314 src[i] = 0xff;
315 n = fmt_urlencoded(dest, src, sizeof(src)); 315 n = urlencoded_format(dest, src, sizeof(src));
316 dest[n] = 0; 316 dest[n] = 0;
317 CHECK_INT(n, 60); 317 CHECK_INT(n, 60);
318 for (i = 0; i < 20; ++i) 318 for (i = 0; i < 20; ++i)
@@ -338,7 +338,7 @@ static void case_fmt_decoder_disagrees_on_dollar(void) {
338 ssize_t got; 338 ssize_t got;
339 339
340 test_case("the encoder passes '$' but the decoder rejects it"); 340 test_case("the encoder passes '$' but the decoder rejects it");
341 n = fmt_urlencoded(dest, src, sizeof(src)); 341 n = urlencoded_format(dest, src, sizeof(src));
342 dest[n] = 0; 342 dest[n] = 0;
343 CHECK_STR(dest, "a$b"); 343 CHECK_STR(dest, "a$b");
344 344
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 @@
13#include "trackerlogic.h" 13#include "trackerlogic.h"
14#include "test.h" 14#include "test.h"
15 15
16/* binary_search returns the matching member when there is one, and otherwise 16/* vector_binary_search returns the matching member when there is one, and otherwise
17 the position at which the key would have to be inserted to keep the vector 17 the position at which the key would have to be inserted to keep the vector
18 sorted. exactmatch distinguishes the two. */ 18 sorted. exactmatch distinguishes the two. */
19 19
@@ -25,7 +25,7 @@ static void case_search_finds_member(void) {
25 void *found; 25 void *found;
26 26
27 test_case("an existing key is found"); 27 test_case("an existing key is found");
28 found = binary_search(key, sorted, 5, 4, 4, &exactmatch); 28 found = vector_binary_search(key, sorted, 5, 4, 4, &exactmatch);
29 CHECK(exactmatch != 0); 29 CHECK(exactmatch != 0);
30 CHECK_PTR(found, sorted[2]); 30 CHECK_PTR(found, sorted[2]);
31} 31}
@@ -36,9 +36,9 @@ static void case_search_finds_first_and_last(void) {
36 int exactmatch; 36 int exactmatch;
37 37
38 test_case("the first and last members are found"); 38 test_case("the first and last members are found");
39 CHECK_PTR(binary_search(first, sorted, 5, 4, 4, &exactmatch), sorted[0]); 39 CHECK_PTR(vector_binary_search(first, sorted, 5, 4, 4, &exactmatch), sorted[0]);
40 CHECK(exactmatch != 0); 40 CHECK(exactmatch != 0);
41 CHECK_PTR(binary_search(last, sorted, 5, 4, 4, &exactmatch), sorted[4]); 41 CHECK_PTR(vector_binary_search(last, sorted, 5, 4, 4, &exactmatch), sorted[4]);
42 CHECK(exactmatch != 0); 42 CHECK(exactmatch != 0);
43} 43}
44 44
@@ -49,11 +49,11 @@ static void case_search_insert_position(void) {
49 void *slot; 49 void *slot;
50 50
51 test_case("a missing key yields its insert position"); 51 test_case("a missing key yields its insert position");
52 slot = binary_search(middle, sorted, 5, 4, 4, &exactmatch); 52 slot = vector_binary_search(middle, sorted, 5, 4, 4, &exactmatch);
53 CHECK_INT(exactmatch, 0); 53 CHECK_INT(exactmatch, 0);
54 CHECK_PTR(slot, sorted[2]); 54 CHECK_PTR(slot, sorted[2]);
55 55
56 slot = binary_search(before, sorted, 5, 4, 4, &exactmatch); 56 slot = vector_binary_search(before, sorted, 5, 4, 4, &exactmatch);
57 CHECK_INT(exactmatch, 0); 57 CHECK_INT(exactmatch, 0);
58 CHECK_PTR(slot, sorted[0]); 58 CHECK_PTR(slot, sorted[0]);
59} 59}
@@ -64,7 +64,7 @@ static void case_search_past_the_end(void) {
64 void *slot; 64 void *slot;
65 65
66 test_case("a key above every member yields the position past the end"); 66 test_case("a key above every member yields the position past the end");
67 slot = binary_search(beyond, sorted, 5, 4, 4, &exactmatch); 67 slot = vector_binary_search(beyond, sorted, 5, 4, 4, &exactmatch);
68 CHECK_INT(exactmatch, 0); 68 CHECK_INT(exactmatch, 0);
69 CHECK_PTR(slot, sorted[5]); 69 CHECK_PTR(slot, sorted[5]);
70} 70}
@@ -74,7 +74,7 @@ static void case_search_empty(void) {
74 void *base = (void *)sorted; 74 void *base = (void *)sorted;
75 75
76 test_case("searching an empty vector reports no match at the base"); 76 test_case("searching an empty vector reports no match at the base");
77 CHECK_PTR(binary_search(sorted[0], base, 0, 4, 4, &exactmatch), base); 77 CHECK_PTR(vector_binary_search(sorted[0], base, 0, 4, 4, &exactmatch), base);
78 CHECK_INT(exactmatch, 0); 78 CHECK_INT(exactmatch, 0);
79} 79}
80 80