diff --git a/tests/src/array/src/io.c b/tests/src/array/src/io.c index 127eaec..cb2077d 100644 --- a/tests/src/array/src/io.c +++ b/tests/src/array/src/io.c @@ -3,8 +3,8 @@ #include "../plug.h" -static int array_value_print(void* v, ssize_t i, vtype t, void* _) { - print_container_value(&i, v, t, 1, *(unsigned int*)_); +static int array_value_print(vtype_variable v, ssize_t i, void* _) { + print_container_value(&i, v.pointer, v.type, 1, *(unsigned int*)_); return 0; } diff --git a/tests/src/array/src/random.c b/tests/src/array/src/random.c index be9de57..300959b 100644 --- a/tests/src/array/src/random.c +++ b/tests/src/array/src/random.c @@ -3,21 +3,21 @@ #include "../plug.h" -static int remove_callback(void* v, ssize_t i, vtype t, void* _) { +static int remove_callback(vtype_variable v, ssize_t i, void* _) { struct { arr_t* x; _Bool s; unsigned int p; } *x = _; - if (!x->s) print_container_value(0, v, t, 1, x->p); + if (!x->s) print_container_value(0, v.pointer, v.type, 1, x->p); - if (libcdsb_array_find(x->x, v, t, 0, 0, 1, 1)) + if (libcdsb_array_find(x->x, libcdsb_variable_build(v.pointer, v.type), 0, 0, 1, 1)) return -2; return 0; } -static int change_callback(void* v, ssize_t i, vtype t, void* _) { +static int change_callback(vtype_variable v, ssize_t i, void* _) { struct { value_t v; _Bool s; unsigned int p; } *x = _; - while (x->v.type != t) { x->v = random_value(); } + while (x->v.type != v.type) { x->v = random_value(); } - memcpy(v, &x->v, vtype_size(t)); + memcpy(v.pointer, &x->v, vtype_size(v.type)); return 0; } @@ -31,7 +31,7 @@ void array_push_random(arr_t* x, _Bool silent, unsigned int hpos) { printf("\e[%dG\e[36mTry to push value to back of the array:\e[m\n", hpos+1); } - r = libcdsb_array_insert(x, _.v.value, _.v.type) >= 0; + r = libcdsb_array_insert(x, libcdsb_variable_build(_.v.value, _.v.type)) >= 0; } else { ssize_t i = array_size(x); diff --git a/tests/src/dict/src/io.c b/tests/src/dict/src/io.c index d0c4336..92994e9 100644 --- a/tests/src/dict/src/io.c +++ b/tests/src/dict/src/io.c @@ -3,8 +3,8 @@ #include "../plug.h" -static int node_print_callback(const void* k, vtype kt, void* v, vtype vt, void* _) { - print_container_value(0, k, kt, 0, *(unsigned int*)_); +static int node_print_callback(vtype_variable k, vtype_variable v, void* _) { + print_container_value(0, k.pointer, k.type, 0, *(unsigned int*)_); return 0; } diff --git a/tests/src/dict/src/random.c b/tests/src/dict/src/random.c index 1149260..303243e 100644 --- a/tests/src/dict/src/random.c +++ b/tests/src/dict/src/random.c @@ -3,13 +3,13 @@ #include "../plug.h" -static int remove_callback(const void* k, vtype kt, void* v, vtype vt, void* _) { +static int remove_callback(vtype_variable k, vtype_variable v, void* _) { struct { size_t n; dict_t* x; unsigned int hp; } *d = _; if (!d->n--) { - print_container_value(0, k, kt, 0, d->hp); + print_container_value(0, k.pointer, k.type, 0, d->hp); - if (libcdsb_dict_find(d->x, k, kt, 0, 0, 1) == 0) { + if (libcdsb_dict_find(d->x, k, 0, 0, 1) == 0) { printf("\e[%dG\e[32;1mSUCCESS\e[m\n", d->hp+1); } else printf("\e[%dG\e[31;1mFAILURE\e[m\n", d->hp+1); @@ -28,7 +28,7 @@ void dict_push_random(dict_t* x, _Bool silent, unsigned int hpos) { print_container_value(0, k.value, k.type, 1, hpos); } - if (libcdsb_dict_update(x, k.value, k.type, v.value, v.type)) { + if (libcdsb_dict_update(x, libcdsb_variable_build(k.value, k.type), libcdsb_variable_build(v.value, v.type), 0, 0)) { if (!silent) printf("\e[%dG\e[33;1mCHANGE\e[m\n", hpos+1); } else if (!silent) printf("\e[%dG\e[32;1mINSERT\e[m\n", hpos+1); diff --git a/tests/src/global/src/random.c b/tests/src/global/src/random.c index cef5267..3b60b16 100644 --- a/tests/src/global/src/random.c +++ b/tests/src/global/src/random.c @@ -84,7 +84,7 @@ static arr_t random_array(bool embd) { while(n--) { - libcdsb_array_insert(&x, v.value, v.type); + libcdsb_array_insert(&x, libcdsb_variable_build(v.value, v.type)); switch (v.type) { default: break; @@ -121,7 +121,7 @@ static set_t random_set(bool embd) { while(n--) { - libcdsb_vset_insert(&x, v.value, v.type); + libcdsb_vset_insert(&x, libcdsb_variable_build(v.value, v.type)); switch (v.type) { default: break; @@ -158,7 +158,7 @@ static list_t random_list(bool embd) { while(n--) { v = (!embd) ? random_value2() : real_random_value(1); - libcdsb_list_insert(&x, -1, v.value, v.type, 1); + libcdsb_list_insert(&x, -1, libcdsb_variable_build(v.value, v.type), 1, 0, 0); switch (v.type) { default: break; @@ -184,7 +184,7 @@ static map_t random_map(bool embd) { while(n--) { value_t v = (!embd) ? random_value2() : real_random_value(1); - libcdsb_map_update(&x, k.value, k.type, v.value, v.type); + libcdsb_map_update(&x, libcdsb_variable_build(k.value, k.type), libcdsb_variable_build(v.value, v.type), 0, 0); switch (k.type) { default: break; @@ -233,7 +233,7 @@ static dict_t random_dict(bool embd) { while(n--) { k = (!embd) ? random_value2() : real_random_value(1); v = (!embd) ? random_value2() : real_random_value(1); - libcdsb_dict_update(&x, k.value, k.type, v.value, v.type); + libcdsb_dict_update(&x, libcdsb_variable_build(k.value, k.type), libcdsb_variable_build(v.value, v.type), 0, 0); switch (v.type) { default: break; diff --git a/tests/src/list/src/io.c b/tests/src/list/src/io.c index fb61586..0963ebb 100644 --- a/tests/src/list/src/io.c +++ b/tests/src/list/src/io.c @@ -3,8 +3,8 @@ #include "../plug.h" -static int list_node_print(void* v, ssize_t i, vtype t, void* _) { - print_container_value(&i, v, t, 1, *(unsigned int*)_); +static int list_node_print(vtype_variable v, ssize_t i, void* _) { + print_container_value(&i, v.pointer, v.type, 1, *(unsigned int*)_); return 0; } diff --git a/tests/src/list/src/random.c b/tests/src/list/src/random.c index 504c5ad..603ad9c 100644 --- a/tests/src/list/src/random.c +++ b/tests/src/list/src/random.c @@ -3,13 +3,13 @@ #include "../plug.h" -static int remove_callback(void* v, ssize_t i, vtype t, void* _) { +static int remove_callback(vtype_variable v, ssize_t i, void* _) { struct { list_t* x; _Bool s; unsigned int p; } *x = _; if (!x->s) { - print_container_value(0, v, t, 1, x->p); + print_container_value(0, v.pointer, v.type, 1, x->p); } - if (libcdsb_list_find(x->x, v, t, 0, 0, 1, 1)) { + if (libcdsb_list_find(x->x, libcdsb_variable_build(v.pointer, v.type), 0, 0, 1, 1)) { return -2; } @@ -26,12 +26,12 @@ void list_push_random(list_t* x, _Bool silent, unsigned int hpos) { if (!silent) { printf("\e[%dG\e[36mTry to push value to back of the list:\e[m\n", hpos+1); } - r = libcdsb_list_insert(x, -1, v.value, v.type, 1); + r = libcdsb_list_insert(x, -1, libcdsb_variable_build(v.value, v.type), 1, 0, 0); } else if (random_boolean()) { if (!silent) { printf("\e[%dG\e[36mTry to push value to front of the list:\e[m\n", hpos+1); } - r = libcdsb_list_insert(x, -1, v.value, v.type, 1); + r = libcdsb_list_insert(x, -1, libcdsb_variable_build(v.value, v.type), 1, 0, 0); } else { ssize_t i = list_size(x); i = random_uint64()% (i ? i : 1); @@ -41,7 +41,7 @@ void list_push_random(list_t* x, _Bool silent, unsigned int hpos) { printf("\e[%dG\e[36mTry to change value with index \e[32;1m%ld\e[36m in the list:\e[m\n", hpos+1, i); } - r = libcdsb_list_insert(x, i, v.value, v.type, 0); + r = libcdsb_list_insert(x, i, libcdsb_variable_build(v.value, v.type), 0, 0, 0); } if (!silent) { diff --git a/tests/src/map/src/io.c b/tests/src/map/src/io.c index a01da4b..0ca2090 100644 --- a/tests/src/map/src/io.c +++ b/tests/src/map/src/io.c @@ -3,8 +3,8 @@ #include "../plug.h" -static int node_print_callback(const void* k, vtype kt, void* v, vtype vt, void* _) { - print_container_value(0, k, kt, 0, *(unsigned int*)_); +static int node_print_callback(vtype_variable k, vtype_variable v, void* _) { + print_container_value(0, k.pointer, k.type, 0, *(unsigned int*)_); return 0; } diff --git a/tests/src/map/src/random.c b/tests/src/map/src/random.c index c4615f2..5088196 100644 --- a/tests/src/map/src/random.c +++ b/tests/src/map/src/random.c @@ -3,13 +3,13 @@ #include "../plug.h" -static int remove_callback(const void* k, vtype kt, void* v, vtype vt, void* _) { +static int remove_callback(vtype_variable k, vtype_variable v, void* _) { struct { size_t n; map_t* x; unsigned int hp; } *d = _; if (!d->n--) { - print_container_value(0, k, kt, 0, d->hp); + print_container_value(0, k.pointer, k.type, 0, d->hp); - if (libcdsb_map_find(d->x, k, kt, 0, 0, 1) == 0) { + if (libcdsb_map_find(d->x, libcdsb_variable_build(k.pointer, k.type), 0, 0, 1) == 0) { printf("\e[%dG\e[32;1mSUCCESS\e[m\n", d->hp+1); } else printf("\e[%dG\e[31;1mFAILURE\e[m\n", d->hp+1); @@ -28,7 +28,7 @@ void map_push_random(map_t* x, _Bool silent, unsigned int hpos) { print_container_value(0, k.value, k.type, 1, hpos); } - if (libcdsb_map_update(x, k.value, k.type, v.value, v.type)) { + if (libcdsb_map_update(x, libcdsb_variable_build(k.value, k.type), libcdsb_variable_build(v.value, v.type), 0, 0)) { if (!silent) printf("\e[%dG\e[33;1mCHANGE\e[m\n", hpos+1); } else if (!silent) printf("\e[%dG\e[32;1mINSERT\e[m\n", hpos+1); diff --git a/tests/src/set/src/io.c b/tests/src/set/src/io.c index 378aaf6..a9de5b9 100644 --- a/tests/src/set/src/io.c +++ b/tests/src/set/src/io.c @@ -4,8 +4,8 @@ #include "../plug.h" -static int node_print_callback(const void* v, vtype t, void* _) { - print_container_value(0, v, t, 0, *(unsigned int*)_); +static int node_print_callback(vtype_variable v, void* _) { + print_container_value(0, v.pointer, v.type, 0, *(unsigned int*)_); return 0; } diff --git a/tests/src/set/src/random.c b/tests/src/set/src/random.c index dc6d6d5..9777371 100644 --- a/tests/src/set/src/random.c +++ b/tests/src/set/src/random.c @@ -3,13 +3,13 @@ #include "../plug.h" -static int remove_callback(const void* v, vtype t, void* _) { +static int remove_callback(vtype_variable v, void* _) { struct { size_t n; set_t* x; unsigned int hp; } *d = _; if (!d->n--) { - print_container_value(0, v, t, 0, d->hp); + print_container_value(0, v.pointer, v.type, 0, d->hp); - if (libcdsb_vset_find(d->x, v, t, 0, 0, 1) == 0) { + if (libcdsb_vset_find(d->x, v, 0, 0, 1) == 0) { printf("\e[%dG\e[32;1mSUCCESS\e[m\n", d->hp+1); } else printf("\e[%dG\e[31;1mFAILURE\e[m\n", d->hp+1); @@ -27,7 +27,7 @@ void vset_push_random(set_t* x, _Bool silent, unsigned int hpos) { print_container_value(0, v.value, v.type, 1, hpos); } - if (libcdsb_vset_insert(x, v.value, v.type)) { + if (libcdsb_vset_insert(x, libcdsb_variable_build(v.value, v.type))) { if (!silent) printf("\e[%dG\e[32;1mSUCCESS\e[m\n", hpos+1); } else if (!silent) printf("\e[%dG\e[31;1mFAILURE\e[m\n", hpos+1);