【发布时间】:2014-01-24 18:11:34
【问题描述】:
我使用 Netbeans 测试创建功能创建了我的第一个测试类,并且所有测试都通过了。
如果测试 x 通过,现在我想在终端窗口“成功”的主窗口中打印。
我的想法是这样的:
void test(bool testResult)
{
if(testResult==true)
cout << "Success";
}
参数testResult应该是测试x的结果。
但是我从哪里以及如何获得该状态?
如何查看 main 中的测试状态?
更新: 我现在得到了这个:
void test(bool testResult)
{
if(testResult==true)
{
cout << "Success";
}else cout << "Failure";
}
int main(int argc, char** argv)
{
....
test(newtestclass); //included my testclass.h and put the test class as parameter
}
我现在在 Netbeans 中只有 1 个错误: “main.cpp:59:22: 错误: ')' 标记之前的预期主表达式”
【问题讨论】:
标签: c++ unit-testing testing cppunit