diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/maid_test.cpp | 16 | ||||
-rw-r--r-- | test/sem_test.cpp | 8 |
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() { |