Reintroduce all tests

This commit is contained in:
Imbus 2025-09-09 10:05:44 +02:00
parent dc2bfe10a8
commit 9eb7b17a65

View file

@ -46,6 +46,8 @@ int main() {
if (!fl_check(&fl))
printf("Check failed!\n");
printf("Check: %zu\n", fl_check(&fl));
Vec3 *a = fl_alloc(&fl);
Vec3 *b = fl_alloc(&fl);
Vec3 *c = fl_alloc(&fl);
@ -64,8 +66,8 @@ int main() {
printvec(b);
printvec(c);
// assert(fl_check(&fl) == cap - 3);
// assert(fl_capacity(&fl) == fl_available(&fl) + 3);
assert(fl_check(&fl) == cap - 3);
assert(fl_capacity(&fl) == fl_available(&fl) + 3);
printf("Available: %zu of %zu\n", fl_available(&fl), fl_capacity(&fl));
@ -75,7 +77,7 @@ int main() {
printf("Available: %zu of %zu\n", fl_available(&fl), fl_capacity(&fl));
// assert(fl_check(&fl) == fl_capacity(&fl) - fl_allocated(&fl));
assert(fl_check(&fl) == fl_capacity(&fl) - fl_allocated(&fl));
assert(fl_allocated(&fl) == 0);
/* All memory is free here */
@ -93,6 +95,8 @@ int main() {
assert(0 == fl_available(&fl));
assert(fl_allocated(&fl) == fl_capacity(&fl));
printf("Check: %zu\n", fl_check(&fl));
assert(fl_check(&fl) == 0);
/* Return it all */
@ -100,9 +104,9 @@ int main() {
fl_free(&fl, (void *)ptr_buf[i]);
}
// assert(cap == fl_available(&fl));
// assert(fl_allocated(&fl) == 0);
// assert(fl_check(&fl) == cap);
assert(cap == fl_available(&fl));
assert(fl_allocated(&fl) == 0);
assert(fl_check(&fl) == cap);
printf("All tests passed!\n");
return 0;