#include <ecl/thread/semaphore.hpp>
#include <array>
#include <thread>
#include <atomic>
#include <algorithm>
#include <functional>
#include <iostream>
#include <chrono>
#include <future>
#include <CppUTest/TestHarness.h>
#include <CppUTest/CommandLineTestRunner.h>
|
template<class Container , class Func > |
static void | test_for_each (Container &cont, Func fn) |
|
static void | test_delay (unsigned msecs=1000) |
|
| TEST_GROUP (semaphore) |
|
| TEST (semaphore, signal_wait_no_hang) |
|
| TEST (semaphore, try_wait) |
|
| TEST (semaphore, one_semaphore_few_threads) |
|
| TEST (semaphore, multiple_threads) |
|
| TEST_GROUP (binary_semaphore) |
|
| TEST (binary_semaphore, try_wait) |
|
| TEST (binary_semaphore, more_than_one_signal) |
|
int | main (int argc, char *argv[]) |
|
◆ test_for_each()
template<class Container , class Func >
static void test_for_each |
( |
Container & |
cont, |
|
|
Func |
fn |
|
) |
| |
|
static |
◆ test_delay()
static void test_delay |
( |
unsigned |
msecs = 1000 | ) |
|
|
static |
◆ TEST_GROUP() [1/2]
◆ TEST() [1/6]
TEST |
( |
semaphore |
, |
|
|
signal_wait_no_hang |
|
|
) |
| |
◆ TEST() [2/6]
TEST |
( |
semaphore |
, |
|
|
try_wait |
|
|
) |
| |
◆ TEST() [3/6]
TEST |
( |
semaphore |
, |
|
|
one_semaphore_few_threads |
|
|
) |
| |
◆ TEST() [4/6]
TEST |
( |
semaphore |
, |
|
|
multiple_threads |
|
|
) |
| |
◆ TEST_GROUP() [2/2]
TEST_GROUP |
( |
binary_semaphore |
| ) |
|
◆ TEST() [5/6]
TEST |
( |
binary_semaphore |
, |
|
|
try_wait |
|
|
) |
| |
◆ TEST() [6/6]
TEST |
( |
binary_semaphore |
, |
|
|
more_than_one_signal |
|
|
) |
| |
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
◆ mock_time
volatile uint32_t mock_time = 0 |
◆ threads_count
constexpr auto threads_count = 10 |