summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-09-21 22:15:42 -0400
committerDavid Robillard <d@drobilla.net>2023-09-23 00:17:27 -0400
commitcaf2b45cc460faced8ff264259e4cd05cb571e8a (patch)
tree3efcde1b8e747a7714a26e59008b2ce9dbe257a1 /test
parent9c72bba439dc4c4391b73abe607d5bef02f57819 (diff)
downloadraul-caf2b45cc460faced8ff264259e4cd05cb571e8a.tar.gz
raul-caf2b45cc460faced8ff264259e4cd05cb571e8a.tar.bz2
raul-caf2b45cc460faced8ff264259e4cd05cb571e8a.zip
Use anonymous namespaces instead of "static" in tests
Diffstat (limited to 'test')
-rw-r--r--test/maid_test.cpp16
-rw-r--r--test/sem_test.cpp8
2 files changed, 16 insertions, 8 deletions
diff --git a/test/maid_test.cpp b/test/maid_test.cpp
index 286be2a..0456913 100644
--- a/test/maid_test.cpp
+++ b/test/maid_test.cpp
@@ -15,11 +15,13 @@
using raul::Maid;
-static const size_t n_threads = 8U;
-static const size_t n_junk_per_thread = 1U << 16U;
+namespace {
-static std::atomic<size_t> n_junk(0);
-static std::atomic<size_t> n_finished_threads(0);
+const size_t n_threads = 8U;
+const size_t n_junk_per_thread = 1U << 16U;
+
+std::atomic<size_t> n_junk(0);
+std::atomic<size_t> n_finished_threads(0);
class Junk : public Maid::Disposable
{
@@ -43,7 +45,7 @@ private:
size_t _val;
};
-static void
+void
litter(Maid* maid)
{
for (size_t i = 0; i < n_junk_per_thread; ++i) {
@@ -54,7 +56,7 @@ litter(Maid* maid)
++n_finished_threads;
}
-static void
+void
test()
{
Maid maid;
@@ -120,6 +122,8 @@ test()
assert(n_junk == 1);
}
+} // namespace
+
int
main()
{
diff --git a/test/sem_test.cpp b/test/sem_test.cpp
index ae82c91..103e5e5 100644
--- a/test/sem_test.cpp
+++ b/test/sem_test.cpp
@@ -9,19 +9,23 @@
#include <chrono>
#include <thread>
-static void
+namespace {
+
+void
wait_for_sem(raul::Semaphore* sem)
{
sem->wait();
}
-static void
+void
timed_wait_for_sem(raul::Semaphore* sem)
{
while (!sem->timed_wait(std::chrono::milliseconds(100))) {
}
}
+} // namespace
+
int
main()
{