diff options
author | Nicolas Dato <nicolas.dato@gmail.com> | 2025-07-17 20:52:49 -0300 |
---|---|---|
committer | Nicolas Dato <nicolas.dato@gmail.com> | 2025-07-18 07:15:02 -0300 |
commit | b1fcc672448f8403a567cd280c2151eb6d5799cb (patch) | |
tree | 995ef80358f3c88807d8034b5ad3f78b54301482 /test | |
parent | ee208b6f61a4f2f52d6a796acdb0764374d23234 (diff) | |
download | libtuberia-b1fcc672448f8403a567cd280c2151eb6d5799cb.tar.gz |
adding documentation
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 2 | ||||
-rw-r--r-- | test/test_itc.c | 36 | ||||
-rw-r--r-- | test/test_tuberia.c | 18 |
3 files changed, 29 insertions, 27 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 2b94ddd..b252bf5 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,3 +1,4 @@ +if TESTS check_PROGRAMS = dist_check_SCRIPTS = TESTS = @@ -30,4 +31,5 @@ test_tuberia_SOURCES = test_tuberia.c test.h test_tuberia_LDADD = ../src/libtuberia.a test_tuberia_LDFLAGS = -lpthread endif +endif diff --git a/test/test_itc.c b/test/test_itc.c index 6af69c0..61d98c0 100644 --- a/test/test_itc.c +++ b/test/test_itc.c @@ -14,7 +14,7 @@ static void test_itc_alloc_free(void) TEST(ctx == NULL); } -static void test_itc_inject_retrive(void) +static void test_itc_inject_retrieve(void) { unsigned int i; unsigned int *e[3] = {NULL}; @@ -30,19 +30,19 @@ static void test_itc_inject_retrive(void) TEST(itc_inject(ctx, 0, e[0]) == 0); TEST(itc_inject(ctx, 0, e[1]) == 0); TEST(itc_inject(ctx, 0, e[2]) == 0); - TEST((r = itc_retrive(ctx, 0)) != NULL); + TEST((r = itc_retrieve(ctx, 0)) != NULL); TEST(*r == 0); - TEST((r = itc_retrive(ctx, 0)) != NULL); + TEST((r = itc_retrieve(ctx, 0)) != NULL); TEST(*r == 1); TEST(itc_inject(ctx, 0, e[0]) == 0); TEST(itc_inject(ctx, 0, e[1]) == 0); - TEST((r = itc_retrive(ctx, 0)) != NULL); + TEST((r = itc_retrieve(ctx, 0)) != NULL); TEST(*r == 2); - TEST((r = itc_retrive(ctx, 0)) != NULL); + TEST((r = itc_retrieve(ctx, 0)) != NULL); TEST(*r == 0); - TEST((r = itc_retrive(ctx, 0)) != NULL); + TEST((r = itc_retrieve(ctx, 0)) != NULL); TEST(*r == 1); - TEST(itc_retrive(ctx, 0) == NULL); + TEST(itc_retrieve(ctx, 0) == NULL); TEST(itc_inject(ctx, 0, e[0]) == 0); itc_free(&ctx, free); @@ -52,11 +52,11 @@ static void test_itc_inject_retrive(void) TEST(itc_inject(ctx, 0, e[0]) == 0); TEST(itc_inject(ctx, 0, e[1]) == 0); TEST(itc_inject(ctx, 0, e[2])); - TEST((r = itc_retrive(ctx, 0)) != NULL); + TEST((r = itc_retrieve(ctx, 0)) != NULL); TEST(*r == 0); - TEST((r = itc_retrive(ctx, 0)) != NULL); + TEST((r = itc_retrieve(ctx, 0)) != NULL); TEST(*r == 1); - TEST(itc_retrive(ctx, 0) == NULL); + TEST(itc_retrieve(ctx, 0) == NULL); itc_free(&ctx, free); for (i = 0; i < sizeof(e)/sizeof(e[0]); i++) { free(e[i]); @@ -80,10 +80,10 @@ static void test_itc_queued_slots(void) itc_inject(ctx, 0, ctx); TEST(itc_get_queued(ctx) == 2); TEST(itc_get_slots(ctx) == 3); - itc_retrive(ctx, 0); + itc_retrieve(ctx, 0); TEST(itc_get_queued(ctx) == 1); TEST(itc_get_slots(ctx) == 3); - itc_retrive(ctx, 0); + itc_retrieve(ctx, 0); TEST(itc_get_queued(ctx) == 0); TEST(itc_get_slots(ctx) == 3); itc_free(&ctx, NULL); @@ -96,16 +96,16 @@ static void *test_itc_wait_empty_th(void *_ctx) sleep(2); TEST(ctx != NULL); - TEST((e = itc_retrive(ctx, 0)) != NULL); + TEST((e = itc_retrieve(ctx, 0)) != NULL); TEST(*e == 0); free(e); - TEST((e = itc_retrive(ctx, 0)) != NULL); + TEST((e = itc_retrieve(ctx, 0)) != NULL); TEST(*e == 1); free(e); - TEST((e = itc_retrive(ctx, 0)) != NULL); + TEST((e = itc_retrieve(ctx, 0)) != NULL); TEST(*e == 2); free(e); - TEST(itc_retrive(ctx, 0) == NULL); + TEST(itc_retrieve(ctx, 0) == NULL); return NULL; } @@ -131,7 +131,7 @@ static void test_itc_wait_empty(void) itc_wait_empty(ctx); sleep(2); TEST(itc_get_queued(ctx) == 0); - TEST(itc_retrive(ctx, 0) == NULL); + TEST(itc_retrieve(ctx, 0) == NULL); itc_free(&ctx, NULL); } @@ -163,7 +163,7 @@ int main(int argc, char **argv) (void)argc; (void)argv; test_itc_alloc_free(); - test_itc_inject_retrive(); + test_itc_inject_retrieve(); test_itc_queued_slots(); test_itc_wait_empty(); test_itc_discard_all(); diff --git a/test/test_tuberia.c b/test/test_tuberia.c index 12920d1..9d6f57d 100644 --- a/test/test_tuberia.c +++ b/test/test_tuberia.c @@ -59,7 +59,7 @@ static void test_tube_alloc_free(void) TEST(ctx == NULL); } -static void test_tube_inject_retrive(void) +static void test_tube_inject_retrieve(void) { tube *ctx; tube_source *source; @@ -89,7 +89,7 @@ static void test_tube_inject_retrive(void) TEST(tube_inject(ctx, 1000, e[i]) == 0); } for (i = 0; i < sizeof(e)/sizeof(e[0]); i++) { - TEST((o = tube_retrive(ctx, 1000)) != NULL); + TEST((o = tube_retrieve(ctx, 1000)) != NULL); TEST(*o == r[i]); free(o); } @@ -102,7 +102,7 @@ static void test_tube_inject_retrive(void) } TEST(tube_inject_at(ctx, 1, 1000, e2[0]) < 0); for (i = 0; i < sizeof(e2)/sizeof(e2[0]); i++) { - TEST((o = tube_retrive(ctx, 1000)) != NULL); + TEST((o = tube_retrieve(ctx, 1000)) != NULL); TEST(*o == r[i]); free(o); } @@ -155,7 +155,7 @@ static void test_tube_get_queued_get_slots(void) TEST(tube_get_queued(ctx, 0) == 1); TEST(tube_get_queued(ctx, 1) == 3); - free(tube_retrive(ctx, 1000)); + free(tube_retrieve(ctx, 1000)); sleep(2); TEST(tube_get_slots(ctx, 0) == 2); @@ -163,7 +163,7 @@ static void test_tube_get_queued_get_slots(void) TEST(tube_get_queued(ctx, 0) == 0); TEST(tube_get_queued(ctx, 1) == 3); - free(tube_retrive(ctx, 1000)); + free(tube_retrieve(ctx, 1000)); sleep(2); TEST(tube_get_slots(ctx, 0) == 2); @@ -171,7 +171,7 @@ static void test_tube_get_queued_get_slots(void) TEST(tube_get_queued(ctx, 0) == 0); TEST(tube_get_queued(ctx, 1) == 3); - free(tube_retrive(ctx, 1000)); + free(tube_retrieve(ctx, 1000)); sleep(2); TEST(tube_get_slots(ctx, 0) == 2); @@ -179,8 +179,8 @@ static void test_tube_get_queued_get_slots(void) TEST(tube_get_queued(ctx, 0) == 0); TEST(tube_get_queued(ctx, 1) == 2); - free(tube_retrive(ctx, 0)); - free(tube_retrive(ctx, 0)); + free(tube_retrieve(ctx, 0)); + free(tube_retrieve(ctx, 0)); sleep(2); TEST(tube_get_slots(ctx, 0) == 2); @@ -197,7 +197,7 @@ int main(int argc, char **argv) (void)argv; test_tube_source_stage_alloc_free(); test_tube_alloc_free(); - test_tube_inject_retrive(); + test_tube_inject_retrieve(); test_tube_get_queued_get_slots(); /*test_tube_wait_empty(); test_tube_discard_all();*/ |