2010-11-10 00:24:00 +01:00
|
|
|
/*
|
|
|
|
* main.cpp
|
|
|
|
* Catch - Test
|
|
|
|
*
|
|
|
|
* Created by Phil on 22/10/2010.
|
|
|
|
* Copyright 2010 Two Blue Cubes Ltd
|
|
|
|
*
|
|
|
|
* 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)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-05-24 09:23:02 +02:00
|
|
|
#define CATCH_CONFIG_MAIN
|
|
|
|
#include "catch.hpp"
|
2011-01-19 09:52:25 +01:00
|
|
|
|
2011-05-24 09:23:02 +02:00
|
|
|
|
|
|
|
#include "catch_self_test.hpp"
|
2011-04-01 09:15:58 +02:00
|
|
|
|
2011-01-14 09:38:46 +01:00
|
|
|
TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results" )
|
2010-11-10 00:24:00 +01:00
|
|
|
{
|
2011-03-11 20:44:59 +01:00
|
|
|
using namespace Catch;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
SECTION( "selftest/expected result",
|
|
|
|
"Tests do what they claim" )
|
|
|
|
{
|
|
|
|
SECTION( "selftest/expected result/failing tests",
|
|
|
|
"Tests in the 'failing' branch fail" )
|
|
|
|
{
|
|
|
|
MetaTestRunner::runMatching( "./failing/*", MetaTestRunner::Expected::ToFail );
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION( "selftest/expected result/succeeding tests",
|
|
|
|
"Tests in the 'succeeding' branch succeed" )
|
|
|
|
{
|
|
|
|
MetaTestRunner::runMatching( "./succeeding/*", MetaTestRunner::Expected::ToSucceed );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
SECTION( "selftest/test counts",
|
|
|
|
"Number of test cases that run is fixed" )
|
|
|
|
{
|
|
|
|
EmbeddedRunner runner;
|
|
|
|
|
|
|
|
SECTION( "selftest/test counts/succeeding tests",
|
|
|
|
"Number of 'succeeding' tests is fixed" )
|
|
|
|
{
|
|
|
|
runner.runMatching( "./succeeding/*" );
|
2011-06-29 20:22:56 +02:00
|
|
|
CHECK( runner.getSuccessCount() == 249 );
|
2011-03-11 20:44:59 +01:00
|
|
|
CHECK( runner.getFailureCount() == 0 );
|
|
|
|
}
|
2010-11-29 20:40:44 +01:00
|
|
|
|
2011-03-11 20:44:59 +01:00
|
|
|
SECTION( "selftest/test counts/failing tests",
|
|
|
|
"Number of 'failing' tests is fixed" )
|
|
|
|
{
|
|
|
|
runner.runMatching( "./failing/*" );
|
|
|
|
CHECK( runner.getSuccessCount() == 0 );
|
2011-04-22 20:30:55 +02:00
|
|
|
CHECK( runner.getFailureCount() == 60 );
|
2011-03-11 20:44:59 +01:00
|
|
|
}
|
|
|
|
}
|
2010-11-10 00:24:00 +01:00
|
|
|
}
|
2011-02-21 19:48:00 +01:00
|
|
|
|
|
|
|
TEST_CASE( "meta/Misc/Sections", "looped tests" )
|
|
|
|
{
|
|
|
|
Catch::EmbeddedRunner runner;
|
|
|
|
|
2011-02-21 19:50:35 +01:00
|
|
|
runner.runMatching( "./mixed/Misc/Sections/nested2" );
|
2011-02-28 09:18:52 +01:00
|
|
|
CHECK( runner.getSuccessCount() == 2 );
|
|
|
|
CHECK( runner.getFailureCount() == 1 );
|
2011-02-21 19:48:00 +01:00
|
|
|
|
|
|
|
}
|