C++ Boost单元测试似乎跳过了应该执行的代码
下面的Boost测试似乎不像我预期的那样有效。 断点显示C++ Boost单元测试似乎跳过了应该执行的代码,c++,unit-testing,boost,C++,Unit Testing,Boost,下面的Boost测试似乎不像我预期的那样有效。 断点显示BOOST\u AUTO\u TEST\u CASE(…)中的代码未运行(但带有BOOST\u AUTO\u TEST\u CASE(…)的行运行正常)。怎么了 UT_Math.cpp #包括“./UTest/UT_Math.h” #包括 BOOST\u AUTO\u TEST\u案例(testUTMath) { 数学测验; cout删除main()函数已经解决了这个问题那么为什么测试用例中的代码没有运行?我已经完成了所有需要的操作吗?据我
BOOST\u AUTO\u TEST\u CASE(…)
中的代码未运行(但带有BOOST\u AUTO\u TEST\u CASE(…)
的行运行正常)。怎么了
UT_Math.cpp
#包括“./UTest/UT_Math.h”
#包括
BOOST\u AUTO\u TEST\u案例(testUTMath)
{
数学测验;
cout删除main()
函数已经解决了这个问题那么为什么测试用例中的代码没有运行?我已经完成了所有需要的操作吗?据我所知,BOOST\u AUTO\u测试用例
是自动运行的(它不需要特殊的main()
func)
#include "../UTest/UT_Math.h"
#include <iostream>
BOOST_AUTO_TEST_CASE(testUTMath)
{
UTMath test;
cout << "UTMath is started" << endl;
test.Test1();
cout << "Test1 is completed" << endl;
}
#include "../Math/Math.h"
#define BOOST_TEST_MODULE UTMathTest
#include <boost/test/unit_test.hpp>
class UTMath
{
public:
void Test1()
{
BOOST_REQUIRE(1==1);
}
};