aboutsummaryrefslogtreecommitdiffstats
path: root/test_list.c
diff options
context:
space:
mode:
authorJP Appel <jeanpierre.appel01@gmail.com>2024-07-22 15:20:23 -0400
committerJP Appel <jeanpierre.appel01@gmail.com>2024-07-22 15:20:23 -0400
commite2287cfe1b7208cdf046abef139c9426351ddbba (patch)
tree49b5e8ea8b4e2f0228a3f73a281af99a2d2d292c /test_list.c
parent6fe107fc27b9a900b20960335e15e4b90f93eb73 (diff)
renamed file and log function
Diffstat (limited to 'test_list.c')
-rw-r--r--test_list.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/test_list.c b/test_list.c
deleted file mode 100644
index bac6fc2..0000000
--- a/test_list.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "eztester.h"
-
-#include <assert.h>
-#include <stdlib.h>
-
-eztester_list *eztester_create_list(const size_t capacity) {
- eztester_list *list = malloc(sizeof(eztester_list));
- if (!list) {
- return NULL;
- }
-
- list->length = 0;
-
- if (capacity == 0) {
- list->tests = NULL;
- list->capacity = 0;
- return list;
- }
-
- eztester_test *tests = malloc(capacity * sizeof(eztester_test));
- if (!tests) {
- free(list);
- return NULL;
- }
- list->tests = tests;
-
- list->capacity = capacity;
- return list;
-}
-
-void eztester_register(eztester_list *test_list, const eztester_test new_test) {
- if (test_list->capacity == 0) {
- test_list->tests = realloc(test_list->tests, 2 * sizeof(eztester_test));
- test_list->capacity = 2;
- }
- if (test_list->capacity <= test_list->length + 1) {
- test_list->capacity *= 2;
- test_list->tests =
- realloc(test_list->tests, test_list->capacity * sizeof(eztester_test));
- assert(test_list->tests);
- }
-
- test_list->tests[test_list->length++] = new_test;
-}
-
-void eztester_clear_list(eztester_list *test_list) {
- free(test_list->tests);
- test_list->length = 0;
- test_list->capacity = 0;
-}
-
-void eztester_destroy_list(eztester_list *test_list) {
- eztester_clear_list(test_list);
- free(test_list);
-}