HART  0.1.0
High level Audio Regression and Testing
Loading...
Searching...
No Matches
Test Runner

Runs the tests. More...

Classes

class  AudioTestBuilder< SampleType >
 A DSP host used for building and running tests inside a test case. More...
 
class  TestRegistry
 Runs the test cases. More...
 

Macros

#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.
 

Enumerations

enum class  Save { always , whenFails , never }
 Determines when to save a file. More...
 

Functions

template<typename DSPType >
AudioTestBuilder< typename std::decay< DSPType >::type::SampleTypePublicAlias > processAudioWith (DSPType &&dsp)
 Call this to start building your test.
 
template<typename DSPType >
AudioTestBuilder< typename DSPType::SampleTypePublicAlias > processAudioWith (std::unique_ptr< DSPType > &&dsp)
 Call this to start building your test.
 

Detailed Description

Runs the tests.

Macro Definition Documentation

◆ HART_TEST_WITH_TAGS

#define HART_TEST_WITH_TAGS (   name,
  tags 
)    HART_ITEM_WITH_TAGS(name, tags, hart::TaskCategory::test)

Declares a test case with tags.

Warning
Tags aren't supported yet
Parameters
nameName for the test case
tagsTags like "[my-tag-1][my-tag-2]"

Definition at line 55 of file hart.hpp.

◆ HART_GENERATE_WITH_TAGS

#define HART_GENERATE_WITH_TAGS (   name,
  tags 
)    HART_ITEM_WITH_TAGS(name, tags, hart::TaskCategory::generate)

Declares a generator with tags.

Pretty much the same as a usual test case, but will be called only if the --run-generators CLI flag is set

Warning
Tags aren't supported yet
Parameters
nameName for the generator
tagsTags like "[my-tag-1][my-tag-2]"

Definition at line 63 of file hart.hpp.

◆ HART_TEST

#define HART_TEST (   name)    HART_TEST_WITH_TAGS(name, "")

Declares a test case.

Parameters
nameName for the test case

Definition at line 68 of file hart.hpp.

◆ HART_GENERATE

#define HART_GENERATE (   name)    HART_GENERATE_WITH_TAGS(name, "")

Declares a generator.

Pretty much the same as a usual test case, but will be called only if the --run-generators CLI flag is set

Parameters
nameName for generator

Definition at line 74 of file hart.hpp.

◆ HART_REQUIRES_DATA_PATH_ARG

#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.

For example, when using relative paths to the wav files. The test will instantly fail is the path is not set.

Definition at line 85 of file hart.hpp.

◆ HART_RUN_ALL_TESTS

#define HART_RUN_ALL_TESTS (   argc,
  argv 
)
Value:
do \
{ \
hart::CLIConfig::getInstance().initCommandLineArgs(); \
CLI11_PARSE (hart::CLIConfig::getInstance().getCLIApp(), argc, argv); \
return hart::TestRegistry::getInstance().runAll(); \
} \
while (false);
static TestRegistry & getInstance()
Gets the singleton instance.
static CLIConfig & getInstance()

Runs all tests or generators @prief Place this macro in your main() function.

Definition at line 91 of file hart.hpp.

Enumeration Type Documentation

◆ Save

enum class Save
strong

Determines when to save a file.

Enumerator
always 

File will be saved always, after the test is performed.

whenFails 

File will be saved only when the test has failed.

never 

File will not be saved.

Definition at line 28 of file hart_process_audio.hpp.

Function Documentation

◆ processAudioWith() [1/2]

template<typename DSPType >
AudioTestBuilder< typename std::decay< DSPType >::type::SampleTypePublicAlias > processAudioWith ( DSPType &&  dsp)
related

Call this to start building your test.

Parameters
dspInstance of your DSP effect
Returns
AudioTestBuilder instance - you can chain a bunch of test parameters with it.

Definition at line 564 of file hart_process_audio.hpp.

◆ processAudioWith() [2/2]

template<typename DSPType >
AudioTestBuilder< typename DSPType::SampleTypePublicAlias > processAudioWith ( std::unique_ptr< DSPType > &&  dsp)
related

Call this to start building your test.

Call this for DSP objects that do not support moving or copying

Parameters
dspInstance of your DSP effect wrapped in a smart pointer
Returns
AudioTestBuilder instance - you can chain a bunch of test parameters with it.

Definition at line 576 of file hart_process_audio.hpp.