-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation update for the new macros
- BOOST_TEST_GLOBAL_FIXTURE explained - BOOST_TEST_GLOBAL_INITIALIZATION explained - changed the examples, deprecating BOOST_GLOBAL_FIXTURE - in the logger part, introduced the fact that BOOST_TEST_GLOBAL_INITIALIZATION should be used and no assertion is supported in this case
- Loading branch information
1 parent
5757d9c
commit e1b211f
Showing
17 changed files
with
251 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//[example_output | ||
> example --report_level=no | ||
<TestLog><Error file="test.cpp" line="18">check false failed</Error></TestLog> | ||
//] | ||
<TestLog><Error file="test.cpp" line="23">check false failed</Error></TestLog> | ||
//] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//[example_output | ||
> fixture_04 --log_level=message | ||
Running 2 test cases... | ||
ctor fixture i=0 | ||
setup fixture i=0 | ||
running test_case1 | ||
running test_case2 | ||
./fixture_04.run-fail.cpp:42: error: in "test_case2": check MyGlobalFixture::i == 3 has failed [1 != 3] | ||
teardown fixture i=1 | ||
dtor fixture i=3 | ||
|
||
*** 1 failure is detected in the test module "fixture_04" | ||
//] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// (C) Copyright Raffi Enficiaud 2017. | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
// See http://www.boost.org/libs/test for the library home page. | ||
|
||
//[example_code | ||
#define BOOST_TEST_MODULE fixture_04 | ||
#include <boost/test/included/unit_test.hpp> | ||
|
||
struct MyGlobalFixture { | ||
MyGlobalFixture() { | ||
BOOST_TEST_MESSAGE( "ctor fixture i=" << i ); | ||
} | ||
void setup() { | ||
BOOST_TEST_MESSAGE( "setup fixture i=" << i ); | ||
i++; | ||
} | ||
void teardown() { | ||
BOOST_TEST_MESSAGE( "teardown fixture i=" << i ); | ||
i += 2; | ||
} | ||
~MyGlobalFixture() { | ||
BOOST_TEST_MESSAGE( "dtor fixture i=" << i ); | ||
} | ||
static int i; | ||
}; | ||
int MyGlobalFixture::i = 0; | ||
|
||
BOOST_TEST_GLOBAL_FIXTURE( MyGlobalFixture ); | ||
|
||
BOOST_AUTO_TEST_CASE(test_case1) | ||
{ | ||
BOOST_TEST_MESSAGE("running test_case1"); | ||
BOOST_TEST(MyGlobalFixture::i == 1); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE(test_case2) | ||
{ | ||
BOOST_TEST_MESSAGE("running test_case2"); | ||
BOOST_TEST(MyGlobalFixture::i == 3); | ||
} | ||
//] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.