This class implements a test selector that parses test function strings and determines which tests should be executed.
More...
#include <TestSelector.h>
|
| | TestSelector (const std::string &testFunctions=std::string()) |
| | Creates a new test selector from a comma-separated list of test function names.
|
| |
| TestSelector | shouldRun (const std::string &testName) const |
| | Determines whether a test with the given name should be executed and returns a sub-selector for hierarchical filtering.
|
| |
| | operator bool () const |
| | Bool conversion operator to check if this selector indicates the test should run.
|
| |
| bool | runAll () const |
| | Returns whether all tests should be executed.
|
| |
|
| using | Patterns = std::unordered_set< std::string > |
| | Definition of an unordered set holding test patterns.
|
| |
|
| | TestSelector (Patterns &&patterns, bool shouldExecute) |
| | Creates a sub-selector for hierarchical test filtering.
|
| |
|
| static bool | matches (const std::string &pattern, const std::string &testName) |
| | Checks if a pattern matches a test name.
|
| |
This class implements a test selector that parses test function strings and determines which tests should be executed.
The selector supports hierarchical test names with dot notation (e.g., "frameconverter.rgb24.normal") and wildcard patterns.
Usage examples:
- Empty string: runs all tests
- "frameconverter": runs the frameconverter test and all its sub-tests
- "frameconverter*": runs all tests starting with "frameconverter"
- "frameconverterrgb24.rgb24tobgr24": runs only that specific sub-test
- "test1,test2,test3": runs test1, test2, and test3
Hierarchical matching example:
{
if (subSelector.shouldRun("char"))
{
}
}
This class implements a test selector that parses test function strings and determines which tests sh...
Definition TestSelector.h:51
TestSelector shouldRun(const std::string &testName) const
Determines whether a test with the given name should be executed and returns a sub-selector for hiera...
◆ Patterns
Definition of an unordered set holding test patterns.
◆ TestSelector() [1/2]
| Ocean::Test::TestSelector::TestSelector |
( |
const std::string & |
testFunctions = std::string() | ) |
|
|
explicit |
Creates a new test selector from a comma-separated list of test function names.
Test names are converted to lowercase automatically.
- Parameters
-
| testFunctions | Comma-separated list of test names, wildcards, or hierarchical test identifiers; empty string means run all tests |
◆ TestSelector() [2/2]
| Ocean::Test::TestSelector::TestSelector |
( |
Patterns && |
patterns, |
|
|
bool |
shouldExecute |
|
) |
| |
|
private |
Creates a sub-selector for hierarchical test filtering.
- Parameters
-
| patterns | The patterns for this selector |
| shouldExecute | Whether tests matching this selector should execute |
◆ matches()
| static bool Ocean::Test::TestSelector::matches |
( |
const std::string & |
pattern, |
|
|
const std::string & |
testName |
|
) |
| |
|
staticprivate |
Checks if a pattern matches a test name.
- Parameters
-
| pattern | The pattern to match against (may contain wildcards), must be valid |
| testName | The test name to check, must be valid |
- Returns
- True if the pattern matches the test name
◆ operator bool()
| Ocean::Test::TestSelector::operator bool |
( |
| ) |
const |
|
explicit |
Bool conversion operator to check if this selector indicates the test should run.
- Returns
- True if the test should execute, false otherwise
◆ runAll()
| bool Ocean::Test::TestSelector::runAll |
( |
| ) |
const |
|
inline |
Returns whether all tests should be executed.
- Returns
- True if no specific patterns were provided (empty string), false otherwise
◆ shouldRun()
| TestSelector Ocean::Test::TestSelector::shouldRun |
( |
const std::string & |
testName | ) |
const |
Determines whether a test with the given name should be executed and returns a sub-selector for hierarchical filtering.
- Parameters
-
| testName | The name of the test to check (case-insensitive), must be valid |
- Returns
- A TestSelector that can be cast to bool (true if test should run) and contains stripped sub-patterns
◆ patterns_
| Patterns Ocean::Test::TestSelector::patterns_ |
|
private |
Set of test patterns parsed from the input string.
◆ shouldExecute_
| bool Ocean::Test::TestSelector::shouldExecute_ = true |
|
private |
Whether tests matching this selector should execute.
The documentation for this class was generated from the following file: