|
CMakeTutorialStep1 2.3.12
|
TutorialMath 单元测试;全局 Environment 经 ScenarioLog 写 gtest.log。 More...
#include <gtest/gtest.h>#include <string_view>#include "ScenarioLog.hxx"#include "TutorialMath.hxx"Functions | |
| TEST (TutorialMath, ComputeSqrtPositive) | |
| TEST (TutorialMath, ComputeSqrtNegativeRejected) | |
| TEST (TutorialMath, ComputeSqrtOverMaxRejected) | |
| TEST (TutorialMath, ComputeSqrtIllegalAssertionFailDemo) | |
| TEST (TutorialMath, HasNumericArgument) | |
| template<typename In, typename Out> | |
| void | gtest_case (std::string_view fn, const In &input, const Out &expected, const Out &actual) |
| 终端 / gtest.log:记录函数名、输入、预期、实际 | |
| void | gtest_info (std::string_view msg) |
| GTest 用 INFO 日志并裁剪 gtest.log. | |
TutorialMath 单元测试;全局 Environment 经 ScenarioLog 写 gtest.log。
日志封装见 ScenarioLog(【不可删除】);故意失败用例默认被 CTest 过滤。
| void scenario_log::gtest_case | ( | std::string_view | fn, |
| const In & | input, | ||
| const Out & | expected, | ||
| const Out & | actual ) |
终端 / gtest.log:记录函数名、输入、预期、实际
| void scenario_log::gtest_info | ( | std::string_view | msg | ) |
GTest 用 INFO 日志并裁剪 gtest.log.
| TEST | ( | TutorialMath | , |
| ComputeSqrtIllegalAssertionFailDemo | ) |
| TEST | ( | TutorialMath | , |
| ComputeSqrtNegativeRejected | ) |
| TEST | ( | TutorialMath | , |
| ComputeSqrtOverMaxRejected | ) |
| TEST | ( | TutorialMath | , |
| ComputeSqrtPositive | ) |
| TEST | ( | TutorialMath | , |
| HasNumericArgument | ) |