2010-11-10 00:24:00 +01:00
|
|
|
/*
|
|
|
|
* catch_list.hpp
|
|
|
|
* Catch
|
|
|
|
*
|
|
|
|
* Created by Phil on 5/11/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_LIST_HPP_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_LIST_HPP_INCLUDED
|
|
|
|
|
|
|
|
#include "catch_commandline.hpp"
|
2010-11-11 21:42:16 +01:00
|
|
|
#include <limits>
|
2010-11-11 21:56:38 +01:00
|
|
|
|
2010-11-10 00:24:00 +01:00
|
|
|
namespace Catch
|
|
|
|
{
|
2011-01-01 01:20:14 +01:00
|
|
|
inline int List( const Config& config )
|
2010-11-10 00:24:00 +01:00
|
|
|
{
|
2011-01-01 01:37:49 +01:00
|
|
|
if( config.listWhat() & Config::List::Reports )
|
2010-11-10 00:24:00 +01:00
|
|
|
{
|
|
|
|
std::cout << "Available reports:\n";
|
2010-12-31 23:54:35 +01:00
|
|
|
IReporterRegistry::FactoryMap::const_iterator it = Hub::getReporterRegistry().getFactories().begin();
|
|
|
|
IReporterRegistry::FactoryMap::const_iterator itEnd = Hub::getReporterRegistry().getFactories().end();
|
2010-11-10 00:24:00 +01:00
|
|
|
for(; it != itEnd; ++it )
|
|
|
|
{
|
|
|
|
// !TBD: consider listAs()
|
2010-12-28 14:31:22 +01:00
|
|
|
std::cout << "\t" << it->first << "\n\t\t'" << it->second->getDescription() << "'\n";
|
2010-11-10 00:24:00 +01:00
|
|
|
}
|
|
|
|
std::cout << std::endl;
|
|
|
|
}
|
2011-01-01 01:37:49 +01:00
|
|
|
if( config.listWhat() & Config::List::Tests )
|
2010-11-10 00:24:00 +01:00
|
|
|
{
|
|
|
|
std::cout << "Available tests:\n";
|
|
|
|
std::vector<TestCaseInfo>::const_iterator it = TestRegistry::instance().getAllTests().begin();
|
|
|
|
std::vector<TestCaseInfo>::const_iterator itEnd = TestRegistry::instance().getAllTests().end();
|
|
|
|
for(; it != itEnd; ++it )
|
|
|
|
{
|
|
|
|
// !TBD: consider listAs()
|
2010-12-28 14:31:22 +01:00
|
|
|
std::cout << "\t" << it->getName() << "\n\t\t '" << it->getDescription() << "'\n";
|
2010-11-10 00:24:00 +01:00
|
|
|
}
|
|
|
|
std::cout << std::endl;
|
|
|
|
}
|
2011-01-01 01:37:49 +01:00
|
|
|
if( ( config.listWhat() & Config::List::All ) == 0 )
|
2010-11-10 00:24:00 +01:00
|
|
|
{
|
|
|
|
std::cerr << "Unknown list type" << std::endl;
|
|
|
|
return std::numeric_limits<int>::max();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( config.getReporter() )
|
|
|
|
{
|
|
|
|
std::cerr << "Reporters ignored when listing" << std::endl;
|
|
|
|
}
|
|
|
|
if( config.m_testSpecs.size() == 0 )
|
|
|
|
{
|
|
|
|
std::cerr << "Test specs ignored when listing" << std::endl;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end namespace Catch
|
|
|
|
|
2010-11-11 21:42:16 +01:00
|
|
|
#endif // TWOBLUECUBES_CATCH_LIST_HPP_INCLUDED
|