D++ (DPP)  10.0.30
C++ Discord API Bot Library
test.h File Reference
#include <dpp/dpp.h>
#include <dpp/json_fwd.h>
#include <iomanip>
#include <type_traits>
Include dependency graph for test.h:
This graph shows which files directly or indirectly include this file:

Classes

class  message_collector
 A test version of the message collector for use in unit tests. More...
 
class  test_cached_object_t
 
struct  test_t
 
struct  user_project_id_t
 Convenience functor to get the snowflake of a certain type. More...
 

Macros

#define DPP_CHECK(test, check, var)   DPP_RUNTIME_CHECK(test, check, var)
 
#define DPP_CHECK_CONSTRUCT_ASSIGN(test, type, var)
 
#define DPP_COMPILETIME_CHECK(test, check, var)   static_assert(check, #test ": " #check)
 
#define DPP_RUNTIME_CHECK(test, check, var)   if (!check) { var = false; set_status(test, ts_failed, "check failed: " #check); }
 
#define DPP_TEST(name, desc, flags)   inline test_t name = {#name, desc, flags}
 
#define multiparam_api_test_list(func_name, param, return_type, testname)
 Perform a test of a REST base API call with one parameter that returns a list. More...
 
#define noparam_api_test(func_name, return_type, testname)
 Perform a test of a REST base API call with no parameters. More...
 
#define SAFE_GETENV(var)   (getenv(var) && *(getenv(var)) ? getenv(var) : "0")
 
#define SHARED_OBJECT   "libdpp.so"
 
#define singleparam_api_test(func_name, param, return_type, testname)
 Perform a test of a REST base API call with one parameter. More...
 
#define singleparam_api_test_list(func_name, param, return_type, testname)
 Perform a test of a REST base API call with one parameter that returns a list. More...
 
#define twoparam_api_test(func_name, param1, param2, return_type, testname)
 Perform a test of a REST base API call with one parameter. More...
 
#define twoparam_api_test_list(func_name, param1, param2, return_type, testname)
 Perform a test of a REST base API call with two parameters. More...
 

Typedefs

using json = nlohmann::json
 

Enumerations

enum  test_flags_t {
  tf_offline = 0,
  tf_online = 1,
  tf_extended = 1 << 1,
  tf_coro = 1 << 2
}
 
enum  test_status_t {
  ts_not_executed = 0,
  ts_started,
  ts_skipped,
  ts_success,
  ts_failed
}
 

Functions

void coro_offline_tests ()
 
void coro_online_tests (dpp::cluster *bot)
 
double get_start_time ()
 Get the start time of tests. More...
 
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 status, std::string_view message={})
 Sets a test's status. More...
 
void set_test (test_t &test, bool success=false)
 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

test_t APPCOMMAND = {"APPCOMMAND", "Creation of application command" , tf_online }
 
test_t AUTOMOD_RULE_CREATE = {"AUTOMOD_RULE_CREATE", "cluster::automod_rule_create" , tf_online }
 
test_t AUTOMOD_RULE_DELETE = {"AUTOMOD_RULE_DELETE", "cluster::automod_rule_delete" , tf_online }
 
test_t AUTOMOD_RULE_GET = {"AUTOMOD_RULE_GET", "cluster::automod_rule_get" , tf_online }
 
test_t AUTOMOD_RULE_GET_ALL = {"AUTOMOD_RULE_GET_ALL", "cluster::automod_rules_get" , tf_online }
 
test_t BASE64ENC = {"BASE64ENC", "Base 64 encoding" , tf_offline }
 
test_t BOTSTART = {"BOTSTART", "cluster::start method" , tf_online }
 
test_t CACHE = {"CACHE", "Test guild cache" , tf_online }
 
test_t CHANNEL_GET_MENTION = {"CHANNEL_GET_MENTION", "channel::get_mention" , tf_offline }
 
test_t CHANNEL_GET_URL = {"CHANNEL_GET_URL", "channel::get_url" , tf_offline }
 
test_t CHANNEL_SET_TYPE = {"CHANNEL_SET_TYPE", "channel::set_type" , tf_offline }
 
test_t CHANNELCACHE = {"CHANNELCACHE", "find_channel()" , tf_online }
 
test_t CHANNELTYPES = {"CHANNELTYPES", "channel type flags" , tf_online }
 
test_t CLUSTER = {"CLUSTER", "Instantiate DPP cluster" , tf_offline }
 
test_t COMPARISON = {"COMPARISON", "manged object comparison" , tf_offline }
 
test_t CONNECTION = {"CONNECTION", "Connection to client websocket" , tf_online }
 
constexpr bool coro = true
 
test_t CORO_API_CALLS = {"CORO_API_CALLS", "coro: online api calls" , tf_online | tf_coro }
 
test_t CORO_ASYNC_OFFLINE = {"CORO_ASYNC_OFFLINE", "coro: offline async" , tf_offline | tf_coro }
 
test_t CORO_COROUTINE_OFFLINE = {"CORO_COROUTINE_OFFLINE", "coro: offline coroutine" , tf_offline | tf_coro }
 
test_t CORO_EVENT_HANDLER = {"CORO_EVENT_HANDLER", "coro: online event handler" , tf_online | tf_coro }
 
test_t CORO_JOB_OFFLINE = {"CORO_JOB_OFFLINE", "coro: offline job" , tf_offline | tf_coro }
 
test_t CORO_MUMBO_JUMBO = {"CORO_MUMBO_JUMBO", "coro: online mumbo jumbo in event handler" , tf_online | tf_coro | tf_extended }
 
test_t CORO_TASK_OFFLINE = {"CORO_TASK_OFFLINE", "coro: offline task" , tf_offline | tf_coro }
 
test_t CURRENTUSER = {"CURRENTUSER", "cluster::current_user_get()" , tf_online }
 
test_t CUSTOMCACHE = {"CUSTOMCACHE", "Instantiate a cache" , tf_offline }
 
test_t DELCOMMAND = {"DELCOMMAND", "Deletion of application command" , tf_online }
 
test_t EDITEVENT = {"EDITEVENT", "Message edit event" , tf_online }
 
test_t EMOJI_CREATE = {"EMOJI_CREATE", "cluster::guild_emoji_create" , tf_online }
 
test_t EMOJI_DELETE = {"EMOJI_DELETE", "cluster::guild_emoji_delete" , tf_online }
 
test_t EMOJI_GET = {"EMOJI_GET", "cluster::guild_emoji_get" , tf_online }
 
test_t EMOJI_GET_URL = {"EMOJI_GET_URL", "emoji::get_url" , tf_offline }
 
test_t ERRORS = {"ERRORS", "Human readable error translation" , tf_offline }
 
test_t EVENT_CLASS = {"EVENT_CLASS", "event class" , tf_offline }
 
bool extended
 
test_t FORUM_CHANNEL_DELETE = {"FORUM_CHANNEL_DELETE", "delete the created forum channel" , tf_online }
 
test_t FORUM_CHANNEL_GET = {"FORUM_CHANNEL_GET", "retrieve the created forum channel" , tf_online }
 
test_t FORUM_CREATION = {"FORUM_CREATION", "create a forum channel" , tf_online }
 
test_t GET_PARAMETER_WITH_SUBCOMMANDS = {"GET_PARAMETER_WITH_SUBCOMMANDS", "interaction_create_t::get_parameter() with subcommands" , tf_offline }
 
test_t GET_PARAMETER_WITHOUT_SUBCOMMANDS = {"GET_PARAMETER_WITHOUT_SUBCOMMANDS", "interaction_create_t::get_parameter() without subcommands" , tf_offline }
 
constexpr user_project_id_t get_user_snowflake
 Convenience lambda to get the user snowflake of a certain user type. More...
 
test_t GETBANS = {"GETBANS", "cluster::guild_get_bans()" , tf_online }
 
test_t GETCHAN = {"GETCHAN", "cluster::channel_get()" , tf_online }
 
test_t GETCHANS = {"GETCHANS", "cluster::channels_get()" , tf_online }
 
test_t GETEVENT = {"GETEVENT", "cluster::guild_event_get()" , tf_online }
 
test_t GETEVENTS = {"GETEVENTS", "cluster::guild_events_get()" , tf_online }
 
test_t GETEVENTUSERS = {"GETEVENTUSERS", "cluster::guild_event_users_get()" , tf_online }
 
test_t GETGUILD = {"GETGUILD", "cluster::guild_get()" , tf_online }
 
test_t GETINVS = {"GETINVS", "cluster::guild_get_invites()" , tf_online }
 
test_t GETPINS = {"GETPINS", "cluster::channel_pins_get()" , tf_online }
 
test_t GETROLES = {"GETROLES", "cluster::roles_get()" , tf_online }
 
test_t GUILD_BAN_CREATE = {"GUILD_BAN_CREATE", "cluster::guild_ban_add ban three deleted discord accounts" , tf_online }
 
test_t GUILD_BAN_DELETE = {"GUILD_BAN_DELETE", "cluster::guild_ban_delete unban the banned discord accounts" , tf_online }
 
test_t GUILD_BAN_GET = {"GUILD_BAN_GET", "cluster::guild_get_ban getting one of the banned accounts" , tf_online }
 
test_t GUILD_BANS_GET = {"GUILD_BANS_GET", "cluster::guild_get_bans get bans using the after-parameter" , tf_online }
 
test_t GUILD_EDIT = {"GUILD_EDIT", "cluster::guild_edit" , tf_online }
 
test_t GUILDCREATE = {"GUILDCREATE", "Receive guild create event" , tf_online }
 
test_t HOSTINFO = {"HOSTINFO", "https_client::get_host_info()" , tf_offline }
 
test_t HTTP = {"HTTP", "https_client HTTP request" , tf_offline }
 
test_t HTTPS = {"HTTPS", "https_client HTTPS request" , tf_online }
 
test_t ICONHASH = {"ICONHASH", "utility::iconhash" , tf_offline }
 
test_t INVALIDUTF8 = {"INVALIDUTF8", "Invalid UTF-8 handling" , tf_online }
 
test_t INVITE_CREATE = {"INVITE_CREATE", "cluster::channel_invite_create" , tf_online }
 
test_t INVITE_CREATE_EVENT = {"INVITE_CREATE_EVENT", "cluster::on_invite_create" , tf_online }
 
test_t INVITE_DELETE = {"INVITE_DELETE", "cluster::invite_delete" , tf_online }
 
test_t INVITE_DELETE_EVENT = {"INVITE_DELETE_EVENT", "cluster::on_invite_delete" , tf_online }
 
test_t INVITE_GET = {"INVITE_GET", "cluster::invite_get" , tf_online }
 
constexpr auto is_owner
 Convenience lambda to check if a certain user is the owner of the test bot, mostly meant to be passed to standard algorithms. More...
 
test_t JSON_INTERFACE = {"JSON_INTERFACE", "dpp::json_interface class" , tf_offline }
 
test_t JSON_PARSE_ERROR = {"JSON_PARSE_ERROR", "JSON parse error for post_rest" , tf_online }
 
test_t LOGGER = {"LOGGER", "Log events" , tf_online }
 
test_t MD_ESC_1 = {"MD_ESC_1", "Markdown escaping (ignore code block contents)" , tf_offline }
 
test_t MD_ESC_2 = {"MD_ESC_2", "Markdown escaping (escape code block contents)" , tf_offline }
 
test_t MEMBER_GET = {"MEMBER_GET", "cluster::guild_get_member" , tf_online }
 
test_t MESSAGE_GET_URL = {"MESSAGE_GET_URL", "message::get_url" , tf_offline }
 
test_t MESSAGECREATE = {"MESSAGECREATE", "Creation of a channel message" , tf_online }
 
test_t MESSAGEDELETE = {"MESSAGEDELETE", "Deletion of a channel message" , tf_online }
 
test_t MESSAGEEDIT = {"MESSAGEEDIT", "Editing a channel message" , tf_online }
 
test_t MESSAGEFILE = {"MESSAGEFILE", "Message attachment send and check" , tf_online }
 
test_t MESSAGEPIN = {"MESSAGEPIN", "Pinning a channel message" , tf_online | tf_extended }
 
test_t MESSAGERECEIVE = {"MESSAGERECEIVE", "Receipt of a created message" , tf_online }
 
test_t MESSAGESGET = {"MESSAGESGET", "Get messages" , tf_online }
 
test_t MESSAGEUNPIN = {"MESSAGEUNPIN", "Unpinning a channel message" , tf_online | tf_extended }
 
test_t MSGCOLLECT = {"MSGCOLLECT", "message_collector" , tf_online }
 
test_t MSGCREATESEND = {"MSGCREATESEND", "message_create_t::send()" , tf_online }
 
test_t MULTIHEADER = {"MULTIHEADER", "multiheader cookie test" , tf_offline | tf_extended }
 
bool offline
 
test_t ONESHOT = {"ONESHOT", "one-shot timer" , tf_online }
 
test_t OPTCHOICE_BOOL = {"OPTCHOICE_BOOL", "command_option_choice::fill_from_json: bool" , tf_offline }
 
test_t OPTCHOICE_DOUBLE = {"OPTCHOICE_DOUBLE", "command_option_choice::fill_from_json: double" , tf_offline }
 
test_t OPTCHOICE_INT = {"OPTCHOICE_INT", "command_option_choice::fill_from_json: int64_t" , tf_offline }
 
test_t OPTCHOICE_SNOWFLAKE = {"OPTCHOICE_SNOWFLAKE", "command_option_choice::fill_from_json: snowflake" , tf_offline }
 
test_t OPTCHOICE_STRING = {"OPTCHOICE_STRING", "command_option_choice::fill_from_json: string" , tf_offline }
 
test_t PERMISSION_CLASS = {"PERMISSION_CLASS", "permission" , tf_offline }
 
test_t POLL_CREATE = {"POLL_CREATE", "Creating a poll" , tf_online }
 
test_t POLL_END = {"POLL_END", "Ending a poll" , tf_online }
 
test_t PRESENCE = {"PRESENCE", "Presence intent" , tf_online }
 
test_t REACT = {"REACT", "React to a message" , tf_online }
 
test_t REACTEVENT = {"REACTEVENT", "Reaction event" , tf_online }
 
test_t READFILE = {"READFILE", "utility::read_file()" , tf_offline }
 
test_t REQUEST_GET_IMAGE = {"REQUEST_GET_IMAGE", "using the cluster::request method to fetch an image" , tf_online }
 
test_t ROLE_COMPARE = {"ROLE_COMPARE", "role::operator<" , tf_offline }
 
test_t ROLE_CREATE = {"ROLE_CREATE", "cluster::role_create" , tf_online }
 
test_t ROLE_DELETE = {"ROLE_DELETE", "cluster::role_delete" , tf_online }
 
test_t ROLE_EDIT = {"ROLE_EDIT", "cluster::role_edit" , tf_online }
 
test_t RUNONCE = {"RUNONCE", "run_once<T>" , tf_offline }
 
test_t SNOWFLAKE = {"SNOWFLAKE", "dpp::snowflake class" , tf_offline }
 
test_t STICKER_GET_URL = {"STICKER_GET_URL", "sticker::get_url aka utility::cdn_endpoint_url_sticker" , tf_offline }
 
test_t SYNC = {"SYNC", "sync<T>()" , tf_online }
 
dpp::snowflake TEST_EVENT_ID
 
dpp::snowflake TEST_GUILD_ID
 
dpp::snowflake TEST_TEXT_CHANNEL_ID
 
const int64_t TEST_TIMEOUT = 60
 
dpp::snowflake TEST_USER_ID
 
dpp::snowflake TEST_VC_ID
 
std::vector< test_t * > tests = {}
 
test_t THREAD_CREATE = {"THREAD_CREATE", "cluster::thread_create" , tf_online }
 
test_t THREAD_CREATE_EVENT = {"THREAD_CREATE_EVENT", "cluster::on_thread_create event" , tf_online }
 
test_t THREAD_CREATE_MESSAGE = {"THREAD_CREATE_MESSAGE", "cluster::thread_create_with_message" , tf_online | tf_extended }
 
test_t THREAD_DELETE = {"THREAD_DELETE", "cluster::channel_delete with thread" , tf_online }
 
test_t THREAD_DELETE_EVENT = {"THREAD_DELETE_EVENT", "cluster::on_thread_delete event" , tf_online }
 
test_t THREAD_EDIT = {"THREAD_EDIT", "cluster::thread_edit" , tf_online }
 
test_t THREAD_GET_ACTIVE = {"THREAD_GET_ACTIVE", "cluster::threads_get_active" , tf_online }
 
test_t THREAD_MEMBER_ADD = {"THREAD_MEMBER_ADD", "cluster::thread_member_add" , tf_online | tf_extended }
 
test_t THREAD_MEMBER_GET = {"THREAD_MEMBER_GET", "cluster::thread_member_get" , tf_online | tf_extended }
 
test_t THREAD_MEMBER_REMOVE = {"THREAD_MEMBER_REMOVE", "cluster::thread_member_remove" , tf_online | tf_extended }
 
test_t THREAD_MEMBERS_ADD_EVENT = {"THREAD_MEMBERS_ADD_EVENT", "cluster::on_thread_members_update event with member addition" , tf_online | tf_extended }
 
test_t THREAD_MEMBERS_GET = {"THREAD_MEMBERS_GET", "cluster::thread_members_get" , tf_online | tf_extended }
 
test_t THREAD_MEMBERS_REMOVE_EVENT = {"THREAD_MEMBERS_REMOVE_EVENT", "cluster::on_thread_members_update event with member removal" , tf_online | tf_extended }
 
test_t THREAD_MESSAGE = {"THREAD_MESSAGE", "message manipulation in thread" , tf_online | tf_extended }
 
test_t THREAD_MESSAGE_CREATE_EVENT = {"THREAD_MESSAGE_CREATE_EVENT", "cluster::on_message_create in thread" , tf_online | tf_extended }
 
test_t THREAD_MESSAGE_DELETE_EVENT = {"THREAD_MESSAGE_DELETE_EVENT", "cluster::on_message_delete in thread" , tf_online | tf_extended }
 
test_t THREAD_MESSAGE_EDIT_EVENT = {"THREAD_MESSAGE_EDIT_EVENT", "cluster::on_message_edit in thread" , tf_online | tf_extended }
 
test_t THREAD_MESSAGE_REACT_ADD_EVENT = {"THREAD_MESSAGE_REACT_ADD_EVENT", "cluster::on_reaction_add in thread" , tf_online | tf_extended }
 
test_t THREAD_MESSAGE_REACT_REMOVE_EVENT = {"THREAD_MESSAGE_REACT_REMOVE_EVENT", "cluster::on_reaction_remove in thread" , tf_online | tf_extended }
 
test_t THREAD_UPDATE_EVENT = {"THREAD_UPDATE_EVENT", "cluster::on_thread_update event" , tf_online }
 
test_t TIMEDLISTENER = {"TIMEDLISTENER", "timed listener" , tf_online }
 
test_t TIMERSTART = {"TIMERSTART", "start timer" , tf_online }
 
test_t TIMERSTOP = {"TIMERSTOP", "stop timer" , tf_online }
 
test_t TIMESTAMP = {"TIMESTAMP", "crossplatform_strptime()" , tf_online }
 
test_t TIMESTAMPTOSTRING = {"TIMESTAMPTOSTRING", "ts_to_string()" , tf_offline }
 
test_t TIMESTRINGTOTIMESTAMP = {"TIMESTRINGTOTIMESTAMP", "ts_not_null()" , tf_offline }
 
test_t TS = {"TS", "managed::get_creation_date()" , tf_online }
 
test_t URLENC = {"URLENC", "URL encoding" , tf_offline }
 
test_t USER_FORMAT_USERNAME = {"USER_FORMAT_USERNAME", "user::format_username" , tf_offline }
 
test_t USER_GET = {"USER_GET", "cluster::user_get" , tf_online }
 
test_t USER_GET_AVATAR_URL = {"USER_GET_AVATAR_URL", "user::get_avatar_url" , tf_offline }
 
test_t USER_GET_CACHED_ABSENT = {"USER_GET_CACHED_ABSENT", "cluster::user_get_cached_sync() with not present member" , tf_online }
 
test_t USER_GET_CACHED_PRESENT = {"USER_GET_CACHED_PRESENT", "cluster::user_get_cached_sync() with present member" , tf_online }
 
test_t USER_GET_CREATION_TIME = {"USER_GET_CREATION_TIME", "user::get_creation_time" , tf_offline }
 
test_t USER_GET_FLAGS = {"USER_GET_FLAGS", "cluster::user_get flag parsing" , tf_online }
 
test_t USER_GET_MENTION = {"USER_GET_MENTION", "user::get_mention" , tf_offline }
 
test_t USER_GET_URL = {"USER_GET_URL", "user::get_url" , tf_offline }
 
test_t USERCACHE = {"USERCACHE", "Test user cache" , tf_online }
 
test_t UTILITY_AVATAR_SIZE = {"UTILITY_AVATAR_SIZE", "utility::avatar_size" , tf_offline }
 
test_t UTILITY_CDN_ENDPOINT_URL_HASH = {"UTILITY_CDN_ENDPOINT_URL_HASH", "utility::cdn_endpoint_url_hash" , tf_offline }
 
test_t UTILITY_CHANNEL_MENTION = {"UTILITY_CHANNEL_MENTION", "utility::channel_mention" , tf_offline }
 
test_t UTILITY_CHANNEL_URL = {"UTILITY_CHANNEL_URL", "utility::channel_url" , tf_offline }
 
test_t UTILITY_EMOJI_MENTION = {"UTILITY_EMOJI_MENTION", "utility::emoji_mention" , tf_offline }
 
test_t UTILITY_GUILD_NAVIGATION = {"UTILITY_GUILD_NAVIGATION", "utility::guild_navigation" , tf_offline }
 
test_t UTILITY_ICONHASH = {"UTILITY_ICONHASH", "utility::iconhash" , tf_offline }
 
test_t UTILITY_MAKE_URL_PARAMETERS = {"UTILITY_MAKE_URL_PARAMETERS", "utility::make_url_parameters" , tf_offline }
 
test_t UTILITY_MARKDOWN_ESCAPE = {"UTILITY_MARKDOWN_ESCAPE", "utility::markdown_escape" , tf_offline }
 
test_t UTILITY_MESSAGE_URL = {"UTILITY_MESSAGE_URL", "utility::message_url" , tf_offline }
 
test_t UTILITY_ROLE_MENTION = {"UTILITY_ROLE_MENTION", "utility::role_mention" , tf_offline }
 
test_t UTILITY_SLASHCOMMAND_MENTION = {"UTILITY_SLASHCOMMAND_MENTION", "utility::slashcommand_mention" , tf_offline }
 
test_t UTILITY_THREAD_URL = {"UTILITY_THREAD_URL", "utility::thread_url" , tf_offline }
 
test_t UTILITY_TOKENIZE = {"UTILITY_TOKENIZE", "utility::tokenize" , tf_offline }
 
test_t UTILITY_URL_ENCODE = {"UTILITY_URL_ENCODE", "utility::url_encode" , tf_offline }
 
test_t UTILITY_USER_MENTION = {"UTILITY_USER_MENTION", "utility::user_mention" , tf_offline }
 
test_t UTILITY_USER_URL = {"UTILITY_USER_URL", "utility::user_url" , tf_offline }
 
test_t VOICE_CHANNEL_CREATE = {"VOICE_CHANNEL_CREATE", "creating a voice channel" , tf_online }
 
test_t VOICE_CHANNEL_DELETE = {"VOICE_CHANNEL_DELETE", "deleting the created voice channel" , tf_online }
 
test_t VOICE_CHANNEL_EDIT = {"VOICE_CHANNEL_EDIT", "editing the created voice channel" , tf_online }
 
test_t VOICECONN = {"VOICECONN", "Connect to voice channel" , tf_online | tf_extended }
 
test_t VOICESEND = {"VOICESEND", "Send audio to voice channel" , tf_online | tf_extended }
 
test_t WEBHOOK = {"WEBHOOK", "webhook construct from URL" , tf_offline }
 

Macro Definition Documentation

◆ DPP_CHECK

#define DPP_CHECK (   test,
  check,
  var 
)    DPP_RUNTIME_CHECK(test, check, var)

◆ DPP_CHECK_CONSTRUCT_ASSIGN

#define DPP_CHECK_CONSTRUCT_ASSIGN (   test,
  type,
  var 
)
Value:
do { \
DPP_CHECK(test, std::is_default_constructible_v<type>, var); \
DPP_CHECK(test, std::is_copy_constructible_v<type>, var); \
DPP_CHECK(test, std::is_move_constructible_v<type>, var); \
DPP_CHECK(test, std::is_copy_assignable_v<type>, var); \
DPP_CHECK(test, std::is_move_assignable_v<type>, var); \
} while(0)

◆ DPP_COMPILETIME_CHECK

#define DPP_COMPILETIME_CHECK (   test,
  check,
  var 
)    static_assert(check, #test ": " #check)

◆ DPP_RUNTIME_CHECK

#define DPP_RUNTIME_CHECK (   test,
  check,
  var 
)    if (!check) { var = false; set_status(test, ts_failed, "check failed: " #check); }

◆ DPP_TEST

#define DPP_TEST (   name,
  desc,
  flags 
)    inline test_t name = {#name, desc, flags}

◆ multiparam_api_test_list

#define multiparam_api_test_list (   func_name,
  param,
  return_type,
  testname 
)
Value:
set_test(testname, false); \
if (!offline) { \
bot.func_name (param, 0, 0, 1000, [&](const dpp::confirmation_callback_t &cc) { \
if (!cc.is_error()) { \
return_type g = std::get<return_type>(cc.value); \
if (g.size() > 0) { \
set_test(testname, true); \
} else { \
set_test(testname, false); \
bot.log(dpp::ll_debug, cc.http_info.body); \
} \
} else { \
set_test(testname, false); \
bot.log(dpp::ll_debug, cc.http_info.body); \
} \
}); \
}

Perform a test of a REST base API call with one parameter that returns a list.

◆ noparam_api_test

#define noparam_api_test (   func_name,
  return_type,
  testname 
)
Value:
set_test(testname, false); \
if (!offline) { \
bot.func_name ([&](const dpp::confirmation_callback_t &cc) { \
if (!cc.is_error()) { \
return_type g = std::get<return_type>(cc.value); \
set_test(testname, true); \
} else { \
bot.log(dpp::ll_debug, cc.http_info.body); \
set_test(testname, false); \
} \
}); \
}

Perform a test of a REST base API call with no parameters.

◆ SAFE_GETENV

#define SAFE_GETENV (   var)    (getenv(var) && *(getenv(var)) ? getenv(var) : "0")

◆ SHARED_OBJECT

#define SHARED_OBJECT   "libdpp.so"

◆ singleparam_api_test

#define singleparam_api_test (   func_name,
  param,
  return_type,
  testname 
)
Value:
set_test(testname, false); \
if (!offline) { \
bot.func_name (param, [&](const dpp::confirmation_callback_t &cc) { \
if (!cc.is_error()) { \
return_type g = std::get<return_type>(cc.value); \
if (g.id == param) { \
set_test(testname, true); \
} else { \
bot.log(dpp::ll_debug, cc.http_info.body); \
set_test(testname, false); \
} \
} else { \
bot.log(dpp::ll_debug, cc.http_info.body); \
set_test(testname, false); \
} \
}); \
}

Perform a test of a REST base API call with one parameter.

◆ singleparam_api_test_list

#define singleparam_api_test_list (   func_name,
  param,
  return_type,
  testname 
)
Value:
set_test(testname, false); \
if (!offline) { \
bot.func_name (param, [&](const dpp::confirmation_callback_t &cc) { \
if (!cc.is_error()) { \
return_type g = std::get<return_type>(cc.value); \
if (g.size() > 0) { \
set_test(testname, true); \
} else { \
set_test(testname, false); \
bot.log(dpp::ll_debug, cc.http_info.body); \
} \
} else { \
set_test(testname, false); \
bot.log(dpp::ll_debug, cc.http_info.body); \
} \
}); \
}

Perform a test of a REST base API call with one parameter that returns a list.

◆ twoparam_api_test

#define twoparam_api_test (   func_name,
  param1,
  param2,
  return_type,
  testname 
)
Value:
set_test(testname, false); \
if (!offline) { \
bot.func_name (param1, param2, [&](const dpp::confirmation_callback_t &cc) { \
if (!cc.is_error()) { \
return_type g = std::get<return_type>(cc.value); \
if (g.id > 0) { \
set_test(testname, true); \
} else { \
bot.log(dpp::ll_debug, cc.http_info.body); \
set_test(testname, false); \
} \
} else { \
bot.log(dpp::ll_debug, cc.http_info.body); \
set_test(testname, false); \
} \
}); \
}

Perform a test of a REST base API call with one parameter.

◆ twoparam_api_test_list

#define twoparam_api_test_list (   func_name,
  param1,
  param2,
  return_type,
  testname 
)
Value:
set_test(testname, false); \
if (!offline) { \
bot.func_name (param1, param2, [&](const dpp::confirmation_callback_t &cc) { \
if (!cc.is_error()) { \
return_type g = std::get<return_type>(cc.value); \
if (g.size() > 0) { \
set_test(testname, true); \
} else { \
bot.log(dpp::ll_debug, cc.http_info.body); \
set_test(testname, false); \
} \
} else { \
bot.log(dpp::ll_debug, cc.http_info.body); \
set_test(testname, false); \
} \
}); \
}

Perform a test of a REST base API call with two parameters.

Typedef Documentation

◆ json

using json = nlohmann::json

Enumeration Type Documentation

◆ test_flags_t

Enumerator
tf_offline 
tf_online 
tf_extended 
tf_coro 

◆ test_status_t

Enumerator
ts_not_executed 
ts_started 
ts_skipped 
ts_success 
ts_failed 

Function Documentation

◆ coro_offline_tests()

◆ coro_online_tests()

void coro_online_tests ( dpp::cluster bot)

References CORO_EVENT_HANDLER, event_handler_test(), and start_test().

Here is the call graph for this function:

◆ get_start_time()

double get_start_time ( )

Get the start time of tests.

Returns
double start time in fractional seconds

References start.

Referenced by get_time(), and main().

Here is the caller graph for this function:

◆ get_time()

double get_time ( )

Get the current execution time in seconds.

Returns
double fractional seconds

References get_start_time(), and dpp::utility::time_f().

Referenced by crossplatform_strptime(), set_status(), test_summary(), and wait_for_tests().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_token()

std::string get_token ( )

Get the token from the environment variable DPP_UNIT_TEST_TOKEN.

Returns
std::string token
Note
If the environment variable does not exist, this will exit the program.

References offline.

Referenced by main().

Here is the caller graph for this function:

◆ is_skipped()

bool is_skipped ( const test_t test)

Check if a test is/should be skipped.

Returns
bool Whether the 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().

Here is the caller graph for this function:

◆ load_data()

std::vector<std::byte> load_data ( const std::string &  file)

Load bytes from file.

Returns
std::vector<std::byte> File data

References anonymous_namespace{unittest.cpp}::get_testdata_dir().

Here is the call graph for this function:

◆ load_test_audio()

std::vector<uint8_t> load_test_audio ( )

Load test audio for the voice channel tests.

Returns
std::vector<uint8_t> data and size for test audio

References anonymous_namespace{unittest.cpp}::get_testdata_dir().

Here is the call graph for this function:

◆ set_status()

◆ set_test()

void set_test ( test_t test,
bool  success = false 
)

Sets a test's status (legacy)

Parameters
testThe test to set the status of
successIf 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ skip_test()

void skip_test ( test_t test)

Sets a test's status to ts_skipped.

Parameters
testThe test to set the status of

References set_status(), and ts_skipped.

Here is the call graph for this function:

◆ start_test()

void start_test ( test_t test)

Sets a test's status to ts_started.

Parameters
testThe test to set the status of

References set_status(), and ts_started.

Referenced by coro_offline_tests(), coro_online_tests(), and event_handler_test().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_summary()

int test_summary ( )

Prints a summary of all tests executed.

Parameters
testsList of tests executed
Returns
int Returns number of failed tests, for use as a return value from the main() function

References coro, extended, get_time(), offline, tests, tf_coro, tf_extended, tf_online, ts_not_executed, ts_skipped, and ts_success.

Here is the call graph for this function:

◆ wait_for_tests()

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.

Here is the call graph for this function:

Variable Documentation

◆ APPCOMMAND

test_t APPCOMMAND = {"APPCOMMAND", "Creation of application command" , tf_online }
inline

◆ AUTOMOD_RULE_CREATE

test_t AUTOMOD_RULE_CREATE = {"AUTOMOD_RULE_CREATE", "cluster::automod_rule_create" , tf_online }
inline

◆ AUTOMOD_RULE_DELETE

test_t AUTOMOD_RULE_DELETE = {"AUTOMOD_RULE_DELETE", "cluster::automod_rule_delete" , tf_online }
inline

◆ AUTOMOD_RULE_GET

test_t AUTOMOD_RULE_GET = {"AUTOMOD_RULE_GET", "cluster::automod_rule_get" , tf_online }
inline

◆ AUTOMOD_RULE_GET_ALL

test_t AUTOMOD_RULE_GET_ALL = {"AUTOMOD_RULE_GET_ALL", "cluster::automod_rules_get" , tf_online }
inline

◆ BASE64ENC

test_t BASE64ENC = {"BASE64ENC", "Base 64 encoding" , tf_offline }
inline

Referenced by main().

◆ BOTSTART

test_t BOTSTART = {"BOTSTART", "cluster::start method" , tf_online }
inline

◆ CACHE

test_t CACHE = {"CACHE", "Test guild cache" , tf_online }
inline

◆ CHANNEL_GET_MENTION

test_t CHANNEL_GET_MENTION = {"CHANNEL_GET_MENTION", "channel::get_mention" , tf_offline }
inline

◆ CHANNEL_GET_URL

test_t CHANNEL_GET_URL = {"CHANNEL_GET_URL", "channel::get_url" , tf_offline }
inline

◆ CHANNEL_SET_TYPE

test_t CHANNEL_SET_TYPE = {"CHANNEL_SET_TYPE", "channel::set_type" , tf_offline }
inline

◆ CHANNELCACHE

test_t CHANNELCACHE = {"CHANNELCACHE", "find_channel()" , tf_online }
inline

◆ CHANNELTYPES

test_t CHANNELTYPES = {"CHANNELTYPES", "channel type flags" , tf_online }
inline

◆ CLUSTER

test_t CLUSTER = {"CLUSTER", "Instantiate DPP cluster" , tf_offline }
inline

◆ COMPARISON

test_t COMPARISON = {"COMPARISON", "manged object comparison" , tf_offline }
inline

Referenced by main().

◆ CONNECTION

test_t CONNECTION = {"CONNECTION", "Connection to client websocket" , tf_online }
inline

◆ coro

constexpr bool coro = true
inlineconstexpr

Referenced by is_skipped(), and test_summary().

◆ CORO_API_CALLS

test_t CORO_API_CALLS = {"CORO_API_CALLS", "coro: online api calls" , tf_online | tf_coro }
inline

Referenced by event_handler_test().

◆ CORO_ASYNC_OFFLINE

test_t CORO_ASYNC_OFFLINE = {"CORO_ASYNC_OFFLINE", "coro: offline async" , tf_offline | tf_coro }
inline

◆ CORO_COROUTINE_OFFLINE

test_t CORO_COROUTINE_OFFLINE = {"CORO_COROUTINE_OFFLINE", "coro: offline coroutine" , tf_offline | tf_coro }
inline

◆ CORO_EVENT_HANDLER

test_t CORO_EVENT_HANDLER = {"CORO_EVENT_HANDLER", "coro: online event handler" , tf_online | tf_coro }
inline

Referenced by coro_online_tests().

◆ CORO_JOB_OFFLINE

test_t CORO_JOB_OFFLINE = {"CORO_JOB_OFFLINE", "coro: offline job" , tf_offline | tf_coro }
inline

◆ CORO_MUMBO_JUMBO

test_t CORO_MUMBO_JUMBO = {"CORO_MUMBO_JUMBO", "coro: online mumbo jumbo in event handler" , tf_online | tf_coro | tf_extended }
inline

Referenced by event_handler_test().

◆ CORO_TASK_OFFLINE

test_t CORO_TASK_OFFLINE = {"CORO_TASK_OFFLINE", "coro: offline task" , tf_offline | tf_coro }
inline

◆ CURRENTUSER

test_t CURRENTUSER = {"CURRENTUSER", "cluster::current_user_get()" , tf_online }
inline

◆ CUSTOMCACHE

test_t CUSTOMCACHE = {"CUSTOMCACHE", "Instantiate a cache" , tf_offline }
inline

◆ DELCOMMAND

test_t DELCOMMAND = {"DELCOMMAND", "Deletion of application command" , tf_online }
inline

◆ EDITEVENT

test_t EDITEVENT = {"EDITEVENT", "Message edit event" , tf_online }
inline

◆ EMOJI_CREATE

test_t EMOJI_CREATE = {"EMOJI_CREATE", "cluster::guild_emoji_create" , tf_online }
inline

◆ EMOJI_DELETE

test_t EMOJI_DELETE = {"EMOJI_DELETE", "cluster::guild_emoji_delete" , tf_online }
inline

◆ EMOJI_GET

test_t EMOJI_GET = {"EMOJI_GET", "cluster::guild_emoji_get" , tf_online }
inline

◆ EMOJI_GET_URL

test_t EMOJI_GET_URL = {"EMOJI_GET_URL", "emoji::get_url" , tf_offline }
inline

◆ ERRORS

test_t ERRORS = {"ERRORS", "Human readable error translation" , tf_offline }
inline

Referenced by main().

◆ EVENT_CLASS

test_t EVENT_CLASS = {"EVENT_CLASS", "event class" , tf_offline }
inline

◆ extended

bool extended

◆ FORUM_CHANNEL_DELETE

test_t FORUM_CHANNEL_DELETE = {"FORUM_CHANNEL_DELETE", "delete the created forum channel" , tf_online }
inline

◆ FORUM_CHANNEL_GET

test_t FORUM_CHANNEL_GET = {"FORUM_CHANNEL_GET", "retrieve the created forum channel" , tf_online }
inline

◆ FORUM_CREATION

test_t FORUM_CREATION = {"FORUM_CREATION", "create a forum channel" , tf_online }
inline

◆ GET_PARAMETER_WITH_SUBCOMMANDS

test_t GET_PARAMETER_WITH_SUBCOMMANDS = {"GET_PARAMETER_WITH_SUBCOMMANDS", "interaction_create_t::get_parameter() with subcommands" , tf_offline }
inline

◆ GET_PARAMETER_WITHOUT_SUBCOMMANDS

test_t GET_PARAMETER_WITHOUT_SUBCOMMANDS = {"GET_PARAMETER_WITHOUT_SUBCOMMANDS", "interaction_create_t::get_parameter() without subcommands" , tf_offline }
inline

◆ get_user_snowflake

constexpr user_project_id_t get_user_snowflake
inlineconstexpr

Convenience lambda to get the user snowflake of a certain user type.

See also
user_project_id_t

◆ GETBANS

test_t GETBANS = {"GETBANS", "cluster::guild_get_bans()" , tf_online }
inline

◆ GETCHAN

test_t GETCHAN = {"GETCHAN", "cluster::channel_get()" , tf_online }
inline

◆ GETCHANS

test_t GETCHANS = {"GETCHANS", "cluster::channels_get()" , tf_online }
inline

◆ GETEVENT

test_t GETEVENT = {"GETEVENT", "cluster::guild_event_get()" , tf_online }
inline

◆ GETEVENTS

test_t GETEVENTS = {"GETEVENTS", "cluster::guild_events_get()" , tf_online }
inline

◆ GETEVENTUSERS

test_t GETEVENTUSERS = {"GETEVENTUSERS", "cluster::guild_event_users_get()" , tf_online }
inline

◆ GETGUILD

test_t GETGUILD = {"GETGUILD", "cluster::guild_get()" , tf_online }
inline

◆ GETINVS

test_t GETINVS = {"GETINVS", "cluster::guild_get_invites()" , tf_online }
inline

◆ GETPINS

test_t GETPINS = {"GETPINS", "cluster::channel_pins_get()" , tf_online }
inline

◆ GETROLES

test_t GETROLES = {"GETROLES", "cluster::roles_get()" , tf_online }
inline

◆ GUILD_BAN_CREATE

test_t GUILD_BAN_CREATE = {"GUILD_BAN_CREATE", "cluster::guild_ban_add ban three deleted discord accounts" , tf_online }
inline

◆ GUILD_BAN_DELETE

test_t GUILD_BAN_DELETE = {"GUILD_BAN_DELETE", "cluster::guild_ban_delete unban the banned discord accounts" , tf_online }
inline

◆ GUILD_BAN_GET

test_t GUILD_BAN_GET = {"GUILD_BAN_GET", "cluster::guild_get_ban getting one of the banned accounts" , tf_online }
inline

◆ GUILD_BANS_GET

test_t GUILD_BANS_GET = {"GUILD_BANS_GET", "cluster::guild_get_bans get bans using the after-parameter" , tf_online }
inline

◆ GUILD_EDIT

test_t GUILD_EDIT = {"GUILD_EDIT", "cluster::guild_edit" , tf_online }
inline

◆ GUILDCREATE

test_t GUILDCREATE = {"GUILDCREATE", "Receive guild create event" , tf_online }
inline

◆ HOSTINFO

test_t HOSTINFO = {"HOSTINFO", "https_client::get_host_info()" , tf_offline }
inline

Referenced by main().

◆ HTTP

test_t HTTP = {"HTTP", "https_client HTTP request" , tf_offline }
inline

◆ HTTPS

test_t HTTPS = {"HTTPS", "https_client HTTPS request" , tf_online }
inline

Referenced by main().

◆ ICONHASH

test_t ICONHASH = {"ICONHASH", "utility::iconhash" , tf_offline }
inline

◆ INVALIDUTF8

test_t INVALIDUTF8 = {"INVALIDUTF8", "Invalid UTF-8 handling" , tf_online }
inline

◆ INVITE_CREATE

test_t INVITE_CREATE = {"INVITE_CREATE", "cluster::channel_invite_create" , tf_online }
inline

◆ INVITE_CREATE_EVENT

test_t INVITE_CREATE_EVENT = {"INVITE_CREATE_EVENT", "cluster::on_invite_create" , tf_online }
inline

◆ INVITE_DELETE

test_t INVITE_DELETE = {"INVITE_DELETE", "cluster::invite_delete" , tf_online }
inline

◆ INVITE_DELETE_EVENT

test_t INVITE_DELETE_EVENT = {"INVITE_DELETE_EVENT", "cluster::on_invite_delete" , tf_online }
inline

◆ INVITE_GET

test_t INVITE_GET = {"INVITE_GET", "cluster::invite_get" , tf_online }
inline

◆ is_owner

constexpr auto is_owner
inlineconstexpr
Initial value:
= [](auto &&user) noexcept {
}

Convenience lambda to check if a certain user is the owner of the test bot, mostly meant to be passed to standard algorithms.

See also
get_user_snowflake
Returns
bool whether the user is the test bot owner

◆ JSON_INTERFACE

test_t JSON_INTERFACE = {"JSON_INTERFACE", "dpp::json_interface class" , tf_offline }
inline

◆ JSON_PARSE_ERROR

test_t JSON_PARSE_ERROR = {"JSON_PARSE_ERROR", "JSON parse error for post_rest" , tf_online }
inline

◆ LOGGER

test_t LOGGER = {"LOGGER", "Log events" , tf_online }
inline

◆ MD_ESC_1

test_t MD_ESC_1 = {"MD_ESC_1", "Markdown escaping (ignore code block contents)" , tf_offline }
inline

Referenced by main().

◆ MD_ESC_2

test_t MD_ESC_2 = {"MD_ESC_2", "Markdown escaping (escape code block contents)" , tf_offline }
inline

Referenced by main().

◆ MEMBER_GET

test_t MEMBER_GET = {"MEMBER_GET", "cluster::guild_get_member" , tf_online }
inline

◆ MESSAGE_GET_URL

test_t MESSAGE_GET_URL = {"MESSAGE_GET_URL", "message::get_url" , tf_offline }
inline

◆ MESSAGECREATE

test_t MESSAGECREATE = {"MESSAGECREATE", "Creation of a channel message" , tf_online }
inline

◆ MESSAGEDELETE

test_t MESSAGEDELETE = {"MESSAGEDELETE", "Deletion of a channel message" , tf_online }
inline

◆ MESSAGEEDIT

test_t MESSAGEEDIT = {"MESSAGEEDIT", "Editing a channel message" , tf_online }
inline

◆ MESSAGEFILE

test_t MESSAGEFILE = {"MESSAGEFILE", "Message attachment send and check" , tf_online }
inline

◆ MESSAGEPIN

test_t MESSAGEPIN = {"MESSAGEPIN", "Pinning a channel message" , tf_online | tf_extended }
inline

◆ MESSAGERECEIVE

test_t MESSAGERECEIVE = {"MESSAGERECEIVE", "Receipt of a created message" , tf_online }
inline

◆ MESSAGESGET

test_t MESSAGESGET = {"MESSAGESGET", "Get messages" , tf_online }
inline

◆ MESSAGEUNPIN

test_t MESSAGEUNPIN = {"MESSAGEUNPIN", "Unpinning a channel message" , tf_online | tf_extended }
inline

◆ MSGCOLLECT

test_t MSGCOLLECT = {"MSGCOLLECT", "message_collector" , tf_online }
inline

◆ MSGCREATESEND

test_t MSGCREATESEND = {"MSGCREATESEND", "message_create_t::send()" , tf_online }
inline

◆ MULTIHEADER

test_t MULTIHEADER = {"MULTIHEADER", "multiheader cookie test" , tf_offline | tf_extended }
inline

◆ offline

bool offline

◆ ONESHOT

test_t ONESHOT = {"ONESHOT", "one-shot timer" , tf_online }
inline

◆ OPTCHOICE_BOOL

test_t OPTCHOICE_BOOL = {"OPTCHOICE_BOOL", "command_option_choice::fill_from_json: bool" , tf_offline }
inline

◆ OPTCHOICE_DOUBLE

test_t OPTCHOICE_DOUBLE = {"OPTCHOICE_DOUBLE", "command_option_choice::fill_from_json: double" , tf_offline }
inline

◆ OPTCHOICE_INT

test_t OPTCHOICE_INT = {"OPTCHOICE_INT", "command_option_choice::fill_from_json: int64_t" , tf_offline }
inline

◆ OPTCHOICE_SNOWFLAKE

test_t OPTCHOICE_SNOWFLAKE = {"OPTCHOICE_SNOWFLAKE", "command_option_choice::fill_from_json: snowflake" , tf_offline }
inline

◆ OPTCHOICE_STRING

test_t OPTCHOICE_STRING = {"OPTCHOICE_STRING", "command_option_choice::fill_from_json: string" , tf_offline }
inline

◆ PERMISSION_CLASS

test_t PERMISSION_CLASS = {"PERMISSION_CLASS", "permission" , tf_offline }
inline

◆ POLL_CREATE

test_t POLL_CREATE = {"POLL_CREATE", "Creating a poll" , tf_online }
inline

◆ POLL_END

test_t POLL_END = {"POLL_END", "Ending a poll" , tf_online }
inline

◆ PRESENCE

test_t PRESENCE = {"PRESENCE", "Presence intent" , tf_online }
inline

◆ REACT

test_t REACT = {"REACT", "React to a message" , tf_online }
inline

◆ REACTEVENT

test_t REACTEVENT = {"REACTEVENT", "Reaction event" , tf_online }
inline

◆ READFILE

test_t READFILE = {"READFILE", "utility::read_file()" , tf_offline }
inline

◆ REQUEST_GET_IMAGE

test_t REQUEST_GET_IMAGE = {"REQUEST_GET_IMAGE", "using the cluster::request method to fetch an image" , tf_online }
inline

◆ ROLE_COMPARE

test_t ROLE_COMPARE = {"ROLE_COMPARE", "role::operator<" , tf_offline }
inline

◆ ROLE_CREATE

test_t ROLE_CREATE = {"ROLE_CREATE", "cluster::role_create" , tf_online }
inline

◆ ROLE_DELETE

test_t ROLE_DELETE = {"ROLE_DELETE", "cluster::role_delete" , tf_online }
inline

◆ ROLE_EDIT

test_t ROLE_EDIT = {"ROLE_EDIT", "cluster::role_edit" , tf_online }
inline

◆ RUNONCE

test_t RUNONCE = {"RUNONCE", "run_once<T>" , tf_offline }
inline

◆ SNOWFLAKE

test_t SNOWFLAKE = {"SNOWFLAKE", "dpp::snowflake class" , tf_offline }
inline

◆ STICKER_GET_URL

test_t STICKER_GET_URL = {"STICKER_GET_URL", "sticker::get_url aka utility::cdn_endpoint_url_sticker" , tf_offline }
inline

◆ SYNC

test_t SYNC = {"SYNC", "sync<T>()" , tf_online }
inline

◆ TEST_EVENT_ID

dpp::snowflake TEST_EVENT_ID

Referenced by main().

◆ TEST_GUILD_ID

dpp::snowflake TEST_GUILD_ID

Referenced by event_handler_test(), and main().

◆ TEST_TEXT_CHANNEL_ID

dpp::snowflake TEST_TEXT_CHANNEL_ID

Referenced by main().

◆ TEST_TIMEOUT

const int64_t TEST_TIMEOUT = 60

Referenced by wait_for_tests().

◆ TEST_USER_ID

dpp::snowflake TEST_USER_ID

Referenced by event_handler_test(), and main().

◆ TEST_VC_ID

dpp::snowflake TEST_VC_ID

Referenced by main().

◆ tests

std::vector<test_t *> tests = {}
inline

Referenced by test_summary(), and wait_for_tests().

◆ THREAD_CREATE

test_t THREAD_CREATE = {"THREAD_CREATE", "cluster::thread_create" , tf_online }
inline

◆ THREAD_CREATE_EVENT

test_t THREAD_CREATE_EVENT = {"THREAD_CREATE_EVENT", "cluster::on_thread_create event" , tf_online }
inline

◆ THREAD_CREATE_MESSAGE

test_t THREAD_CREATE_MESSAGE = {"THREAD_CREATE_MESSAGE", "cluster::thread_create_with_message" , tf_online | tf_extended }
inline

◆ THREAD_DELETE

test_t THREAD_DELETE = {"THREAD_DELETE", "cluster::channel_delete with thread" , tf_online }
inline

◆ THREAD_DELETE_EVENT

test_t THREAD_DELETE_EVENT = {"THREAD_DELETE_EVENT", "cluster::on_thread_delete event" , tf_online }
inline

◆ THREAD_EDIT

test_t THREAD_EDIT = {"THREAD_EDIT", "cluster::thread_edit" , tf_online }
inline

◆ THREAD_GET_ACTIVE

test_t THREAD_GET_ACTIVE = {"THREAD_GET_ACTIVE", "cluster::threads_get_active" , tf_online }
inline

◆ THREAD_MEMBER_ADD

test_t THREAD_MEMBER_ADD = {"THREAD_MEMBER_ADD", "cluster::thread_member_add" , tf_online | tf_extended }
inline

◆ THREAD_MEMBER_GET

test_t THREAD_MEMBER_GET = {"THREAD_MEMBER_GET", "cluster::thread_member_get" , tf_online | tf_extended }
inline

◆ THREAD_MEMBER_REMOVE

test_t THREAD_MEMBER_REMOVE = {"THREAD_MEMBER_REMOVE", "cluster::thread_member_remove" , tf_online | tf_extended }
inline

◆ THREAD_MEMBERS_ADD_EVENT

test_t THREAD_MEMBERS_ADD_EVENT = {"THREAD_MEMBERS_ADD_EVENT", "cluster::on_thread_members_update event with member addition" , tf_online | tf_extended }
inline

◆ THREAD_MEMBERS_GET

test_t THREAD_MEMBERS_GET = {"THREAD_MEMBERS_GET", "cluster::thread_members_get" , tf_online | tf_extended }
inline

◆ THREAD_MEMBERS_REMOVE_EVENT

test_t THREAD_MEMBERS_REMOVE_EVENT = {"THREAD_MEMBERS_REMOVE_EVENT", "cluster::on_thread_members_update event with member removal" , tf_online | tf_extended }
inline

◆ THREAD_MESSAGE

test_t THREAD_MESSAGE = {"THREAD_MESSAGE", "message manipulation in thread" , tf_online | tf_extended }
inline

◆ THREAD_MESSAGE_CREATE_EVENT

test_t THREAD_MESSAGE_CREATE_EVENT = {"THREAD_MESSAGE_CREATE_EVENT", "cluster::on_message_create in thread" , tf_online | tf_extended }
inline

◆ THREAD_MESSAGE_DELETE_EVENT

test_t THREAD_MESSAGE_DELETE_EVENT = {"THREAD_MESSAGE_DELETE_EVENT", "cluster::on_message_delete in thread" , tf_online | tf_extended }
inline

◆ THREAD_MESSAGE_EDIT_EVENT

test_t THREAD_MESSAGE_EDIT_EVENT = {"THREAD_MESSAGE_EDIT_EVENT", "cluster::on_message_edit in thread" , tf_online | tf_extended }
inline

◆ THREAD_MESSAGE_REACT_ADD_EVENT

test_t THREAD_MESSAGE_REACT_ADD_EVENT = {"THREAD_MESSAGE_REACT_ADD_EVENT", "cluster::on_reaction_add in thread" , tf_online | tf_extended }
inline

◆ THREAD_MESSAGE_REACT_REMOVE_EVENT

test_t THREAD_MESSAGE_REACT_REMOVE_EVENT = {"THREAD_MESSAGE_REACT_REMOVE_EVENT", "cluster::on_reaction_remove in thread" , tf_online | tf_extended }
inline

◆ THREAD_UPDATE_EVENT

test_t THREAD_UPDATE_EVENT = {"THREAD_UPDATE_EVENT", "cluster::on_thread_update event" , tf_online }
inline

◆ TIMEDLISTENER

test_t TIMEDLISTENER = {"TIMEDLISTENER", "timed listener" , tf_online }
inline

◆ TIMERSTART

test_t TIMERSTART = {"TIMERSTART", "start timer" , tf_online }
inline

◆ TIMERSTOP

test_t TIMERSTOP = {"TIMERSTOP", "stop timer" , tf_online }
inline

◆ TIMESTAMP

test_t TIMESTAMP = {"TIMESTAMP", "crossplatform_strptime()" , tf_online }
inline

◆ TIMESTAMPTOSTRING

test_t TIMESTAMPTOSTRING = {"TIMESTAMPTOSTRING", "ts_to_string()" , tf_offline }
inline

◆ TIMESTRINGTOTIMESTAMP

test_t TIMESTRINGTOTIMESTAMP = {"TIMESTRINGTOTIMESTAMP", "ts_not_null()" , tf_offline }
inline

◆ TS

test_t TS = {"TS", "managed::get_creation_date()" , tf_online }
inline

◆ URLENC

test_t URLENC = {"URLENC", "URL encoding" , tf_offline }
inline

Referenced by main().

◆ USER_FORMAT_USERNAME

test_t USER_FORMAT_USERNAME = {"USER_FORMAT_USERNAME", "user::format_username" , tf_offline }
inline

◆ USER_GET

test_t USER_GET = {"USER_GET", "cluster::user_get" , tf_online }
inline

◆ USER_GET_AVATAR_URL

test_t USER_GET_AVATAR_URL = {"USER_GET_AVATAR_URL", "user::get_avatar_url" , tf_offline }
inline

◆ USER_GET_CACHED_ABSENT

test_t USER_GET_CACHED_ABSENT = {"USER_GET_CACHED_ABSENT", "cluster::user_get_cached_sync() with not present member" , tf_online }
inline

◆ USER_GET_CACHED_PRESENT

test_t USER_GET_CACHED_PRESENT = {"USER_GET_CACHED_PRESENT", "cluster::user_get_cached_sync() with present member" , tf_online }
inline

◆ USER_GET_CREATION_TIME

test_t USER_GET_CREATION_TIME = {"USER_GET_CREATION_TIME", "user::get_creation_time" , tf_offline }
inline

◆ USER_GET_FLAGS

test_t USER_GET_FLAGS = {"USER_GET_FLAGS", "cluster::user_get flag parsing" , tf_online }
inline

◆ USER_GET_MENTION

test_t USER_GET_MENTION = {"USER_GET_MENTION", "user::get_mention" , tf_offline }
inline

◆ USER_GET_URL

test_t USER_GET_URL = {"USER_GET_URL", "user::get_url" , tf_offline }
inline

◆ USERCACHE

test_t USERCACHE = {"USERCACHE", "Test user cache" , tf_online }
inline

◆ UTILITY_AVATAR_SIZE

test_t UTILITY_AVATAR_SIZE = {"UTILITY_AVATAR_SIZE", "utility::avatar_size" , tf_offline }
inline

◆ UTILITY_CDN_ENDPOINT_URL_HASH

test_t UTILITY_CDN_ENDPOINT_URL_HASH = {"UTILITY_CDN_ENDPOINT_URL_HASH", "utility::cdn_endpoint_url_hash" , tf_offline }
inline

◆ UTILITY_CHANNEL_MENTION

test_t UTILITY_CHANNEL_MENTION = {"UTILITY_CHANNEL_MENTION", "utility::channel_mention" , tf_offline }
inline

◆ UTILITY_CHANNEL_URL

test_t UTILITY_CHANNEL_URL = {"UTILITY_CHANNEL_URL", "utility::channel_url" , tf_offline }
inline

◆ UTILITY_EMOJI_MENTION

test_t UTILITY_EMOJI_MENTION = {"UTILITY_EMOJI_MENTION", "utility::emoji_mention" , tf_offline }
inline

◆ UTILITY_GUILD_NAVIGATION

test_t UTILITY_GUILD_NAVIGATION = {"UTILITY_GUILD_NAVIGATION", "utility::guild_navigation" , tf_offline }
inline

◆ UTILITY_ICONHASH

test_t UTILITY_ICONHASH = {"UTILITY_ICONHASH", "utility::iconhash" , tf_offline }
inline

◆ UTILITY_MAKE_URL_PARAMETERS

test_t UTILITY_MAKE_URL_PARAMETERS = {"UTILITY_MAKE_URL_PARAMETERS", "utility::make_url_parameters" , tf_offline }
inline

◆ UTILITY_MARKDOWN_ESCAPE

test_t UTILITY_MARKDOWN_ESCAPE = {"UTILITY_MARKDOWN_ESCAPE", "utility::markdown_escape" , tf_offline }
inline

◆ UTILITY_MESSAGE_URL

test_t UTILITY_MESSAGE_URL = {"UTILITY_MESSAGE_URL", "utility::message_url" , tf_offline }
inline

◆ UTILITY_ROLE_MENTION

test_t UTILITY_ROLE_MENTION = {"UTILITY_ROLE_MENTION", "utility::role_mention" , tf_offline }
inline

◆ UTILITY_SLASHCOMMAND_MENTION

test_t UTILITY_SLASHCOMMAND_MENTION = {"UTILITY_SLASHCOMMAND_MENTION", "utility::slashcommand_mention" , tf_offline }
inline

◆ UTILITY_THREAD_URL

test_t UTILITY_THREAD_URL = {"UTILITY_THREAD_URL", "utility::thread_url" , tf_offline }
inline

◆ UTILITY_TOKENIZE

test_t UTILITY_TOKENIZE = {"UTILITY_TOKENIZE", "utility::tokenize" , tf_offline }
inline

◆ UTILITY_URL_ENCODE

test_t UTILITY_URL_ENCODE = {"UTILITY_URL_ENCODE", "utility::url_encode" , tf_offline }
inline

◆ UTILITY_USER_MENTION

test_t UTILITY_USER_MENTION = {"UTILITY_USER_MENTION", "utility::user_mention" , tf_offline }
inline

◆ UTILITY_USER_URL

test_t UTILITY_USER_URL = {"UTILITY_USER_URL", "utility::user_url" , tf_offline }
inline

◆ VOICE_CHANNEL_CREATE

test_t VOICE_CHANNEL_CREATE = {"VOICE_CHANNEL_CREATE", "creating a voice channel" , tf_online }
inline

◆ VOICE_CHANNEL_DELETE

test_t VOICE_CHANNEL_DELETE = {"VOICE_CHANNEL_DELETE", "deleting the created voice channel" , tf_online }
inline

◆ VOICE_CHANNEL_EDIT

test_t VOICE_CHANNEL_EDIT = {"VOICE_CHANNEL_EDIT", "editing the created voice channel" , tf_online }
inline

◆ VOICECONN

test_t VOICECONN = {"VOICECONN", "Connect to voice channel" , tf_online | tf_extended }
inline

◆ VOICESEND

test_t VOICESEND = {"VOICESEND", "Send audio to voice channel" , tf_online | tf_extended }
inline

◆ WEBHOOK

test_t WEBHOOK = {"WEBHOOK", "webhook construct from URL" , tf_offline }
inline
get_user_snowflake
constexpr user_project_id_t get_user_snowflake
Convenience lambda to get the user snowflake of a certain user type.
Definition: test.h:551
TEST_USER_ID
dpp::snowflake TEST_USER_ID
Definition: unittest.cpp:33
dpp::ll_debug
@ ll_debug
Debug.
Definition: misc-enum.h:85
dpp::confirmation_callback_t::http_info
http_request_completion_t http_info
Information about the HTTP call used to make the request.
Definition: restresults.h:278
dpp::confirmation_callback_t::is_error
bool is_error() const
Returns true if the call resulted in an error rather than a legitimate value in the confirmation_call...
Definition: confirmation.cpp:66
dpp::confirmation_callback_t::value
confirmable_t value
Value returned, wrapped in variant.
Definition: restresults.h:283
set_test
void set_test(test_t &test, bool success=false)
Sets a test's status (legacy)
Definition: unittest.cpp:80
dpp::confirmation_callback_t
The results of a REST call wrapped in a convenient struct.
Definition: restresults.h:274
offline
bool offline
Definition: unittest.cpp:27
dpp::http_request_completion_t::body
std::string body
Reply body.
Definition: queues.h:181