부스트 테스트 라이브러리를 사용하여 내 애플리케이션 용 테스트를 만들고 싶습니다.부스트 유닛 테스트 사용시 문제
http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/tutorials/new-year-resolution.html에서 찾은 자습서를 따라 테스트 클래스를 시작했습니다.
그래서, 내 테스트 클래스를 만들었습니다, 그리고 간단한 .CPP 확인이 하나
#define BOOST_TEST_MODULE MyClass test
#include <boost/test/unit_test.hpp>
#include "myclasstest.h"
MyClassTest::MyClassTest()
{
}
/**
* Test the class.
*/
bool MyClassTest::testClass()
{
BOOST_AUTO_TEST_CASE(empty_test)
{
MyClass xTest;
BOOST_CHECK(xTest.isEmpty());
}
return true;
}
, 나는 내가 true를 돌려보다 더 지능적인 무언가를해야한다는 것을 알고 있지만, 그것은 '하지 문제. 문제는 컴파일되지 않는다는 것입니다. 처음 두 행만 컴파일하면 튜토리얼 페이지에서 설명한대로 오류가 발생하지 않기 때문에 라이브러리가로드 된 것으로 생각됩니다.
myclasstest.cpp: In member function ‘bool MyClassTest::testClass()’:
myclasstest.cpp:16:5: error: a function-definition is not allowed here before ‘{’ token
myclasstest.cpp:16:1: error: ‘empty_test_invoker’ was not declared in this scope
myclasstest.cpp:16:5: error: template argument for ‘template<class T> struct boost::unit_test::ut_detail::auto_tc_exp_fail’ uses local type ‘MyClassTest::testClass()::empty_test_id’
myclasstest.cpp:16:5: error: trying to instantiate ‘template<class T> struct boost::unit_test::ut_detail::auto_tc_exp_fail’
myclasstest.cpp:17:5: error: a function-definition is not allowed here before ‘{’ token
myclasstest.cpp:23:1: error: expected ‘}’ at end of input
myclasstest.cpp:23:1: warning: no return statement in function returning non-void
내가 높일 수있는 새로운 해요, 그래서 내가 무엇을해야하는지 모른다 : 나는 그것을 컴파일하려고하면
, 나는 GCC에서이 오류 출력을 얻을 수 있습니다. 내가 뭘 잘못하고있어? 나는 튜토리얼과 동일한 단계를 수행했는지 아닌지 생각해 본다.
답장을 보내 주셔서 감사합니다.