Skip to content

File testing.hh

FileList > ase > testing.hh

  • #include <ase/utils.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 (__VA_ARGS__))
Print a message about a passing benchmark.
define TCHECK (cond, ...)
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)) > (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 (__VA_ARGS__))
Print a message from a test program.
define TOK () do {} while (0)
define TPASS (...) Ase::Test::test_output ('P', ::Ase::string_format (__VA_ARGS__))
Print a message about a passing test.
define TSTART (...) Ase::Test::test_output ('S', ::Ase::string_format (__VA_ARGS__))
Print message once a test case starts.

Macro Definition Documentation

define TASSERT

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

define TASSERT_AT

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

define TBENCH

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

define TCHECK

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

define TCMP

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

define TCMPS

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

define TDONE

#define TDONE (

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

define TEST_ADD

#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

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

define TNOTE

#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

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

define TSTART

#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