Max OS 0.3
Loading...
Searching...
No Matches
MaxOS::tests::ConditionalTest Class Reference

A test that only checks a condition to determine pass/fail. More...

#include <test.h>

Inheritance diagram for MaxOS::tests::ConditionalTest:
MaxOS::tests::Test

Public Member Functions

 ConditionalTest (const string &name, TestType type, bool(*condition)())
 Constructs a ConditionalTest with a name, type, and condition function.
 
TestStatus execute () override
 Executes the conditional test based on the provided condition function.
 
- Public Member Functions inherited from MaxOS::tests::Test
 Test (const string &name, TestType type)
 Constructs a Test with a name and type, and registers it with the TestRunner.
 
TestStatus run ()
 Runs the test and returns the result.
 
const stringname () const
 Gets the name of the test.
 
TestType type () const
 Gets the type of the test.
 

Detailed Description

A test that only checks a condition to determine pass/fail.

Definition at line 116 of file test.h.

Constructor & Destructor Documentation

◆ ConditionalTest()

ConditionalTest::ConditionalTest ( const string name,
TestType  type,
bool(*)()  condition 
)

Constructs a ConditionalTest with a name, type, and condition function.

Parameters
nameThe name of the test
typeThe type of the test
conditionThe condition function to evaluate

Definition at line 90 of file test.cpp.

91: Test(name, type),
92 m_condition(condition)
93{
94}
A basic test class.
Definition test.h:69
const string & name() const
Gets the name of the test.
Definition test.cpp:68
TestType type() const
Gets the type of the test.
Definition test.cpp:77

Member Function Documentation

◆ execute()

TestStatus ConditionalTest::execute ( )
overridevirtual

Executes the conditional test based on the provided condition function.

Returns
TestStatus The status of the test after execution

Implements MaxOS::tests::Test.

Definition at line 101 of file test.cpp.

101 {
102
103 if (m_condition())
104 return TestStatus::PASS;
105 else
106 return TestStatus::FAIL;
107
108}

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