[utf] global fixture problem

Hi, in the following snippet I get the compiler error: utf_global_fixture.cpp: In member function ‘void my_test1::test_method()’: utf_global_fixture.cpp:19: error: ‘check’ was not declared in this scope utf_global_fixture.cpp:20: error: expected ‘;’ before ‘do’ // Boost.Test #define BOOST_TEST_MODULE Unit_test_example_09 #include <boost/test/unit_test.hpp> // STL #include <iostream> struct MyConfig { MyConfig() { std::cout << "global setup part1\n"; } ~MyConfig() { std::cout << "global teardown part1\n"; } bool check() const { return true;} }; // structure MyConfig is used as a global fixture - it's invoked pre and post any testing is performed BOOST_GLOBAL_FIXTURE( MyConfig ) BOOST_AUTO_TEST_CASE( my_test1 ) { BOOST_REQUIRE( check() ) BOOST_CHECK( true ); } isn't the member access like the test case/module fixture (as I did read in the docs)? Thanks, Olaf

AMDG Olaf Peter wrote:
utf_global_fixture.cpp: In member function ‘void my_test1::test_method()’: utf_global_fixture.cpp:19: error: ‘check’ was not declared in this scope utf_global_fixture.cpp:20: error: expected ‘;’ before ‘do’
<snip>
struct MyConfig { MyConfig() { std::cout << "global setup part1\n"; } ~MyConfig() { std::cout << "global teardown part1\n"; } bool check() const { return true;} };
// structure MyConfig is used as a global fixture - it's invoked pre and post any testing is performed BOOST_GLOBAL_FIXTURE( MyConfig )
BOOST_AUTO_TEST_CASE( my_test1 ) { BOOST_REQUIRE( check() ) BOOST_CHECK( true ); }
isn't the member access like the test case/module fixture (as I did read in the docs)?
Not for global fixtures. I don't know of any way to make it work. In Christ, Steven Watanabe
participants (2)
-
Olaf Peter
-
Steven Watanabe