summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-06-04 14:52:57 -0400
committerJonathan Bradley <jcb@pikum.xyz>2025-06-04 14:52:57 -0400
commit61cd9162df6424d3a4f427daa1d69476b913aca6 (patch)
tree3d499cd23955e5cac9d172ba7dd500657314406d
parent08d54867148420da3bd7ce531beaeb34de975fcb (diff)
pkmem.h: resolve breaking changes in other tests
-rw-r--r--test/pkarr.cpp12
-rw-r--r--test/pkbktarr.c104
-rw-r--r--test/pkbktarr.cpp32
3 files changed, 74 insertions, 74 deletions
diff --git a/test/pkarr.cpp b/test/pkarr.cpp
index 77cf9f4..600b38f 100644
--- a/test/pkarr.cpp
+++ b/test/pkarr.cpp
@@ -14,7 +14,7 @@
void
test_spinup(struct pk_membucket **bkt)
{
- *bkt = pk_bucket_create("test", 1024 * 1024, false);
+ *bkt = pk_bucket_create("test", 1024 * 1024, PK_MEMBUCKET_FLAG_NONE);
}
void
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
pk_arr_reset(&arr);
}
- if (bkt->allocs != 0) exit(1);
+ if (bkt->alloc_count != 0) exit(1);
fprintf(stdout, "[%s] dtor called.\n", __FILE__);
fprintf(stdout, "[%s] Ending append test\n\n", __FILE__);
test_teardown(&bkt);
@@ -83,7 +83,7 @@ int main(int argc, char *argv[])
pk_arr_reset(&arr1);
pk_arr_reset(&arr2);
}
- if (bkt->allocs != 0) exit(1);
+ if (bkt->alloc_count != 0) exit(1);
fprintf(stdout, "[%s] dtor called.\n", __FILE__);
fprintf(stdout, "[%s] Ending copy ctor test\n\n", __FILE__);
test_teardown(&bkt);
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
pk_arr_reset(&arr1);
pk_arr_reset(&arr2);
}
- if (bkt->allocs != 0) exit(1);
+ if (bkt->alloc_count != 0) exit(1);
fprintf(stdout, "[%s] dtor called.\n", __FILE__);
fprintf(stdout, "[%s] Ending move ctor test\n\n", __FILE__);
test_teardown(&bkt);
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
pk_arr_reset(&arr1);
pk_arr_reset(&arr2);
}
- if (bkt->allocs != 0) exit(1);
+ if (bkt->alloc_count != 0) exit(1);
fprintf(stdout, "[%s] dtor called.\n", __FILE__);
fprintf(stdout, "[%s] Ending copy assignment test\n\n", __FILE__);
test_teardown(&bkt);
@@ -150,7 +150,7 @@ int main(int argc, char *argv[])
pk_arr_reset(&arr1);
pk_arr_reset(&arr2);
}
- if (bkt->allocs != 0) exit(1);
+ if (bkt->alloc_count != 0) exit(1);
fprintf(stdout, "[%s] dtor called.\n", __FILE__);
fprintf(stdout, "[%s] Ending move assignment test\n\n", __FILE__);
test_teardown(&bkt);
diff --git a/test/pkbktarr.c b/test/pkbktarr.c
index cb39651..ef8a78f 100644
--- a/test/pkbktarr.c
+++ b/test/pkbktarr.c
@@ -120,20 +120,20 @@ int main(int argc, char *argv[])
if (arr.head_l.i != 1) exit(1);
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 1) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
pk_bkt_arr_free_handle(&arr, h);
if (arr.head_l.b != 0) exit(1);
if (arr.head_l.i != 0) exit(1);
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 1) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
pk_bkt_arr_teardown(&arr);
- if (bkt_buckets->allocs != 0) exit(1);
- if (bkt_data->allocs != 0) exit(1);
+ if (bkt_buckets->alloc_count != 0) exit(1);
+ if (bkt_data->alloc_count != 0) exit(1);
}
test_teardown(&bkt_buckets, &bkt_data);
@@ -152,16 +152,16 @@ int main(int argc, char *argv[])
if (arr.head_l.i != 1) exit(1);
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 1) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
pk_bkt_arr_clear(&arr);
if (arr.head_l.b != 0) exit(1);
if (arr.head_l.i != 0) exit(1);
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 0) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
h = pk_bkt_arr_new_handle(&arr);
if (h.b != 0) exit(1);
@@ -170,12 +170,12 @@ int main(int argc, char *argv[])
if (arr.head_l.i != 1) exit(1);
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 1) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
pk_bkt_arr_teardown(&arr);
- if (bkt_buckets->allocs != 0) exit(1);
- if (bkt_data->allocs != 0) exit(1);
+ if (bkt_buckets->alloc_count != 0) exit(1);
+ if (bkt_data->alloc_count != 0) exit(1);
}
test_teardown(&bkt_buckets, &bkt_data);
@@ -194,8 +194,8 @@ int main(int argc, char *argv[])
if (arr.head_l.i != 1) exit(1);
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 1) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
int val = 69;
((int**)arr.bucketed_data)[h.b][h.i] = val;
@@ -203,8 +203,8 @@ int main(int argc, char *argv[])
if (pk_bkt_arr_handle_compare(h, found_h) != 0) exit(1);
pk_bkt_arr_teardown(&arr);
- if (bkt_buckets->allocs != 0) exit(1);
- if (bkt_data->allocs != 0) exit(1);
+ if (bkt_buckets->alloc_count != 0) exit(1);
+ if (bkt_data->alloc_count != 0) exit(1);
}
test_teardown(&bkt_buckets, &bkt_data);
@@ -223,15 +223,15 @@ int main(int argc, char *argv[])
if (arr.head_l.i != 1) exit(1);
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 1) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
pk_bkt_arr_iterate(&arr, iter, NULL);
if (global_counter != 1) exit(1);
pk_bkt_arr_teardown(&arr);
- if (bkt_buckets->allocs != 0) exit(1);
- if (bkt_data->allocs != 0) exit(1);
+ if (bkt_buckets->alloc_count != 0) exit(1);
+ if (bkt_data->alloc_count != 0) exit(1);
}
test_teardown(&bkt_buckets, &bkt_data);
@@ -255,8 +255,8 @@ int main(int argc, char *argv[])
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 2) exit(1);
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFFFC) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
pk_bkt_arr_free_handle(&arr, h1);
if (arr.head_l.b != 0) exit(1);
@@ -264,8 +264,8 @@ int main(int argc, char *argv[])
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 2) exit(1);
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFFFD) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
h2 = pk_bkt_arr_new_handle(&arr);
if (h2.b != 0) exit(1);
@@ -275,12 +275,12 @@ int main(int argc, char *argv[])
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 2) exit(1);
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFFFC) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
pk_bkt_arr_teardown(&arr);
- if (bkt_buckets->allocs != 0) exit(1);
- if (bkt_data->allocs != 0) exit(1);
+ if (bkt_buckets->alloc_count != 0) exit(1);
+ if (bkt_data->alloc_count != 0) exit(1);
}
test_teardown(&bkt_buckets, &bkt_data);
@@ -312,8 +312,8 @@ int main(int argc, char *argv[])
if (arr.head_r.i != i + 1) exit(1);
}
if (arr.reserved_buckets != 1) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
}
h1 = pk_bkt_arr_new_handle(&arr);
@@ -326,8 +326,8 @@ int main(int argc, char *argv[])
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFF00) exit(1);
if (arr.idx_unused[1] != 0xFFFFFFFFFFFFFFFE) exit(1);
if (arr.reserved_buckets != 2) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 2) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 2) exit(1);
h1 = pk_bkt_arr_new_handle(&arr);
if (h1.b != 1) exit(1);
@@ -339,8 +339,8 @@ int main(int argc, char *argv[])
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFF00) exit(1);
if (arr.idx_unused[1] != 0xFFFFFFFFFFFFFFFC) exit(1);
if (arr.reserved_buckets != 2) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 2) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 2) exit(1);
h1.b = 0;
h1.i = 3;
@@ -352,8 +352,8 @@ int main(int argc, char *argv[])
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFF08) exit(1);
if (arr.idx_unused[1] != 0xFFFFFFFFFFFFFFFC) exit(1);
if (arr.reserved_buckets != 2) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 2) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 2) exit(1);
h2 = pk_bkt_arr_new_handle(&arr);
if (h2.b != 0) exit(1);
@@ -365,8 +365,8 @@ int main(int argc, char *argv[])
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFF00) exit(1);
if (arr.idx_unused[1] != 0xFFFFFFFFFFFFFFFC) exit(1);
if (arr.reserved_buckets != 2) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 2) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 2) exit(1);
h1.b = 1;
h1.i = 0;
@@ -381,8 +381,8 @@ int main(int argc, char *argv[])
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFF00) exit(1);
if (arr.idx_unused[1] != 0xFFFFFFFFFFFFFFFF) exit(1);
if (arr.reserved_buckets != 2) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 2) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 2) exit(1);
h2 = pk_bkt_arr_new_handle(&arr);
if (h2.b != 1) exit(1);
@@ -394,12 +394,12 @@ int main(int argc, char *argv[])
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFF00) exit(1);
if (arr.idx_unused[1] != 0xFFFFFFFFFFFFFFFE) exit(1);
if (arr.reserved_buckets != 2) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 2) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 2) exit(1);
pk_bkt_arr_teardown(&arr);
- if (bkt_buckets->allocs != 0) exit(1);
- if (bkt_data->allocs != 0) exit(1);
+ if (bkt_buckets->alloc_count != 0) exit(1);
+ if (bkt_data->alloc_count != 0) exit(1);
}
test_teardown(&bkt_buckets, &bkt_data);
@@ -444,8 +444,8 @@ int main(int argc, char *argv[])
if (arr.head_l.i != 7) exit(1);
if (arr.head_r.b != 1) exit(1);
if (arr.head_r.i != 7) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 2) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 2) exit(1);
expected_exit = true;
caught = false;
@@ -459,12 +459,12 @@ int main(int argc, char *argv[])
if (arr.head_l.i != 0) exit(1);
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 1) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
pk_bkt_arr_teardown(&arr);
- if (bkt_buckets->allocs != 0) exit(1);
- if (bkt_data->allocs != 0) exit(1);
+ if (bkt_buckets->alloc_count != 0) exit(1);
+ if (bkt_data->alloc_count != 0) exit(1);
*/
}
while (false);
diff --git a/test/pkbktarr.cpp b/test/pkbktarr.cpp
index e315c8e..45d2ba2 100644
--- a/test/pkbktarr.cpp
+++ b/test/pkbktarr.cpp
@@ -7,8 +7,8 @@
void test_spinup(struct pk_membucket **bkt_buckets, struct pk_membucket **bkt_data)
{
- *bkt_buckets = pk_bucket_create("buckets", 1 << 16, false);
- *bkt_data = pk_bucket_create("data", 1 << 16, false);
+ *bkt_buckets = pk_bucket_create("buckets", 1 << 16, PK_MEMBUCKET_FLAG_NONE);
+ *bkt_data = pk_bucket_create("data", 1 << 16, PK_MEMBUCKET_FLAG_NONE);
}
void test_teardown(struct pk_membucket **bkt_buckets, struct pk_membucket **bkt_data)
@@ -44,8 +44,8 @@ int main(int argc, char *argv[])
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 1) exit(1);
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFFFE) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
if (arr[h] != 128) exit(1);
pk_bkt_arr_free_handle(&arr, h);
@@ -54,12 +54,12 @@ int main(int argc, char *argv[])
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 1) exit(1);
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFFFF) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
arr.~pk_bkt_arr_t<int>();
- if (bkt_buckets->allocs != 0) exit(1);
- if (bkt_data->allocs != 0) exit(1);
+ if (bkt_buckets->alloc_count != 0) exit(1);
+ if (bkt_data->alloc_count != 0) exit(1);
}
test_teardown(&bkt_buckets, &bkt_data);
@@ -80,8 +80,8 @@ int main(int argc, char *argv[])
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 1) exit(1);
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFFFE) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
if (arr[h] != val) exit(1);
using CompCbWrapper = pk_tmpln_2<bool, const int*, const int*, const void*, const void*>;
@@ -94,8 +94,8 @@ int main(int argc, char *argv[])
if (pk_bkt_arr_handle_compare(found_h, h) != 0) exit(1);
arr.~pk_bkt_arr_t<int>();
- if (bkt_buckets->allocs != 0) exit(1);
- if (bkt_data->allocs != 0) exit(1);
+ if (bkt_buckets->alloc_count != 0) exit(1);
+ if (bkt_data->alloc_count != 0) exit(1);
}
test_teardown(&bkt_buckets, &bkt_data);
@@ -116,8 +116,8 @@ int main(int argc, char *argv[])
if (arr.head_r.b != 0) exit(1);
if (arr.head_r.i != 1) exit(1);
if (arr.idx_unused[0] != 0xFFFFFFFFFFFFFFFE) exit(1);
- if (bkt_buckets->allocs != 2) exit(1);
- if (bkt_data->allocs != 1) exit(1);
+ if (bkt_buckets->alloc_count != 2) exit(1);
+ if (bkt_data->alloc_count != 1) exit(1);
if (arr[h] != val) exit(1);
int some_counter = 0;
@@ -133,8 +133,8 @@ int main(int argc, char *argv[])
if (some_counter != 1) exit(1);
arr.~pk_bkt_arr_t<int>();
- if (bkt_buckets->allocs != 0) exit(1);
- if (bkt_data->allocs != 0) exit(1);
+ if (bkt_buckets->alloc_count != 0) exit(1);
+ if (bkt_data->alloc_count != 0) exit(1);
}
test_teardown(&bkt_buckets, &bkt_data);
}