A custom class for performing unit tests and reporting results.
[詳解]
#include <Test.hpp>
|
| Test () |
| Default constructor for the Test class.
|
|
| ~Test () |
| Destructor for the Test class.
|
|
void | runTest (const std::string &testName, void(*testFunction)(Test &)) |
| Runs a single test case.
|
|
template<typename T > |
void | expectTrue (const T &condition, const std::string &message) |
| Asserts that a condition is true.
|
|
template<typename T > |
void | expectEq (const T &val1, const T &val2, const std::string &message) |
| Asserts that two values are equal.
|
|
template<typename ExceptionType , typename Callable > |
void | expectThrow (Callable statement, const std::string &message) |
| Asserts that a statement throws an exception of the specified type.
|
|
A custom class for performing unit tests and reporting results.
Test.hpp の 36 行目に定義があります。
◆ Test()
Default constructor for the Test class.
Initializes the test count and pass count to 0.
Test.cpp の 25 行目に定義があります。
◆ ~Test()
◆ expectEq()
template<typename T >
void Test::expectEq |
( |
const T & |
val1, |
|
|
const T & |
val2, |
|
|
const std::string & |
message |
|
) |
| |
|
inline |
Asserts that two values are equal.
Increments the test count and pass count accordingly. Prints an error message with the expected and actual values if they are not equal.
Test.hpp の 82 行目に定義があります。
◆ expectThrow()
template<typename ExceptionType , typename Callable >
void Test::expectThrow |
( |
Callable |
statement, |
|
|
const std::string & |
message |
|
) |
| |
|
inline |
Asserts that a statement throws an exception of the specified type.
Increments the test count and pass count accordingly. Prints an error message if no exception is thrown or if the wrong exception type is caught.
Test.hpp の 99 行目に定義があります。
◆ expectTrue()
template<typename T >
void Test::expectTrue |
( |
const T & |
condition, |
|
|
const std::string & |
message |
|
) |
| |
|
inline |
Asserts that a condition is true.
Increments the test count and pass count accordingly. Prints an error message if the condition is false.
Test.hpp の 67 行目に定義があります。
◆ runTest()
void Test::runTest |
( |
const std::string & |
testName, |
|
|
void(*)(Test &) |
testFunction |
|
) |
| |
Runs a single test case.
Executes the provided test function and prints the test name and result.
Executes the provided test function and prints the test name and result.
- 引数
-
testName | The name of the test case. |
testFunction | A |
Test.cpp の 40 行目に定義があります。
このクラス詳解は次のファイルから抽出されました: