Testing¶
Unit Testing¶
Macros to facilitate unit testing.
- Note
This file is part of Empirical, https://github.com/devosoft/Empirical
- Copyright
Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
- Date
2015-2019
- Note
Status: RESURGENT (Was depricated; now back to ALPHA)
Defines
-
EMP_TEST_MACRO
(MACRO, EXP_RESULT) Input: A macro call and a strings indicating the expected result. Output: Code that tests of the macro result matches the expected results, and optionally print it (if in verbose mode or if the macro fails to produce the expected result.)
-
EMP_TEST_VALUE
(VALUE, EXP_RESULT) Take in an expression and a string representing the expected result; verify that the stringifyied result is the expected string AND print this info if -v flag is set. Input: An expression and an expected evaluation. Output: Code to evaluate the expression and optionally print it (if either in verbose mode or the macro does not produce the expected result).
-
EMP_REQUIRE
(VALUE)
-
EMP_TEST_APPROX
(...)
-
EMP_TEST_APPROX_impl
(VALUE, EXP_RESULT, THRESHOLD, ...)
-
emp_test_main
()
-
namespace
emp
If we are in emscripten, make sure to include the header.
Functions
-
UnitTestOutput &
GetUnitTestOutput
()
-
struct
UnitTestOutput
Public Types
-
enum
Mode
Values:
-
enumerator
SILENT
-
enumerator
NORMAL
-
enumerator
VERBOSE
-
enumerator
Public Members
-
UnitTestOutput::Mode
verbose
= UnitTestOutput::Mode::NORMAL
-
size_t
num_tests
= 0
-
size_t
errors
= 0
-
bool
abort
= false
-
enum
-
UnitTestOutput &