HART  0.2.0
High level Audio Regression and Testing
Loading...
Searching...
No Matches
hart.hpp File Reference
Include dependency graph for hart.hpp:

Go to the source code of this file.

Namespaces

namespace  hart
 

Macros

#define HART_FAIL_TEST_MSG(message)   throw hart::TestAssertException (std::string ("HART_FAIL_TEST_MSG() triggered test fail at line ") + std::to_string (__LINE__) + " with message: \"" + message + '\"')
 Fails a test case unconditionally with a text message.
 
#define HART_FAIL_TEST()   throw hart::TestAssertException (std::string ("HART_FAIL_TEST() triggered test fail at line ") + std::to_string (__LINE__))
 Fails a test case unconditionally.
 
#define HART_ASSERT_TRUE(condition)    if (!(condition)) throw hart::TestAssertException (std::string ("HART_ASSERT_TRUE() failed at line ") + std::to_string (__LINE__) + ": \"" #condition "\"");
 Use to check some condition inside a test case. Failing will abort the test runner.
 
#define HART_EXPECT_TRUE(condition)    if (!(condition)) hart::ExpectationFailureMessages::get().emplace_back (std::string ("HART_EXPECT_TRUE() failed at line ") + std::to_string (__LINE__) + ": \"" #condition "\"");
 Use to check some condition inside a test case. Failing will not abort the test runner.
 
#define HART_CONCAT_IMPL(x, y)   x##y
 
#define HART_CONCAT(x, y)   HART_CONCAT_IMPL(x, y)
 
#define HART_UNIQUE_ID(x)   HART_CONCAT(x, __LINE__)
 
#define HART_ITEM_WITH_TAGS(name, tags, category)
 
#define HART_TEST_WITH_TAGS(name, tags)   HART_ITEM_WITH_TAGS(name, tags, hart::TaskCategory::test)
 Declares a test case with tags.
 
#define HART_GENERATE_WITH_TAGS(name, tags)   HART_ITEM_WITH_TAGS(name, tags, hart::TaskCategory::generate)
 Declares a generator with tags.
 
#define HART_TEST(name)   HART_TEST_WITH_TAGS(name, "")
 Declares a test case.
 
#define HART_GENERATE(name)   HART_GENERATE_WITH_TAGS(name, "")
 Declares a generator.
 
#define HART_REQUIRES_DATA_PATH_ARG   if (hart::CLIConfig::getInstance().getDataRootPath().empty()) { throw hart::ConfigurationError ("This test requires a data path set by the --data-root-path CLI argument, but it's empty"); }
 Put it at the beginning of your tese case if it requires a properly set data path.
 
#define HART_RUN_ALL_TESTS(argc, argv)
 Runs all tests or generators.
 
#define HART_DECLARE_ALIASES_FOR_FLOAT   using namespace hart::aliases_float
 Put it before you test cases to use hart classes without hart:: namespace prefix and explicit float template value.
 
#define HART_DECLARE_ALIASES_FOR_DOUBLE   using namespace hart::aliases_double
 Put it before you test cases to use hart classes without hart:: namespace prefix and explicit double template value.
 

Macro Definition Documentation

◆ HART_CONCAT_IMPL

#define HART_CONCAT_IMPL (   x,
 
)    x##y

Definition at line 49 of file hart.hpp.

◆ HART_CONCAT

#define HART_CONCAT (   x,
 
)    HART_CONCAT_IMPL(x, y)

Definition at line 50 of file hart.hpp.

◆ HART_UNIQUE_ID

#define HART_UNIQUE_ID (   x)    HART_CONCAT(x, __LINE__)

Definition at line 51 of file hart.hpp.

◆ HART_ITEM_WITH_TAGS

#define HART_ITEM_WITH_TAGS (   name,
  tags,
  category 
)
Value:
static void HART_UNIQUE_ID(HART_RunTask)(); \
namespace { \
struct HART_UNIQUE_ID(HART_RegistrarType) { \
HART_UNIQUE_ID(HART_RegistrarType)() { \
hart::TestRegistry::getInstance().add (name, tags, __FILE__, __LINE__, category, &HART_UNIQUE_ID (HART_RunTask)); \
} \
}; \
} \
static HART_UNIQUE_ID(HART_RegistrarType) HART_UNIQUE_ID(HART_registrar); \
static void HART_UNIQUE_ID(HART_RunTask)()
#define HART_UNIQUE_ID(x)
Definition hart.hpp:51

Definition at line 53 of file hart.hpp.

◆ HART_DECLARE_ALIASES_FOR_FLOAT

#define HART_DECLARE_ALIASES_FOR_FLOAT   using namespace hart::aliases_float

Put it before you test cases to use hart classes without hart:: namespace prefix and explicit float template value.

Definition at line 116 of file hart.hpp.

◆ HART_DECLARE_ALIASES_FOR_DOUBLE

#define HART_DECLARE_ALIASES_FOR_DOUBLE   using namespace hart::aliases_double

Put it before you test cases to use hart classes without hart:: namespace prefix and explicit double template value.

Definition at line 119 of file hart.hpp.