Update list tests

This commit is contained in:
Gregory Lirent 2022-06-09 22:02:12 +03:00
parent 4d2c9e3df5
commit f804d4277c
2 changed files with 1 additions and 5 deletions

View File

@ -9,10 +9,7 @@ int main(int argc, char** argv) {
list_t x = { .first = 0, .last = 0 }; list_t x = { .first = 0, .last = 0 };
list_t y = { .first = 0, .last = 0 }; list_t y = { .first = 0, .last = 0 };
list_free(&x);
visual_push2(&x, (random_uint8()%5) + 12, &y, (random_uint8()%5) + 12); visual_push2(&x, (random_uint8()%5) + 12, &y, (random_uint8()%5) + 12);
visual_extend(&x, &y); visual_extend(&x, &y);
visual_sort2(&x, &y); visual_sort2(&x, &y);

View File

@ -38,7 +38,7 @@ void list_push_random(list_t* x, _Bool silent, unsigned int hpos) {
if (random_boolean()) i = ~i + 1; if (random_boolean()) i = ~i + 1;
if (!silent) { if (!silent) {
printf("\e[%dG\e[36mTry to change value with index \e[32;1m%ld\e[36m into list:\e[m\n", hpos+1, i); 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_update(x, i, v.value, v.type, 0); r = libcdsb_list_update(x, i, v.value, v.type, 0);
@ -74,7 +74,6 @@ void list_remove_random(list_t* x, _Bool silent, unsigned int hpos) {
switch (libcdsb_list_get(x, i, &v, remove_callback, 0)) { switch (libcdsb_list_get(x, i, &v, remove_callback, 0)) {
case 0: if (!silent) printf("\e[%dG\e[32;1mSUCCESS\e[m\n", hpos+1); break; case 0: if (!silent) printf("\e[%dG\e[32;1mSUCCESS\e[m\n", hpos+1); break;
case 2: if (!silent) printf("\n\e[%dG\e[32;1mFAILURE\e[m\n", hpos+1); break;
default: if (!silent) printf("\e[%dG\e[32;1mFAILURE\e[m\n", hpos+1); break; default: if (!silent) printf("\e[%dG\e[32;1mFAILURE\e[m\n", hpos+1); break;
} }
} }