CPP01 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Test クラス

A custom class for performing unit tests and reporting results. [詳解]

#include <Test.hpp>

Test 連携図
Collaboration graph

公開メンバ関数

 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()

Test::Test ( )

Default constructor for the Test class.

Initializes the test count and pass count to 0.

Test.cpp の 25 行目に定義があります。

◆ ~Test()

Test::~Test ( )

Destructor for the Test class.

Test.cpp の 30 行目に定義があります。

関数詳解

◆ 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.

引数
testNameThe name of the test case.
testFunctionA

Test.cpp の 40 行目に定義があります。


このクラス詳解は次のファイルから抽出されました: