theCore C++ embedded framework
semaphore_unit.cpp File Reference
#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>
Include dependency graph for semaphore_unit.cpp:

Functions

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[])
 

Variables

volatile uint32_t mock_time = 0
 
constexpr auto threads_count = 10
 

Function Documentation

◆ test_for_each()

template<class Container , class Func >
static void test_for_each ( Container &  cont,
Func  fn 
)
static
Here is the call graph for this function:

◆ test_delay()

static void test_delay ( unsigned  msecs = 1000)
static
Here is the call graph for this function:

◆ TEST_GROUP() [1/2]

TEST_GROUP ( semaphore  )
Here is the call graph for this function:

◆ TEST() [1/6]

TEST ( semaphore  ,
signal_wait_no_hang   
)
Here is the call graph for this function:

◆ TEST() [2/6]

TEST ( semaphore  ,
try_wait   
)
Here is the call graph for this function:

◆ TEST() [3/6]

TEST ( semaphore  ,
one_semaphore_few_threads   
)
Here is the call graph for this function:

◆ TEST() [4/6]

TEST ( semaphore  ,
multiple_threads   
)
Here is the call graph for this function:

◆ TEST_GROUP() [2/2]

TEST_GROUP ( binary_semaphore  )
Here is the call graph for this function:

◆ TEST() [5/6]

TEST ( binary_semaphore  ,
try_wait   
)
Here is the call graph for this function:

◆ TEST() [6/6]

TEST ( binary_semaphore  ,
more_than_one_signal   
)
Here is the call graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

Variable Documentation

◆ mock_time

volatile uint32_t mock_time = 0

◆ threads_count

constexpr auto threads_count = 10