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_vector.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'tests/t_vector.c') 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