summaryrefslogtreecommitdiffstats
path: root/test/thread_test.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-04-22 11:50:34 +0200
committerDavid Robillard <d@drobilla.net>2019-04-22 11:50:34 +0200
commit40d2067dc44c9d46fc1f83c41fe4187a70f23bce (patch)
treeffcd296efa4832e7127013e60e36ece31389fe26 /test/thread_test.cpp
parentbe6c2693ec741650a0684fa8a827ab2a5cd7b8f7 (diff)
downloadraul-40d2067dc44c9d46fc1f83c41fe4187a70f23bce.tar.gz
raul-40d2067dc44c9d46fc1f83c41fe4187a70f23bce.tar.bz2
raul-40d2067dc44c9d46fc1f83c41fe4187a70f23bce.zip
Simplify unit tests and improve coverage by using assert
Diffstat (limited to 'test/thread_test.cpp')
-rw-r--r--test/thread_test.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/test/thread_test.cpp b/test/thread_test.cpp
index 72ba93f..cf65050 100644
--- a/test/thread_test.cpp
+++ b/test/thread_test.cpp
@@ -1,6 +1,6 @@
/*
This file is part of Raul.
- Copyright 2007-2017 David Robillard <http://drobilla.net>
+ Copyright 2007-2019 David Robillard <http://drobilla.net>
Raul is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -14,9 +14,12 @@
along with Raul. If not, see <http://www.gnu.org/licenses/>.
*/
+#undef NDEBUG
+
#include "raul/Semaphore.hpp"
#include <atomic>
+#include <cassert>
#include <iostream>
#include <thread>
@@ -35,10 +38,7 @@ wait_for_sem(Semaphore* sem)
sem->wait();
std::cout << "[Waiter] Received signal, exiting" << std::endl;
var = 42;
- if (var != 42) {
- std::cerr << "[Waiter] var != 42" << std::endl;
- ++n_errors;
- }
+ assert(var == 42);
}
} // namespace
@@ -59,10 +59,7 @@ main()
std::cout << "[Main] Exiting" << std::endl;
- if (var != 24) {
- std::cerr << "[Main] var != 24" << std::endl;
- ++n_errors;
- }
+ assert(var == 24);
return n_errors.load();
}