Compute Library
 22.11
TestFilter Class Referencefinal

Test filter class. More...

#include <TestFilter.h>

Public Member Functions

 TestFilter ()=default
 Default constructor. More...
 
 TestFilter (DatasetMode mode, const std::string &name_filter, const std::string &id_filter)
 Constructor. More...
 
bool is_selected (const TestInfo &info) const
 Check if a test case is selected to be executed. More...
 

Detailed Description

Test filter class.

Stores information about which test cases are selected for execution. Based on test name and test id.

Definition at line 46 of file TestFilter.h.

Constructor & Destructor Documentation

◆ TestFilter() [1/2]

TestFilter ( )
default

Default constructor.

All tests selected.

◆ TestFilter() [2/2]

TestFilter ( DatasetMode  mode,
const std::string &  name_filter,
const std::string &  id_filter 
)

Constructor.

The id_filter string has be a comma separated list of test ids. ... can be used to include a range of tests. For instance, "..., 15" means all test up to and including 15, "3, 6, ..., 10" means tests 3 and 6 to 10, and "15, ..." means test 15 and all following.

Parameters
[in]modeDataset mode.
[in]name_filterRegular expression to filter tests by name. Only matching tests will be executed.
[in]id_filterString to match selected test ids. Only matching tests will be executed.

Definition at line 38 of file TestFilter.cpp.

39  : _dataset_mode{ mode }, _name_filter{ name_filter }, _id_filter{ parse_id_filter(id_filter) }
40 {
41 }

Member Function Documentation

◆ is_selected()

bool is_selected ( const TestInfo info) const

Check if a test case is selected to be executed.

Parameters
[in]infoTest case info.
Returns
True if the test case is selected to be executed.

Definition at line 43 of file TestFilter.cpp.

References arm_compute::test::framework::DISABLED, arm_compute::mlgo::parser::end(), TestInfo::id, TestInfo::mode, TestInfo::name, arm_compute::test::validation::reference::range(), arm_compute::support::cpp11::stoi(), and caffe_mnist_image_extractor::str.

44 {
45  const bool include_disabled = (info.mode == _dataset_mode) && (_dataset_mode == DatasetMode::DISABLED);
46  if((info.mode & _dataset_mode) == DatasetMode::DISABLED && !include_disabled)
47  {
48  return false;
49  }
50 
51  if(!std::regex_search(info.name, _name_filter))
52  {
53  return false;
54  }
55 
56  if(!_id_filter.empty())
57  {
58  bool found = false;
59 
60  for(const auto &range : _id_filter)
61  {
62  if(range.first <= info.id && info.id <= range.second)
63  {
64  found = true;
65  break;
66  }
67  }
68 
69  if(!found)
70  {
71  return false;
72  }
73  }
74 
75  return true;
76 }
SimpleTensor< T > range(SimpleTensor< T > &dst, float start, const size_t num_of_elements, float step)
Definition: Range.cpp:50
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

The documentation for this class was generated from the following files: