它支持多种编译器环境,包括但不限于 GCC、Clang 以及 Microsoft Visual Studio,这使得它成为跨平台项目理想的测试解决方案。 在创建单元测试方面,CppTest 提供了一系列简洁明了的断言宏,如 `CPPTEST_ASSERT_EQUAL`、`CPPTEST_ASSERT_TRUE` 等,这些宏可以帮助开发者轻松验证
ASSERT_EQ(result, expect) 判断是否相等,不相等测试用例会失败,类似FATAL(立刻结束该测试用例) MUST_EQUAL(result, expect)和ASSERT_EQ(result, expect) 判断是否相等,不相等测试用例会失败,类似FATAL(立刻结束该测试用例) MUST_TRUE(flag, text) 判断flag是否为真,为false会失败并打印text,类似FATAL ...
ASSERT_EQ(result, expect) 判断是否相等,不相等测试用例会失败,类似FATAL(立刻结束该测试用例) MUST_EQUAL(result, expect)和ASSERT_EQ(result, expect) 判断是否相等,不相等测试用例会失败,类似FATAL(立刻结束该测试用例) MUST_TRUE(flag, text) 判断flag是否为真,为false会失败并打印text,类似FATAL ...
Judge whether they are equal. If not, the test case will fail, similar to FATAL (it will end this test case immediately). MUST_EQUAL(result, expect)andASSERT_EQ(result, expect) Judge whether they are equal. If not, the test case will fail, similar to FATAL (it will end this test c...
int _num = 0; :std:string _password = ; / Calling the function :Account * _return = _cpptest_TestObject.getAccount(_num, _password); / Assert values CPPTEST_ASSERT_EQUAL(0, ( _return );,Parasoft Proprietary and Confidential,a,71,Assertions - What to assert,Ease of creating assertio ...
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, delta) CPPUNIT_ASSERT_THROW(expression, ExceptionType) CPPUNIT_ASSERT_NO_THROW(expression) CPPUNIT_TEST_SUITE_REGISTRATION(ATestFixtureType) The context of the imported CppUnit test cases will be set to 'project'. ...
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, delta) CPPUNIT_ASSERT_THROW(expression, ExceptionType) CPPUNIT_ASSERT_NO_THROW(expression) CPPUNIT_TEST_SUITE_REGISTRATION(ATestFixtureType) The context of the imported CppUnit test cases will be set to 'project'. ...
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, delta) CPPUNIT_ASSERT_THROW(expression, ExceptionType) CPPUNIT_ASSERT_NO_THROW(expression) CPPUNIT_TEST_SUITE_REGISTRATION(ATestFixtureType) The context of the imported CppUnit test cases will be set to 'project'. ...
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, delta) CPPUNIT_ASSERT_THROW(expression, ExceptionType) CPPUNIT_ASSERT_NO_THROW(expression) CPPUNIT_TEST_SUITE_REGISTRATION(ATestFixtureType) The context of the imported CppUnit test cases will be set to 'project'. ...