libcopp  2.2.0
Macros
test_macros.h File Reference
#include <cstdio>
#include <iostream>
#include <sstream>
#include "test_manager.h"
#include <unistd.h>
Include dependency graph for test_macros.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define test_case_func_name(test_name, case_name)   test_func_test_##test_name##_case_##case_name##_
 
#define test_case_obj_name(test_name, case_name)   test_obj_test_##test_name##_case_##case_name##_
 
#define CASE_TEST(test_name, case_name)
 
#define test_event_on_start_func_name(event_name)   test_func_event_on_start_##event_name##_
 
#define test_event_on_start_obj_name(event_name)   test_obj_event_on_start_##event_name##_
 
#define test_event_on_exit_func_name(event_name)   test_func_event_on_exit_##event_name##_
 
#define test_event_on_exit_obj_name(event_name)   test_obj_event_on_exit_##event_name##_
 
#define CASE_TEST_EVENT_ON_START(event_name, args...)
 
#define CASE_TEST_EVENT_ON_EXIT(event_name, args...)
 
#define CASE_EXPECT_TRUE(c)   test_manager::me().expect_true((c), # c, __FILE__, __LINE__)
 
#define CASE_EXPECT_FALSE(c)   test_manager::me().expect_false((c), # c, __FILE__, __LINE__)
 
#define CASE_EXPECT_EQ(l, r)   test_manager::me().expect_eq((l), (r), # l, # r, __FILE__, __LINE__)
 
#define CASE_EXPECT_NE(l, r)   test_manager::me().expect_ne((l), (r), # l, # r, __FILE__, __LINE__)
 
#define CASE_EXPECT_LT(l, r)   test_manager::me().expect_lt((l), (r), # l, # r, __FILE__, __LINE__)
 
#define CASE_EXPECT_LE(l, r)   test_manager::me().expect_le((l), (r), # l, # r, __FILE__, __LINE__)
 
#define CASE_EXPECT_GT(l, r)   test_manager::me().expect_gt((l), (r), # l, # r, __FILE__, __LINE__)
 
#define CASE_EXPECT_GE(l, r)   test_manager::me().expect_ge((l), (r), # l, # r, __FILE__, __LINE__)
 
#define CASE_MSG_FCOLOR(x)   util::cli::shell_font_style::SHELL_FONT_COLOR_##x
 
#define CASE_MSG_BCOLOR(x)   util::cli::shell_font_style::SHELL_FONT_BACKGROUND_COLOR_##x
 
#define CASE_MSG_STYLE(x)   util::cli::shell_font_style::SHELL_FONT_SPEC_##x
 
#define CASE_MSG_INFO()   util::cli::shell_stream(std::cout)() << "[ RUNNING ] "
 
#define CASE_MSG_ERROR()   util::cli::shell_stream(std::cerr)() << "[ RUNNING ] "
 
#define CASE_THREAD_SLEEP_MS(x)
 
#define CASE_THREAD_YIELD()
 

Macro Definition Documentation

◆ CASE_EXPECT_EQ

#define CASE_EXPECT_EQ (   l,
 
)    test_manager::me().expect_eq((l), (r), # l, # r, __FILE__, __LINE__)

Definition at line 96 of file test_macros.h.

◆ CASE_EXPECT_FALSE

#define CASE_EXPECT_FALSE (   c)    test_manager::me().expect_false((c), # c, __FILE__, __LINE__)

Definition at line 95 of file test_macros.h.

◆ CASE_EXPECT_GE

#define CASE_EXPECT_GE (   l,
 
)    test_manager::me().expect_ge((l), (r), # l, # r, __FILE__, __LINE__)

Definition at line 101 of file test_macros.h.

◆ CASE_EXPECT_GT

#define CASE_EXPECT_GT (   l,
 
)    test_manager::me().expect_gt((l), (r), # l, # r, __FILE__, __LINE__)

Definition at line 100 of file test_macros.h.

◆ CASE_EXPECT_LE

#define CASE_EXPECT_LE (   l,
 
)    test_manager::me().expect_le((l), (r), # l, # r, __FILE__, __LINE__)

Definition at line 99 of file test_macros.h.

◆ CASE_EXPECT_LT

#define CASE_EXPECT_LT (   l,
 
)    test_manager::me().expect_lt((l), (r), # l, # r, __FILE__, __LINE__)

Definition at line 98 of file test_macros.h.

◆ CASE_EXPECT_NE

#define CASE_EXPECT_NE (   l,
 
)    test_manager::me().expect_ne((l), (r), # l, # r, __FILE__, __LINE__)

Definition at line 97 of file test_macros.h.

◆ CASE_EXPECT_TRUE

#define CASE_EXPECT_TRUE (   c)    test_manager::me().expect_true((c), # c, __FILE__, __LINE__)

Definition at line 94 of file test_macros.h.

◆ CASE_MSG_BCOLOR

#define CASE_MSG_BCOLOR (   x)    util::cli::shell_font_style::SHELL_FONT_BACKGROUND_COLOR_##x

Definition at line 110 of file test_macros.h.

◆ CASE_MSG_ERROR

#define CASE_MSG_ERROR ( )    util::cli::shell_stream(std::cerr)() << "[ RUNNING ] "

Definition at line 115 of file test_macros.h.

◆ CASE_MSG_FCOLOR

#define CASE_MSG_FCOLOR (   x)    util::cli::shell_font_style::SHELL_FONT_COLOR_##x

Definition at line 108 of file test_macros.h.

◆ CASE_MSG_INFO

#define CASE_MSG_INFO ( )    util::cli::shell_stream(std::cout)() << "[ RUNNING ] "

Definition at line 114 of file test_macros.h.

◆ CASE_MSG_STYLE

#define CASE_MSG_STYLE (   x)    util::cli::shell_font_style::SHELL_FONT_SPEC_##x

Definition at line 112 of file test_macros.h.

◆ CASE_TEST

#define CASE_TEST (   test_name,
  case_name 
)
Value:
static void test_case_func_name(test_name, case_name)(); \
static test_case_base test_case_obj_name(test_name, case_name)(#test_name, #case_name, \
test_case_func_name(test_name, case_name)); \
void test_case_func_name(test_name, case_name)()
#define test_case_obj_name(test_name, case_name)
Definition: test_macros.h:44
#define test_case_func_name(test_name, case_name)
Definition: test_macros.h:43

Definition at line 46 of file test_macros.h.

◆ CASE_TEST_EVENT_ON_EXIT

#define CASE_TEST_EVENT_ON_EXIT (   event_name,
  args... 
)
Value:
static void test_event_on_exit_func_name(event_name)(); \
#event_name, test_event_on_exit_func_name(event_name), ##args); \
void test_event_on_exit_func_name(event_name)()
#define test_event_on_exit_func_name(event_name)
Definition: test_macros.h:54
#define test_event_on_exit_obj_name(event_name)
Definition: test_macros.h:55

Definition at line 76 of file test_macros.h.

◆ CASE_TEST_EVENT_ON_START

#define CASE_TEST_EVENT_ON_START (   event_name,
  args... 
)
Value:
static void test_event_on_start_func_name(event_name)(); \
#event_name, test_event_on_start_func_name(event_name), ##args); \
void test_event_on_start_func_name(event_name)()
#define test_event_on_start_func_name(event_name)
Definition: test_macros.h:52
#define test_event_on_start_obj_name(event_name)
Definition: test_macros.h:53

Definition at line 70 of file test_macros.h.

◆ CASE_THREAD_SLEEP_MS

#define CASE_THREAD_SLEEP_MS (   x)
Value:
((x > 1000) ? sleep(x / 1000) : usleep(0)); \
usleep((x % 1000) * 1000)

Definition at line 134 of file test_macros.h.

◆ CASE_THREAD_YIELD

#define CASE_THREAD_YIELD ( )

Definition at line 165 of file test_macros.h.

◆ test_case_func_name

#define test_case_func_name (   test_name,
  case_name 
)    test_func_test_##test_name##_case_##case_name##_

Definition at line 43 of file test_macros.h.

◆ test_case_obj_name

#define test_case_obj_name (   test_name,
  case_name 
)    test_obj_test_##test_name##_case_##case_name##_

Definition at line 44 of file test_macros.h.

◆ test_event_on_exit_func_name

#define test_event_on_exit_func_name (   event_name)    test_func_event_on_exit_##event_name##_

Definition at line 54 of file test_macros.h.

◆ test_event_on_exit_obj_name

#define test_event_on_exit_obj_name (   event_name)    test_obj_event_on_exit_##event_name##_

Definition at line 55 of file test_macros.h.

◆ test_event_on_start_func_name

#define test_event_on_start_func_name (   event_name)    test_func_event_on_start_##event_name##_

Definition at line 52 of file test_macros.h.

◆ test_event_on_start_obj_name

#define test_event_on_start_obj_name (   event_name)    test_obj_event_on_start_##event_name##_

Definition at line 53 of file test_macros.h.