Skip to content

File testing.hh

FileList > ase > testing.hh

  • #include <ase/utils.hh>
  • #include <ase/strings.hh>

Namespaces

Type Name
namespace Ase
The Anklang C++ API namespace.
namespace Test
Helper namespace for unit testing.

Classes

Type Name
struct TestEntry
class Timer

Macros

Type Name
define TASSERT (cond) TASSERT\_\_AT (\_\_LINE\_\_, cond)
Unconditional test assertion, enters breakpoint if not fullfilled.
define TASSERT_AT (LINE, cond) TASSERT\_\_AT (LINE, cond)
Unconditional test assertion for deputy LINE .
define TBENCH (...) Ase::Test::test\_output ('B', [**::Ase::string\_format**](namespaceAse.md#function-string_format) (\_\_VA\_ARGS\_\_))
Print a message about a passing benchmark.
define TCHECK (cond, ...) /* multi line expression */
Verbose assertion, calls TPASS() on success./*#end#* /.
define TCMP (a, cmp, b) TCMP\_op (a,cmp,b,#a,#b,)
Compare a and__b according to operator__cmp , verbose on failiure.
define TCMPS (a, cmp, b) TCMP\_op (a,cmp,b,#a,#b,Ase::Test::\_as\_strptr)
Variant of TCMP() for C strings.
define TDONE () Ase::Test::test\_output ('D', "")
Print message for test case end.
define TEST_ADD (fun) static const ::Ase::Test::TestChain ASE\_CPP\_PASTE2 (\_\_Ase\_\_Test\_\_TestChain\_, \_\_LINE\_\_) (fun, ASE\_CPP\_STRINGIFY (fun), ::Ase::Test::PLAIN)
Register a function to run as part of the unit test suite.
define TEST_BENCH (fun) static const ::Ase::Test::TestChain ASE\_CPP\_PASTE2 (\_\_Ase\_\_Test\_\_TestChain\_, \_\_LINE\_\_) (fun, ASE\_CPP\_STRINGIFY (fun), ::Ase::Test::BENCH)
define TEST_BROKEN (fun) static const ::Ase::Test::TestChain ASE\_CPP\_PASTE2 (\_\_Ase\_\_Test\_\_TestChain\_, \_\_LINE\_\_) (fun, ASE\_CPP\_STRINGIFY (fun), ::Ase::Test::BROKEN)
define TEST_SLOW (fun) static const ::Ase::Test::TestChain ASE\_CPP\_PASTE2 (\_\_Ase\_\_Test\_\_TestChain\_, \_\_LINE\_\_) (fun, ASE\_CPP\_STRINGIFY (fun), ::Ase::Test::SLOW)
define TFLOATS (a, b, eps) do { if (fabsl ((long double) (a) - (long double) (b)) &gt; (long double) (eps)) TCMP (a,==,b); } while (0)
Test floats for equality while ignoring differences smaller than eps .
define TNOTE (...) Ase::Test::test\_output ('I', [**::Ase::string\_format**](namespaceAse.md#function-string_format) (\_\_VA\_ARGS\_\_))
Print a message from a test program.
define TOK () do {} while (0)
define TPASS (...) Ase::Test::test\_output ('P', [**::Ase::string\_format**](namespaceAse.md#function-string_format) (\_\_VA\_ARGS\_\_))
Print a message about a passing test.
define TSTART (...) Ase::Test::test\_output ('S', [**::Ase::string\_format**](namespaceAse.md#function-string_format) (\_\_VA\_ARGS\_\_))
Print message once a test case starts.

Macro Definition Documentation

define TASSERT

Unconditional test assertion, enters breakpoint if not fullfilled.

#define TASSERT (
    cond
) `TASSERT__AT (__LINE__, cond)`

define TASSERT_AT

Unconditional test assertion for deputy LINE .

#define TASSERT_AT (
    LINE,
    cond
) `TASSERT__AT (LINE, cond)`

define TBENCH

Print a message about a passing benchmark.

#define TBENCH (
    ...
) `Ase::Test::test_output ('B', ::Ase::string_format (__VA_ARGS__))`

define TCHECK

Verbose assertion, calls TPASS() on success./*#end#* /.

#define TCHECK (
    cond,
    ...
) `Ase::Test::test_output (bool (cond) ? 'P' : 'F', \ ::Ase::string_format (__VA_ARGS__))`

define TCMP

Compare a and__b according to operator__cmp , verbose on failiure.

#define TCMP (
    a,
    cmp,
    b
) `TCMP_op (a,cmp,b,#a,#b,)`

define TCMPS

Variant of TCMP() for C strings.

#define TCMPS (
    a,
    cmp,
    b
) `TCMP_op (a,cmp,b,#a,#b,Ase::Test::_as_strptr)`

define TDONE

Print message for test case end.

#define TDONE (

) `Ase::Test::test_output ('D', "")`

define TEST_ADD

Register a function to run as part of the unit test suite.

#define TEST_ADD (
    fun
) `static const ::Ase::Test::TestChain ASE_CPP_PASTE2 (__Ase__Test__TestChain_, __LINE__) (fun, ASE_CPP_STRINGIFY (fun), ::Ase::Test::PLAIN)`

define TEST_BENCH

#define TEST_BENCH (
    fun
) `static const ::Ase::Test::TestChain ASE_CPP_PASTE2 (__Ase__Test__TestChain_, __LINE__) (fun, ASE_CPP_STRINGIFY (fun), ::Ase::Test::BENCH)`

define TEST_BROKEN

#define TEST_BROKEN (
    fun
) `static const ::Ase::Test::TestChain ASE_CPP_PASTE2 (__Ase__Test__TestChain_, __LINE__) (fun, ASE_CPP_STRINGIFY (fun), ::Ase::Test::BROKEN)`

define TEST_SLOW

#define TEST_SLOW (
    fun
) `static const ::Ase::Test::TestChain ASE_CPP_PASTE2 (__Ase__Test__TestChain_, __LINE__) (fun, ASE_CPP_STRINGIFY (fun), ::Ase::Test::SLOW)`

define TFLOATS

Test floats for equality while ignoring differences smaller than eps .

#define TFLOATS (
    a,
    b,
    eps
) `do { if (fabsl ((long double) (a) - (long double) (b)) > (long double) (eps)) TCMP (a,==,b); } while (0)`

define TNOTE

Print a message from a test program.

#define TNOTE (
    ...
) `Ase::Test::test_output ('I', ::Ase::string_format (__VA_ARGS__))`

define TOK

#define TOK (

) `do {} while (0)`

Deprecated progress indicator, tests generally need to run fast.


define TPASS

Print a message about a passing test.

#define TPASS (
    ...
) `Ase::Test::test_output ('P', ::Ase::string_format (__VA_ARGS__))`

define TSTART

Print message once a test case starts.

#define TSTART (
    ...
) `Ase::Test::test_output ('S', ::Ase::string_format (__VA_ARGS__))`


The documentation for this class was generated from the following file /__w/anklang/anklang/ase/testing.hh