summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-09-10 21:31:44 -0400
committerDavid Robillard <d@drobilla.net>2021-09-10 21:41:29 -0400
commitd35db8f148c4b735211e22b25d7140314474f19e (patch)
tree92aafaf000313ee4ccdca759aa0ef3133119c727
parent36e06a641f28f7d661254a8496d21f982922cbc4 (diff)
downloadzix-d35db8f148c4b735211e22b25d7140314474f19e.tar.gz
zix-d35db8f148c4b735211e22b25d7140314474f19e.tar.bz2
zix-d35db8f148c4b735211e22b25d7140314474f19e.zip
Use assert in Sem test
-rw-r--r--test/sem_test.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/test/sem_test.c b/test/sem_test.c
index a5f6d2e..4cca484 100644
--- a/test/sem_test.c
+++ b/test/sem_test.c
@@ -1,5 +1,5 @@
/*
- Copyright 2012-2020 David Robillard <d@drobilla.net>
+ Copyright 2012-2021 David Robillard <d@drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -14,10 +14,13 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#undef NDEBUG
+
#include "zix/attributes.h"
#include "zix/sem.h"
#include "zix/thread.h"
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -64,22 +67,13 @@ main(int argc, char** argv)
printf("Testing %u signals...\n", n_signals);
- if (zix_sem_init(&sem, 0)) {
- fprintf(stderr, "Failed to create semaphore.\n");
- return 1;
- }
+ assert(!zix_sem_init(&sem, 0));
ZixThread reader_thread; // NOLINT
- if (zix_thread_create(&reader_thread, 128, reader, NULL)) {
- fprintf(stderr, "Failed to create reader thread\n");
- return 1;
- }
+ assert(!zix_thread_create(&reader_thread, 128, reader, NULL));
ZixThread writer_thread; // NOLINT
- if (zix_thread_create(&writer_thread, 128, writer, NULL)) {
- fprintf(stderr, "Failed to create writer thread\n");
- return 1;
- }
+ assert(!zix_thread_create(&writer_thread, 128, writer, NULL));
zix_thread_join(reader_thread, NULL);
zix_thread_join(writer_thread, NULL);