Compute Library
 22.08
TestCaseFactory Class Referenceabstract

Abstract factory class to create test cases. More...

#include <TestCaseFactory.h>

Public Types

enum  Status { ACTIVE, EXPECTED_FAILURE, DISABLED }
 Test case status. More...
 

Public Member Functions

 TestCaseFactory (std::string suite_name, std::string name, DatasetMode mode, Status status, std::string description="")
 Constructor. More...
 
virtual ~TestCaseFactory ()=default
 Default destructor. More...
 
std::string name () const
 Name of the test case. More...
 
DatasetMode mode () const
 Get the mode for which test case will be enabled. More...
 
Status status () const
 Get the status of the test case. More...
 
virtual std::unique_ptr< TestCasemake () const =0
 Factory function to create the test case. More...
 

Detailed Description

Abstract factory class to create test cases.

Definition at line 40 of file TestCaseFactory.h.

Member Enumeration Documentation

◆ Status

enum Status
strong

Test case status.

ACTIVE == Test is run and result is validated. Failure on failed validation. EXPECTED_FAILURE == Test is run and result is validated. Failure on successful validation. DISABLED == Test is not run.

Enumerator
ACTIVE 
EXPECTED_FAILURE 
DISABLED 

Definition at line 49 of file TestCaseFactory.h.

50  {
51  ACTIVE,
52  EXPECTED_FAILURE,
53  DISABLED
54  };

Constructor & Destructor Documentation

◆ TestCaseFactory()

TestCaseFactory ( std::string  suite_name,
std::string  name,
DatasetMode  mode,
Status  status,
std::string  description = "" 
)
inline

Constructor.

Parameters
[in]suite_nameName of the test suite to which the test case has been added.
[in]nameName of the test case.
[in]modeDatset mode of the test case.
[in]statusStatus of the test case.
[in]descriptionDescription of data arguments.

Definition at line 134 of file TestCaseFactory.h.

References TestCaseFactory::mode(), and TestCaseFactory::status().

135  : _suite_name{ std::move(suite_name) }, _test_name{ std::move(test_name) }, _data_description{ std::move(description) }, _mode{ mode }, _status{ status }
136 
137 {
138 }
DatasetMode mode() const
Get the mode for which test case will be enabled.
Status status() const
Get the status of the test case.

◆ ~TestCaseFactory()

virtual ~TestCaseFactory ( )
virtualdefault

Default destructor.

Member Function Documentation

◆ make()

virtual std::unique_ptr<TestCase> make ( ) const
pure virtual

Factory function to create the test case.

Returns
Unique pointer to a newly created test case.

Implemented in DataTestCaseFactory< T, D >, and SimpleTestCaseFactory< T >.

Referenced by Framework::error_on_missing_assets().

◆ mode()

DatasetMode mode ( ) const
inline

Get the mode for which test case will be enabled.

Returns
Dataset mode of the test case.

Definition at line 152 of file TestCaseFactory.h.

Referenced by DataTestCaseFactory< T, D >::DataTestCaseFactory(), Framework::run(), and TestCaseFactory::TestCaseFactory().

153 {
154  return _mode;
155 }

◆ name()

std::string name ( ) const
inline

Name of the test case.

Returns
Name of the test case.

Definition at line 140 of file TestCaseFactory.h.

Referenced by Framework::run().

141 {
142  std::string name = _suite_name + "/" + _test_name;
143 
144  if(!_data_description.empty())
145  {
146  name += "@" + _data_description;
147  }
148 
149  return name;
150 }
std::string name() const
Name of the test case.

◆ status()

TestCaseFactory::Status status ( ) const
inline

Get the status of the test case.

Returns
Status of the test case.

Definition at line 157 of file TestCaseFactory.h.

Referenced by DataTestCaseFactory< T, D >::DataTestCaseFactory(), Framework::error_on_missing_assets(), Framework::run(), and TestCaseFactory::TestCaseFactory().

158 {
159  return _status;
160 }

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