2013-11-14 20:49:49 +01:00
|
|
|
/*
|
|
|
|
* Created by Malcolm on 10/11/2013.
|
|
|
|
* Copyright 2013 Malcolm Noyes
|
|
|
|
*
|
|
|
|
* 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_VS_MANAGED_HPP_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_VS_MANAGED_HPP_INCLUDED
|
|
|
|
|
|
|
|
#ifdef INTERNAL_CATCH_VS_MANAGED
|
|
|
|
|
2013-11-17 15:18:02 +01:00
|
|
|
#include <windows.h>
|
|
|
|
using namespace System;
|
|
|
|
using namespace System::Text;
|
|
|
|
using namespace System::Collections::Generic;
|
|
|
|
using namespace Microsoft::VisualStudio::TestTools::UnitTesting;
|
|
|
|
|
|
|
|
namespace Catch {
|
|
|
|
inline String^ convert_string_to_managed(const std::string& s)
|
|
|
|
{
|
|
|
|
String^ result = gcnew String(s.c_str());
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "internal/catch_timer.hpp"
|
2013-11-22 12:47:21 +01:00
|
|
|
#include "internal/catch_reporter_registrars.hpp"
|
2013-11-17 15:18:02 +01:00
|
|
|
#include "reporters/catch_vs_reporter.hpp"
|
2013-11-22 12:47:21 +01:00
|
|
|
#include "catch_registry_hub.hpp"
|
2013-11-17 15:18:02 +01:00
|
|
|
|
2013-11-22 12:47:21 +01:00
|
|
|
//#define OLD (1)
|
|
|
|
#ifdef OLD
|
2013-11-17 15:18:02 +01:00
|
|
|
namespace Catch {
|
|
|
|
|
|
|
|
class ExceptionRegistryHub : public IRegistryHub, public IMutableRegistryHub {
|
|
|
|
|
|
|
|
ExceptionRegistryHub( ExceptionRegistryHub const& );
|
|
|
|
void operator=( ExceptionRegistryHub const& );
|
|
|
|
|
|
|
|
public: // IRegistryHub
|
|
|
|
ExceptionRegistryHub() {
|
|
|
|
}
|
|
|
|
virtual IReporterRegistry const& getReporterRegistry() const {
|
|
|
|
throw std::runtime_error("can't do this for Visual Studio tests!");
|
|
|
|
}
|
|
|
|
virtual ITestCaseRegistry const& getTestCaseRegistry() const {
|
|
|
|
throw std::runtime_error("can't do this for Visual Studio tests!");
|
|
|
|
}
|
|
|
|
virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() {
|
|
|
|
return m_exceptionTranslatorRegistry;
|
|
|
|
}
|
|
|
|
|
|
|
|
public: // IMutableRegistryHub
|
|
|
|
virtual void registerReporter( std::string const&, IReporterFactory* ) {
|
|
|
|
throw std::runtime_error("can't do this for Visual Studio tests!");
|
|
|
|
}
|
|
|
|
virtual void registerTest( TestCase const& ) {
|
|
|
|
throw std::runtime_error("can't do this for Visual Studio tests!");
|
|
|
|
}
|
|
|
|
virtual void registerTranslator( const IExceptionTranslator* translator ) {
|
|
|
|
m_exceptionTranslatorRegistry.registerTranslator( translator );
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct GlobalRegistryHub
|
|
|
|
{
|
2013-11-22 12:47:21 +01:00
|
|
|
static T*& instance()
|
2013-11-17 15:18:02 +01:00
|
|
|
{
|
|
|
|
if( !theRegistryHub )
|
|
|
|
theRegistryHub = new T();
|
2013-11-22 12:47:21 +01:00
|
|
|
return theRegistryHub;
|
2013-11-17 15:18:02 +01:00
|
|
|
}
|
|
|
|
static T* theRegistryHub;
|
|
|
|
};
|
|
|
|
template <typename T>
|
|
|
|
T* GlobalRegistryHub<T>::theRegistryHub = NULL;
|
|
|
|
|
|
|
|
INTERNAL_CATCH_INLINE IMutableRegistryHub& getMutableRegistryHub() {
|
2013-11-22 12:47:21 +01:00
|
|
|
return *GlobalRegistryHub<ExceptionRegistryHub>::instance();
|
2013-11-17 15:18:02 +01:00
|
|
|
}
|
|
|
|
INTERNAL_CATCH_INLINE std::string translateActiveException() {
|
2013-11-22 12:47:21 +01:00
|
|
|
return GlobalRegistryHub<ExceptionRegistryHub>::instance()->getExceptionTranslatorRegistry().translateActiveException();
|
2013-11-17 15:18:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2013-11-22 12:47:21 +01:00
|
|
|
#endif // OLD
|
|
|
|
|
|
|
|
namespace Catch {
|
|
|
|
inline NonCopyable::~NonCopyable() {}
|
|
|
|
inline IShared::~IShared() {}
|
|
|
|
inline StreamBufBase::~StreamBufBase() throw() {}
|
|
|
|
inline IContext::~IContext() {}
|
|
|
|
inline IResultCapture::~IResultCapture() {}
|
|
|
|
inline ITestCase::~ITestCase() {}
|
|
|
|
inline ITestCaseRegistry::~ITestCaseRegistry() {}
|
|
|
|
inline IRegistryHub::~IRegistryHub() {}
|
|
|
|
inline IMutableRegistryHub::~IMutableRegistryHub() {}
|
|
|
|
inline IExceptionTranslator::~IExceptionTranslator() {}
|
|
|
|
inline IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() {}
|
|
|
|
inline IReporter::~IReporter() {}
|
|
|
|
inline IReporterFactory::~IReporterFactory() {}
|
|
|
|
inline IReporterRegistry::~IReporterRegistry() {}
|
|
|
|
inline IStreamingReporter::~IStreamingReporter() {}
|
|
|
|
inline AssertionStats::~AssertionStats() {}
|
|
|
|
inline SectionStats::~SectionStats() {}
|
|
|
|
inline TestCaseStats::~TestCaseStats() {}
|
|
|
|
inline TestGroupStats::~TestGroupStats() {}
|
|
|
|
inline TestRunStats::~TestRunStats() {}
|
|
|
|
//CumulativeReporterBase::SectionNode::~SectionNode() {}
|
|
|
|
//CumulativeReporterBase::~CumulativeReporterBase() {}
|
|
|
|
|
|
|
|
//StreamingReporterBase::~StreamingReporterBase() {}
|
|
|
|
//ConsoleReporter::~ConsoleReporter() {}
|
|
|
|
inline IRunner::~IRunner() {}
|
|
|
|
inline IMutableContext::~IMutableContext() {}
|
|
|
|
inline IConfig::~IConfig() {}
|
|
|
|
//XmlReporter::~XmlReporter() {}
|
|
|
|
//JunitReporter::~JunitReporter() {}
|
|
|
|
inline TestRegistry::~TestRegistry() {}
|
|
|
|
inline FreeFunctionTestCase::~FreeFunctionTestCase() {}
|
|
|
|
inline IGeneratorInfo::~IGeneratorInfo() {}
|
|
|
|
inline IGeneratorsForTest::~IGeneratorsForTest() {}
|
|
|
|
inline TagParser::~TagParser() {}
|
|
|
|
inline TagExtracter::~TagExtracter() {}
|
|
|
|
inline TagExpressionParser::~TagExpressionParser() {}
|
|
|
|
|
|
|
|
inline Matchers::Impl::StdString::Equals::~Equals() {}
|
|
|
|
inline Matchers::Impl::StdString::Contains::~Contains() {}
|
|
|
|
inline Matchers::Impl::StdString::StartsWith::~StartsWith() {}
|
|
|
|
inline Matchers::Impl::StdString::EndsWith::~EndsWith() {}
|
|
|
|
|
|
|
|
inline void Config::dummy() {}
|
|
|
|
|
|
|
|
//INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "xml", XmlReporter )
|
|
|
|
}
|
|
|
|
|
2013-11-14 20:49:49 +01:00
|
|
|
#endif
|
|
|
|
|
2013-11-17 15:18:02 +01:00
|
|
|
#endif // TWOBLUECUBES_CATCH_VS_MANAGED_HPP_INCLUDED
|