From cfb17ee2207a13301ae1deef1967f0860968ed07 Mon Sep 17 00:00:00 2001
From: Mitya Selivanov <automainint@guattari.tech>
Date: Sun, 2 Apr 2023 13:57:08 +0200
Subject: [test] More assertions

---
 source/test/unittests/atomic.test.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

(limited to 'source/test')

diff --git a/source/test/unittests/atomic.test.c b/source/test/unittests/atomic.test.c
index e7cf1fa..7d8b35a 100644
--- a/source/test/unittests/atomic.test.c
+++ b/source/test/unittests/atomic.test.c
@@ -94,8 +94,9 @@ TEST("atomic byte concurrency") {
 
   thrd_t threads[THREAD_COUNT];
   for (i = 0; i < THREAD_COUNT; i++)
-    thrd_create(threads + i, test_8_,
-                (void *) ((i % 2) ? &foo : &bar));
+    REQUIRE_EQ(thrd_create(threads + i, test_8_,
+                           (void *) ((i % 2) ? &foo : &bar)),
+               thrd_success);
   for (i = 0; i < THREAD_COUNT; i++) thrd_join(threads[i], NULL);
 
   REQUIRE(atomic_load_explicit(&foo, memory_order_relaxed) == 42);
@@ -130,8 +131,9 @@ TEST("atomic int16 concurrency") {
 
   thrd_t threads[THREAD_COUNT];
   for (i = 0; i < THREAD_COUNT; i++)
-    thrd_create(threads + i, test_16_,
-                (void *) ((i % 2) ? &foo : &bar));
+    REQUIRE_EQ(thrd_create(threads + i, test_16_,
+                           (void *) ((i % 2) ? &foo : &bar)),
+               thrd_success);
   for (i = 0; i < THREAD_COUNT; i++) thrd_join(threads[i], NULL);
 
   REQUIRE(atomic_load_explicit(&foo, memory_order_relaxed) == 42);
@@ -166,8 +168,9 @@ TEST("atomic int32 concurrency") {
 
   thrd_t threads[THREAD_COUNT];
   for (i = 0; i < THREAD_COUNT; i++)
-    thrd_create(threads + i, test_32_,
-                (void *) ((i % 2) ? &foo : &bar));
+    REQUIRE_EQ(thrd_create(threads + i, test_32_,
+                           (void *) ((i % 2) ? &foo : &bar)),
+               thrd_success);
   for (i = 0; i < THREAD_COUNT; i++) thrd_join(threads[i], NULL);
 
   REQUIRE(atomic_load_explicit(&foo, memory_order_relaxed) == 42);
@@ -205,8 +208,9 @@ TEST("atomic int64 concurrency") {
 
   thrd_t threads[THREAD_COUNT];
   for (i = 0; i < THREAD_COUNT; i++)
-    thrd_create(threads + i, test_64_,
-                (void *) ((i % 2) ? &foo : &bar));
+    REQUIRE_EQ(thrd_create(threads + i, test_64_,
+                           (void *) ((i % 2) ? &foo : &bar)),
+               thrd_success);
   for (i = 0; i < THREAD_COUNT; i++) thrd_join(threads[i], NULL);
 
   REQUIRE(atomic_load_explicit(&foo, memory_order_relaxed) == 42);
-- 
cgit v1.2.3