HART  0.1.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(msg)   throw hart::TestAssertException (std::string ("HART_FAIL_TEST_MSG() triggered test fail at line ") + std::to_string (__LINE__) + " with message: \"" + msg + '\"')
 
#define HART_FAIL_TEST()   throw hart::TestAssertException (std::string ("HART_FAIL_TEST() triggered test fail at line ") + std::to_string (__LINE__))
 
#define HART_ASSERT_TRUE(cond)    if (!(cond)) throw hart::TestAssertException (std::string ("HART_ASSERT_TRUE() failed at line ") + std::to_string (__LINE__) + ": \"" #cond "\"");
 
#define HART_EXPECT_TRUE(cond)    if (!(cond)) hart::ExpectationFailureMessages::get().emplace_back (std::string ("HART_EXPECT_TRUE() failed at line ") + std::to_string (__LINE__) + ": \"" #cond "\"");
 
#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 @prief Place this macro in your main() function.
 
#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_FAIL_TEST_MSG

#define HART_FAIL_TEST_MSG (   msg)    throw hart::TestAssertException (std::string ("HART_FAIL_TEST_MSG() triggered test fail at line ") + std::to_string (__LINE__) + " with message: \"" + msg + '\"')

Definition at line 25 of file hart.hpp.

◆ HART_FAIL_TEST

#define HART_FAIL_TEST ( )    throw hart::TestAssertException (std::string ("HART_FAIL_TEST() triggered test fail at line ") + std::to_string (__LINE__))

Definition at line 26 of file hart.hpp.

◆ HART_ASSERT_TRUE

#define HART_ASSERT_TRUE (   cond)     if (!(cond)) throw hart::TestAssertException (std::string ("HART_ASSERT_TRUE() failed at line ") + std::to_string (__LINE__) + ": \"" #cond "\"");

Definition at line 28 of file hart.hpp.

◆ HART_EXPECT_TRUE

#define HART_EXPECT_TRUE (   cond)     if (!(cond)) hart::ExpectationFailureMessages::get().emplace_back (std::string ("HART_EXPECT_TRUE() failed at line ") + std::to_string (__LINE__) + ": \"" #cond "\"");

Definition at line 31 of file hart.hpp.

◆ HART_CONCAT_IMPL

#define HART_CONCAT_IMPL (   x,
 
)    x##y

Definition at line 34 of file hart.hpp.

◆ HART_CONCAT

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

Definition at line 35 of file hart.hpp.

◆ HART_UNIQUE_ID

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

Definition at line 36 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, 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:36

Definition at line 38 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 101 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 104 of file hart.hpp.