The ROme OpTimistic Simulator  3.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
test.h File Reference

Test framework header. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
+ Include dependency graph for test.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  test_config
 A complete test configuration. More...
 

Macros

#define TEST_BAD_FAIL_EXIT_CODE   99
 The exit code of tests when something fails horribly.
 

Typedefs

typedef uint64_t lp_id_t
 
typedef unsigned rid_t
 
typedef int nid_t
 

Functions

int test_printf (const char *restrict fmt,...)
 Registers a formatted string to compare against the expected output. More...
 
bool test_thread_barrier (void)
 Synchronizes threads on a barrier. More...
 

Variables

const struct test_config test_config
 The test configuration object, must be defined by the test sources.
 

Detailed Description

Test framework header.

The header of the minimal test framework used in the code base tests

Definition in file test.h.

Function Documentation

◆ test_printf()

int test_printf ( const char *restrict  fmt,
  ... 
)

Registers a formatted string to compare against the expected output.

Returns
the number of successfully registered characters

Definition at line 169 of file test.c.

+ Here is the caller graph for this function:

◆ test_thread_barrier()

bool test_thread_barrier ( void  )

Synchronizes threads on a barrier.

Returns
true if this thread has been elected as leader, false otherwise

This is a more battle tested although less performing version of the thread barrier. We can't rely on the pthread barrier because it's not portable.

Definition at line 200 of file test.c.

+ Here is the caller graph for this function: