unit_tests.hpp

Macros to facilitate unit testing.

Todo:

Setup proper command line color handling (probably in its own file.)

Add EMP_TEST_BELOW, EMP_TEST_ABOVE, and EMP_TEST_RANGE to ensure that a value is in a certain range.

Consider adding EMP_TEST_ASSERT to ensure that the contained value is true.

Consider adding EMP_TEST_APPROX to compare within a tolerance level.

Note

Status: RESURGENT (Was deprecated; now back to ALPHA)

Defines

emp_test_main()

Functions

static UnitTestOutput &GetUnitTestOutput()
void ResolveUnitTest(bool pass, const std::string &test_input, const std::string &result, const std::string &exp_result, const std::string &filename, size_t line_num, bool is_require = false)
void SetupUnitTestArgs(vector<std::string> args)
int ProcessUnitTestResults()
struct UnitTestOutput
#include <unit_tests.hpp>

Public Types

enum Mode

Values:

enumerator SILENT
enumerator NORMAL
enumerator VERBOSE

Public Members

UnitTestOutput::Mode verbose = UnitTestOutput::Mode::NORMAL
size_t num_tests = 0
size_t errors = 0
bool abort = false