33 lines
788 B
C
33 lines
788 B
C
/* This software is licensed by the MIT License, see LICENSE file */
|
|
/* Copyright © 2022 Gregory Lirent */
|
|
|
|
#include "plug.h"
|
|
|
|
int main(int argc, char** argv) {
|
|
test_init(argc, argv);
|
|
|
|
vtype_list x;
|
|
|
|
list_init(&x);
|
|
|
|
for (int i = 0, c = random_uint8()%12; i < 12; ++i) {
|
|
if (i == c) {
|
|
list_push_back(&x, 0);
|
|
} else list_push_random(&x, random_boolean());
|
|
}
|
|
|
|
list_info(&x);
|
|
list_print(&x, 0);
|
|
|
|
for (int i = 0, n = list_countof(&x, 0); i < n; ++i) {
|
|
int index = list_indexof(&x, 0);
|
|
list_remove(&x, 0);
|
|
|
|
printf("\e[36mRemove element with index \e[m\e[32;1m%d\e[m\e[36m from list\e[m\n", index);
|
|
}
|
|
put_separator();
|
|
list_print(&x, "cleaned");
|
|
|
|
list_free(&x);
|
|
}
|