51Testing软件测试论坛
标题:
关于CPPUNIT中的断言
[打印本页]
作者:
zhangchen
时间:
2007-6-8 22:49
标题:
关于CPPUNIT中的断言
CPPUNIT中的断言有几种?
作者:
wangyan
时间:
2007-6-9 15:48
CPPUNIT_ASSERT_EQUAL(expected,actual) //expected预期结果,actual实际结果,不相等时失败
CPPUNIT_ASSERT_EQUAL_MESSAGE(message, expected,actual) // 失败的同时打印message
CPPUNIT_ASSERT(condition) // condition 为假时失败
CPPUNIT_ASSERT_MESSAGE(message, condition ) // 当condition为假时失败, 并打印message
CPPUNIT_FAIL(message) // 测试失败, 并打印message
CPPUNIT_ASSERT_DOUBLES_EQUAL(expected,actual, delta) // expected,actual之差大于delta时失败
可以去看看与断言相关的部分源码:
Asserter.h,Asserter.cpp
TestAssert.h,TestAssert.cpp
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2