Opened 7 years ago
Closed 7 years ago
#11589 closed Bugs (obsolete)
Wrong initialization order when using multiple BOOST_GLOBAL_FIXTURE()
Reported by: | Owned by: | Gennadiy Rozental | |
---|---|---|---|
Milestone: | To Be Determined | Component: | test |
Version: | Boost 1.56.0 | Severity: | Problem |
Keywords: | Cc: |
Description
In a Unit Test, when declaring 2 global fixtures using BOOST_GLOBAL_FIXTURE(), if I'm right, the fixtures should be constructed in the order they appear in the source file and destroyed in the reverse order. When building the code below on Windows 7 (64 bits), with Visual Studio 2013 (on debug) and running it, construction and destruction are done in the same order (see the output below). Note that the same code works well on Linux.
Unit Test code:
#define BOOST_TEST_MODULE test_2_global_fixtures #include <boost/test/unit_test.hpp> #include <iostream> //____________________________________________________________________________// struct MyConfig1 { MyConfig1 () { std::cout << "global setup 1\n"; } ~MyConfig1 () { std::cout << "global teardown 1\n"; } }; struct MyConfig2 { MyConfig2 () { std::cout << "global setup 2\n"; } ~MyConfig2 () { std::cout << "global teardown 2\n"; } }; //____________________________________________________________________________// BOOST_GLOBAL_FIXTURE (MyConfig1); BOOST_GLOBAL_FIXTURE (MyConfig2); BOOST_AUTO_TEST_CASE (test_case) { BOOST_REQUIRE (true); }
Output:
global setup 2 global setup 1 Running 1 test case... global teardown 2 global teardown 1 *** No errors detected Press any key to continue . . .
Note:
See TracTickets
for help on using tickets.
Works fine in 1.59