summaryrefslogtreecommitdiff
path: root/boost/test/tree/global_fixture.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:24:46 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:25:39 +0900
commit4fadd968fa12130524c8380f33fcfe25d4de79e5 (patch)
treefd26a490cd15388d42fc6652b3c5c13012e7f93e /boost/test/tree/global_fixture.hpp
parentb5c87084afaef42b2d058f68091be31988a6a874 (diff)
downloadboost-upstream/1.65.0.tar.gz
boost-upstream/1.65.0.tar.bz2
boost-upstream/1.65.0.zip
Imported Upstream version 1.65.0upstream/1.65.0
Change-Id: Icf8400b375482cb11bcf77440a6934ba360d6ba4 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
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