Steppable 0.0.1
A CAS project written from scratch in C++
Loading...
Searching...
No Matches
steppable::testing::TestCase Class Reference

Represents a test case for unit testing. More...

#include <testing.hpp>

Public Member Functions

 TestCase (std::string testCaseName)
 Constructs a new TestCase object with the given name.
void assertIsEqual (const std::string &a, const std::string &b)
 Asserts that two strings are equal.
void assertIsNotEqual (const std::string &a, const std::string &b)
 Asserts that two strings are not equal.
template<concepts::Numeric ValueT>
void assertIsEqual (ValueT a, ValueT b)
 Asserts that two numeric values are equal.
template<concepts::Numeric ValueT>
void assertIsNearlyEqual (ValueT a, ValueT b)
 Asserts that two numeric values are nearly equal.
template<concepts::Numeric ValueT>
void assertIsNotEqual (ValueT a, ValueT b)
 Asserts that two numeric values are not equal.
template<concepts::Presentable ValueT>
void assertIsEqual (ValueT a, ValueT b)
 Asserts that two objects with .present() method are equal.
template<concepts::Presentable ValueT>
void assertIsNotEqual (ValueT a, ValueT b)
 Asserts that two objects with .present() method are not equal.
void assertTrue (bool value)
 Asserts that a boolean value is true.
void assertFalse (bool value)
 Asserts that a boolean value is false.
void summarize () const
 Prints a summary of the test case, including the number of errors encountered.

Public Attributes

int errorCount = 0

Private Member Functions

void _assertCondition (bool condition, const std::string &conditionName)
 Asserts a given condition and logs the condition name if it fails.

Private Attributes

std::string testCaseName

Detailed Description

Represents a test case for unit testing.

Constructor & Destructor Documentation

◆ TestCase()

steppable::testing::TestCase::TestCase ( std::string testCaseName)
explicit

Constructs a new TestCase object with the given name.

Parameters
[in]testCaseNameThe name of the test case.

Member Function Documentation

◆ _assertCondition()

void steppable::testing::TestCase::_assertCondition ( bool condition,
const std::string & conditionName )
private

Asserts a given condition and logs the condition name if it fails.

Parameters
[in]conditionThe condition to be checked.
[in]conditionNameThe name of the condition.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ assertFalse()

void steppable::testing::TestCase::assertFalse ( bool value)

Asserts that a boolean value is false.

Parameters
[in]valueThe boolean value to be checked.
Here is the call graph for this function:

◆ assertIsEqual() [1/3]

void steppable::testing::TestCase::assertIsEqual ( const std::string & a,
const std::string & b )

Asserts that two strings are equal.

Parameters
[in]aThe first string.
[in]bThe second string.
Here is the call graph for this function:

◆ assertIsEqual() [2/3]

template<concepts::Numeric ValueT>
void steppable::testing::TestCase::assertIsEqual ( ValueT a,
ValueT b )
inline

Asserts that two numeric values are equal.

Parameters
[in]aThe first object.
[in]bThe second object.
Here is the call graph for this function:

◆ assertIsEqual() [3/3]

template<concepts::Presentable ValueT>
void steppable::testing::TestCase::assertIsEqual ( ValueT a,
ValueT b )
inline

Asserts that two objects with .present() method are equal.

Parameters
[in]aThe first object.
[in]bThe second object.
Here is the call graph for this function:

◆ assertIsNearlyEqual()

template<concepts::Numeric ValueT>
void steppable::testing::TestCase::assertIsNearlyEqual ( ValueT a,
ValueT b )
inline

Asserts that two numeric values are nearly equal.

Parameters
[in]aThe first object.
[in]bThe second object.
Here is the call graph for this function:

◆ assertIsNotEqual() [1/3]

void steppable::testing::TestCase::assertIsNotEqual ( const std::string & a,
const std::string & b )

Asserts that two strings are not equal.

Parameters
[in]aThe first string.
[in]bThe second string.
Here is the call graph for this function:

◆ assertIsNotEqual() [2/3]

template<concepts::Numeric ValueT>
void steppable::testing::TestCase::assertIsNotEqual ( ValueT a,
ValueT b )
inline

Asserts that two numeric values are not equal.

Parameters
[in]aThe first object.
[in]bThe second object.
Here is the call graph for this function:

◆ assertIsNotEqual() [3/3]

template<concepts::Presentable ValueT>
void steppable::testing::TestCase::assertIsNotEqual ( ValueT a,
ValueT b )
inline

Asserts that two objects with .present() method are not equal.

Parameters
[in]aThe first object.
[in]bThe second object.
Here is the call graph for this function:

◆ assertTrue()

void steppable::testing::TestCase::assertTrue ( bool value)

Asserts that a boolean value is true.

Parameters
[in]valueThe boolean value to be checked.
Here is the call graph for this function:

◆ summarize()

void steppable::testing::TestCase::summarize ( ) const

Prints a summary of the test case, including the number of errors encountered.

Here is the call graph for this function:

Member Data Documentation

◆ errorCount

int steppable::testing::TestCase::errorCount = 0

◆ testCaseName

std::string steppable::testing::TestCase::testCaseName
private

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