diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2023-04-02 13:57:08 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2023-04-02 13:57:08 +0200 |
commit | cfb17ee2207a13301ae1deef1967f0860968ed07 (patch) | |
tree | c4a4a5a7328bde9692985afa9e073f0151396baa /source/test | |
parent | aab8b0aabb7b4e48fb6361954824cc9b4ff8ec31 (diff) | |
download | kit-cfb17ee2207a13301ae1deef1967f0860968ed07.zip |
[test] More assertions
Diffstat (limited to 'source/test')
-rw-r--r-- | source/test/unittests/atomic.test.c | 20 |
1 files changed, 12 insertions, 8 deletions
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); |