Namespaces | |
anonymous_namespace{unittest.cpp} | |
Functions | |
double | get_start_time () |
Get the start time of tests. More... | |
std::string | anonymous_namespace{unittest.cpp}::get_testdata_dir () |
double | get_time () |
Get the current execution time in seconds. More... | |
std::string | get_token () |
Get the token from the environment variable DPP_UNIT_TEST_TOKEN. More... | |
bool | is_skipped (const test_t &test) |
Check if a test is/should be skipped. More... | |
std::vector< std::byte > | load_data (const std::string &file) |
Load bytes from file. More... | |
std::vector< uint8_t > | load_test_audio () |
Load test audio for the voice channel tests. More... | |
void | set_status (test_t &test, test_status_t newstatus, std::string_view message) |
Sets a test's status. More... | |
void | set_test (test_t &test, bool success) |
Sets a test's status (legacy) More... | |
void | skip_test (test_t &test) |
Sets a test's status to ts_skipped. More... | |
void | start_test (test_t &test) |
Sets a test's status to ts_started. More... | |
int | test_summary () |
Prints a summary of all tests executed. More... | |
void | wait_for_tests () |
Wait for all tests to be completed or test program to time out. More... | |
Variables | |
bool | extended = false |
bool | offline = false |
double | start = dpp::utility::time_f() |
dpp::snowflake | TEST_EVENT_ID = std::stoull((getenv( "TEST_EVENT_ID" ) && *(getenv( "TEST_EVENT_ID" )) ? getenv( "TEST_EVENT_ID" ) : "0")) |
dpp::snowflake | TEST_GUILD_ID = std::stoull((getenv( "TEST_GUILD_ID" ) && *(getenv( "TEST_GUILD_ID" )) ? getenv( "TEST_GUILD_ID" ) : "0")) |
dpp::snowflake | TEST_TEXT_CHANNEL_ID = std::stoull((getenv( "TEST_TEXT_CHANNEL_ID" ) && *(getenv( "TEST_TEXT_CHANNEL_ID" )) ? getenv( "TEST_TEXT_CHANNEL_ID" ) : "0")) |
dpp::snowflake | TEST_USER_ID = std::stoull((getenv( "TEST_USER_ID" ) && *(getenv( "TEST_USER_ID" )) ? getenv( "TEST_USER_ID" ) : "0")) |
dpp::snowflake | TEST_VC_ID = std::stoull((getenv( "TEST_VC_ID" ) && *(getenv( "TEST_VC_ID" )) ? getenv( "TEST_VC_ID" ) : "0")) |
double get_start_time | ( | ) |
Get the start time of tests.
References start.
Referenced by get_time(), and main().
double get_time | ( | ) |
Get the current execution time in seconds.
References get_start_time(), and dpp::utility::time_f().
Referenced by crossplatform_strptime(), set_status(), test_summary(), and wait_for_tests().
std::string get_token | ( | ) |
bool is_skipped | ( | const test_t & | test | ) |
Check if a test is/should be skipped.
References coro, extended, test_t::flags, offline, tf_coro, tf_extended, and tf_online.
Referenced by set_status(), and wait_for_tests().
std::vector<std::byte> load_data | ( | const std::string & | file | ) |
Load bytes from file.
References anonymous_namespace{unittest.cpp}::get_testdata_dir().
std::vector<uint8_t> load_test_audio | ( | ) |
Load test audio for the voice channel tests.
References anonymous_namespace{unittest.cpp}::get_testdata_dir().
void set_status | ( | test_t & | test, |
test_status_t | status, | ||
std::string_view | message = {} |
||
) |
Sets a test's status.
test | The test to set the status of |
status | Status to set the test to |
References test_t::description, get_time(), is_skipped(), dpp::unicode_emoji::lock, dpp::unicode_emoji::m, test_t::status, ts_failed, ts_skipped, ts_started, and ts_success.
Referenced by anonymous_namespace{coro.cpp}::async_test(), anonymous_namespace{coro.cpp}::simple_awaitable::await_suspend(), anonymous_namespace{coro.cpp}::job_awaitable::await_suspend(), coro_offline_tests(), anonymous_namespace{coro.cpp}::coroutine_offline_test(), event_handler_test(), anonymous_namespace{coro.cpp}::job_offline_test(), set_test(), skip_test(), start_test(), and anonymous_namespace{coro.cpp}::task_offline_test().
void set_test | ( | test_t & | test, |
bool | success = false |
||
) |
Sets a test's status (legacy)
test | The test to set the status of |
success | If set to true, sets success to true, if set to false and called once, sets executed to true, if called twice, also sets success to false. This means that before you run the test you should call this function once with success set to false, then if/wen the test completes call it again with true. If the test fails, call it a second time with false, or not at all. |
References set_status(), test_t::status, ts_failed, ts_not_executed, ts_started, and ts_success.
Referenced by message_collector::completed(), and main().
void skip_test | ( | test_t & | test | ) |
Sets a test's status to ts_skipped.
test | The test to set the status of |
References set_status(), and ts_skipped.
void start_test | ( | test_t & | test | ) |
Sets a test's status to ts_started.
test | The test to set the status of |
References set_status(), and ts_started.
Referenced by coro_offline_tests(), coro_online_tests(), and event_handler_test().
int test_summary | ( | ) |
Prints a summary of all tests executed.
tests | List of tests executed |
References coro, extended, get_time(), offline, tests, tf_coro, tf_extended, tf_online, ts_not_executed, ts_skipped, and ts_success.
void wait_for_tests | ( | ) |
Wait for all tests to be completed or test program to time out.
References get_time(), is_skipped(), TEST_TIMEOUT, tests, ts_skipped, and ts_started.
bool extended = false |
Referenced by event_handler_test(), is_skipped(), main(), and test_summary().
bool offline = false |
Referenced by get_token(), is_skipped(), main(), and test_summary().
double start = dpp::utility::time_f() |
dpp::snowflake TEST_EVENT_ID = std::stoull((getenv( "TEST_EVENT_ID" ) && *(getenv( "TEST_EVENT_ID" )) ? getenv( "TEST_EVENT_ID" ) : "0")) |
Referenced by main().
dpp::snowflake TEST_GUILD_ID = std::stoull((getenv( "TEST_GUILD_ID" ) && *(getenv( "TEST_GUILD_ID" )) ? getenv( "TEST_GUILD_ID" ) : "0")) |
Referenced by event_handler_test(), and main().
dpp::snowflake TEST_TEXT_CHANNEL_ID = std::stoull((getenv( "TEST_TEXT_CHANNEL_ID" ) && *(getenv( "TEST_TEXT_CHANNEL_ID" )) ? getenv( "TEST_TEXT_CHANNEL_ID" ) : "0")) |
Referenced by main().
dpp::snowflake TEST_USER_ID = std::stoull((getenv( "TEST_USER_ID" ) && *(getenv( "TEST_USER_ID" )) ? getenv( "TEST_USER_ID" ) : "0")) |
Referenced by event_handler_test(), and main().
dpp::snowflake TEST_VC_ID = std::stoull((getenv( "TEST_VC_ID" ) && *(getenv( "TEST_VC_ID" )) ? getenv( "TEST_VC_ID" ) : "0")) |
Referenced by main().