summaryrefslogtreecommitdiff
path: root/boost/test/tree/global_fixture.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/test/tree/global_fixture.hpp')
-rw-r--r--boost/test/tree/global_fixture.hpp70
1 files changed, 64 insertions, 6 deletions
diff --git a/boost/test/tree/global_fixture.hpp b/boost/test/tree/global_fixture.hpp
index 2114595929..7c96d34e89 100644
--- a/boost/test/tree/global_fixture.hpp
+++ b/boost/test/tree/global_fixture.hpp
@@ -17,6 +17,7 @@
#include <boost/test/detail/global_typedef.hpp>
#include <boost/test/tree/observer.hpp>
+#include <boost/test/tree/fixture.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
@@ -27,13 +28,36 @@ namespace boost {
namespace unit_test {
// ************************************************************************** //
+// ************** global_configuration ************** //
+// ************************************************************************** //
+
+class BOOST_TEST_DECL global_configuration : public test_observer {
+
+public:
+ // Constructor
+ global_configuration();
+
+ // Dtor
+ virtual ~global_configuration();
+
+ // Happens after the framework global observer init has been done
+ virtual int priority() { return 1; }
+};
+
+
+
+// ************************************************************************** //
// ************** global_fixture ************** //
// ************************************************************************** //
-class BOOST_TEST_DECL global_fixture : public test_observer {
+class BOOST_TEST_DECL global_fixture : public test_unit_fixture {
+
public:
// Constructor
global_fixture();
+
+ // Dtor
+ virtual ~global_fixture();
};
//____________________________________________________________________________//
@@ -41,14 +65,48 @@ public:
namespace ut_detail {
template<typename F>
-struct global_fixture_impl : public global_fixture {
+struct global_configuration_impl : public global_configuration {
// Constructor
- global_fixture_impl() : m_fixture( 0 ) {}
+ global_configuration_impl() : m_configuration_observer( 0 ) {
+ }
// test observer interface
- virtual void test_start( counter_t ) { m_fixture = new F; }
- virtual void test_finish() { delete m_fixture; m_fixture = 0; }
- virtual void test_aborted() { delete m_fixture; m_fixture = 0; }
+ virtual void test_start( counter_t ) {
+ m_configuration_observer = new F;
+ }
+
+ // test observer interface
+ virtual void test_finish() {
+ if(m_configuration_observer) {
+ delete m_configuration_observer;
+ m_configuration_observer = 0;
+ }
+ }
+private:
+ // Data members
+ F* m_configuration_observer;
+};
+
+template<typename F>
+struct global_fixture_impl : public global_fixture {
+ // Constructor
+ global_fixture_impl() : m_fixture( 0 ) {
+ }
+
+ // test fixture interface
+ virtual void setup() {
+ m_fixture = new F;
+ setup_conditional(*m_fixture);
+ }
+
+ // test fixture interface
+ virtual void teardown() {
+ if(m_fixture) {
+ teardown_conditional(*m_fixture);
+ }
+ delete m_fixture;
+ m_fixture = 0;
+ }
private:
// Data members