2010-12-31 23:54:35 +01:00
|
|
|
/*
|
|
|
|
* catch_hub_impl.hpp
|
|
|
|
* Test
|
|
|
|
*
|
|
|
|
* Created by Phil on 31/12/2010.
|
|
|
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
|
|
|
*
|
|
|
|
* 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)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef TWOBLUECUBES_CATCH_HUB_IMPL_HPP_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_HUB_IMPL_HPP_INCLUDED
|
|
|
|
|
|
|
|
#include "catch_hub.h"
|
|
|
|
#include "catch_reporter_registry.hpp"a
|
|
|
|
|
|
|
|
namespace Catch
|
|
|
|
{
|
2011-01-07 11:01:40 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
Hub::Hub()
|
|
|
|
: m_reporterRegistry( new ReporterRegistry ),
|
|
|
|
m_testCaseRegistry( new TestRegistry )
|
2010-12-31 23:54:35 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-01-07 11:01:40 +01:00
|
|
|
Hub& Hub::me()
|
|
|
|
{
|
|
|
|
static Hub hub;
|
|
|
|
return hub;
|
|
|
|
}
|
|
|
|
|
|
|
|
IReporterRegistry& Hub::getReporterRegistry()
|
2010-12-31 23:54:35 +01:00
|
|
|
{
|
|
|
|
return *me().m_reporterRegistry.get();
|
|
|
|
}
|
2011-01-07 11:01:40 +01:00
|
|
|
|
|
|
|
ITestCaseRegistry& Hub::getTestCaseRegistry()
|
|
|
|
{
|
|
|
|
return *me().m_testCaseRegistry.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
AutoReg::AutoReg( TestFunction function, const char* name, const char* description )
|
|
|
|
{
|
|
|
|
Hub::getTestCaseRegistry().registerTest( TestCaseInfo( new FreeFunctionTestCase( function ), name, description ) );
|
|
|
|
}
|
|
|
|
AutoReg::~AutoReg()
|
|
|
|
{
|
|
|
|
}
|
2010-12-31 23:54:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // TWOBLUECUBES_CATCH_HUB_IMPL_HPP_INCLUDED
|