So, I have started using boost unit testing. When I try and build a simple test that creates an instance of a class I get a compilation error.It works fine without an instance of the class.
The compilation error message is:
/src/test/WTFomgFail_test.cpp: In member function ‘void WTFomgFail::defaultConstructor::test_method()’:
/src/test/WTFomgFail_test.cpp:20: error: expected primary-expression before ‘obj’
/src/test/WTFomgFail_test.cpp:20: error: expected `;' before ‘obj’
WTFomgFail_test.cpp:
#include "WTFomgFail.hpp"
#define BOOST_TEST_MODULE WTFomgFail
#define BOOST_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(WTFomgFail)
BOOST_AUTO_TEST_CASE( defaultConstructor )
{
WTFomgFail obj = WTFomgFail();
BOOST_MESSAGE("wow, you did it");
}
BOOST_AUTO_TEST_SUITE_END()
WTFomgFail.hpp:
#ifndef WTFOMGFAIL_HPP_
#define WTFOMGFAIL_HPP_
class WTFomgFail
{
public:
WTFomgFail();
~WTFomgFail();
};
#endif /* WTFOMGFAIL_HPP_ */
WTFomgFail.cpp:
#include "WTFomgFail.hpp"
WTFomgFail::WTFomgFail()
{
}
WTFomgFail::~WTFomgFail()
{
}
The error goes away if I change BOOST_AUTO_TEST_SUITE(WTFomgFail)
to something else, say BOOST_AUTO_TEST_SUITE(OMGreally)
.
Furthermore, I dont get the error when using #define BOOST_TEST_MODULE OMGreally
with BOOST_AUTO_TEST_SUITE(OMGreally)
.
So, my question is when using the boost UTF is naming the module, test_suite, and class the same thing explicitly forbidden?