From 4056544d49a80fa7ac8dc351f99548b4dbc88e99 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Tue, 16 Aug 2022 18:36:50 +0300 Subject: [PATCH] Update tests headers --- tests/src/array/plug.h | 69 ----------------------------------------- tests/src/dict/plug.h | 12 +++---- tests/src/list/src/io.c | 1 - tests/src/map/plug.h | 14 ++++----- 4 files changed, 13 insertions(+), 83 deletions(-) diff --git a/tests/src/array/plug.h b/tests/src/array/plug.h index 254611a..f852e45 100644 --- a/tests/src/array/plug.h +++ b/tests/src/array/plug.h @@ -9,7 +9,6 @@ #include "../../include/test.h" #include "../../include/time.h" - extern void array_print(arr_t* x, const char* prefix, unsigned int hpos); extern void array_info(arr_t* x, unsigned int hpos); @@ -23,71 +22,3 @@ extern void visual_slice(arr_t* x, arr_t* s); extern void array_push_random (arr_t* x, _Bool silent, unsigned int hpos); extern void array_remove_random(arr_t* x, _Bool silent, unsigned int hpos); - -/* -static void array_push_random(vtype_array* x) { - switch (random_uint8()%13) { - default: - case 0: array_push(x, random_boolean()); break; - case 1: array_push(x, random_uint8()); break; - case 2: array_push(x, random_uint16()); break; - case 3: array_push(x, random_uint32()); break; - case 4: array_push(x, random_uint64()); break; - case 5: array_push(x, random_int8()); break; - case 6: array_push(x, random_int16()); break; - case 7: array_push(x, random_int32()); break; - case 8: array_push(x, random_int64()); break; - case 9: array_push(x, (void*)((sizeof(void*) == 8) ? random_uint64() : random_uint32())); break; - case 10: array_push(x, random_float()); break; - case 11: array_push(x, random_double()); break; - case 12: array_push(x, random_ldouble()); break; - } -} - -static void array_init_random(vtype_array* x) { - switch (random_uint8()%13) { - default: - case 0: array_init(x, VTYPE_BOOLEAN); break; - case 1: array_init(x, VTYPE_UINT8); break; - case 2: array_init(x, VTYPE_UINT16); break; - case 3: array_init(x, VTYPE_UINT32); break; - case 4: array_init(x, VTYPE_UINT64); break; - case 5: array_init(x, VTYPE_INT8); break; - case 6: array_init(x, VTYPE_INT16); break; - case 7: array_init(x, VTYPE_INT32); break; - case 8: array_init(x, VTYPE_INT64); break; - case 9: array_init(x, VTYPE_POINTER); break; - case 10: array_init(x, VTYPE_FLOAT); break; - case 11: array_init(x, VTYPE_DOUBLE); break; - case 12: array_init(x, VTYPE_LDOUBLE); break; - } -} - -static vtype_array array_random(unsigned int n) { - vtype_array x; - - array_init_random(&x); - - for (int i = 0; i < n; ++i) { - array_push_random(&x); - } - - return x; -} - -static int array_value_print(void* v, ssize_t i, vtype t, void* _) { - print_container_value(&i, v, t, false); - return 0; -} - -static void array_print(vtype_array* x, const char* prefix) { - print_container_values_prefix("Array", prefix); - array_foreach(x, 0, array_value_print); - put_separator(); -} - -static void array_info(const vtype_array* x) { - print_container_info("Array", 0, &x->type, array_size(x), array_nmemb(x)); - put_separator(); -} -*/ diff --git a/tests/src/dict/plug.h b/tests/src/dict/plug.h index 57f84dc..e6b73db 100644 --- a/tests/src/dict/plug.h +++ b/tests/src/dict/plug.h @@ -7,11 +7,11 @@ #include "../../include/test.h" #include "../../include/time.h" -void dict_push_random(dict_t* x, bool silent, unsigned int hpos); -void dict_remove_random(dict_t* x, bool silent, unsigned int hpos); +extern void dict_push_random(dict_t* x, bool silent, unsigned int hpos); +extern void dict_remove_random(dict_t* x, bool silent, unsigned int hpos); -void dict_print(dict_t* x, const char* prefix, unsigned int hpos); -void dict_info(const dict_t* x, unsigned int hpos); +extern void dict_info(const dict_t* x, unsigned int hpos); +extern void dict_print(dict_t* x, const char* prefix, unsigned int hpos); -void visual_push(dict_t* x, size_t n); -void visual_remove(dict_t* x); +extern void visual_push(dict_t* x, size_t n); +extern void visual_remove(dict_t* x); diff --git a/tests/src/list/src/io.c b/tests/src/list/src/io.c index 793ae33..fb61586 100644 --- a/tests/src/list/src/io.c +++ b/tests/src/list/src/io.c @@ -17,7 +17,6 @@ void list_info(list_t* x, unsigned int hpos) { print_container_info("List", "nodes", 0, list_size(x), -1, hpos); } - void visual_push(list_t* x, size_t n) { for (int i = 0; i < n; ++i) { fputs("\e[s", stdout); diff --git a/tests/src/map/plug.h b/tests/src/map/plug.h index a2ae449..da2aeed 100644 --- a/tests/src/map/plug.h +++ b/tests/src/map/plug.h @@ -7,12 +7,12 @@ #include "../../include/test.h" #include "../../include/time.h" -void map_push_random(map_t* x, _Bool silent, unsigned int hpos); -void map_remove_random(map_t* x, _Bool silent, unsigned int hpos); +extern void map_push_random(map_t* x, _Bool silent, unsigned int hpos); +extern void map_remove_random(map_t* x, _Bool silent, unsigned int hpos); -void map_print(map_t* x, const char* prefix, unsigned int hpos); -void map_info(const map_t* x, unsigned int hpos); -void map_rbtree_print(map_t *x, const char* prefix, unsigned int hpos); +extern void map_info(const map_t* x, unsigned int hpos); +extern void map_print(map_t* x, const char* prefix, unsigned int hpos); +extern void map_rbtree_print(map_t *x, const char* prefix, unsigned int hpos); -void visual_push(map_t* x, size_t n); -void visual_remove(map_t* x); +extern void visual_push(map_t* x, size_t n); +extern void visual_remove(map_t* x);