mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
7b449f7abe
Factored file/ line storage and formatting into common class. Used in a static registry so failure messages can be asserted to have the file/ line in.
69 lines
2.1 KiB
C++
69 lines
2.1 KiB
C++
/*
|
|
* 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)
|
|
*
|
|
*/
|
|
|
|
#include "catch_self_test.hpp"
|
|
|
|
TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results" )
|
|
{
|
|
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/*" );
|
|
CHECK( runner.getSuccessCount() == 267 );
|
|
CHECK( runner.getFailureCount() == 0 );
|
|
}
|
|
|
|
SECTION( "selftest/test counts/failing tests",
|
|
"Number of 'failing' tests is fixed" )
|
|
{
|
|
runner.runMatching( "./failing/*" );
|
|
CHECK( runner.getSuccessCount() == 0 );
|
|
CHECK( runner.getFailureCount() == 68 );
|
|
}
|
|
}
|
|
}
|
|
|
|
TEST_CASE( "meta/Misc/Sections", "looped tests" )
|
|
{
|
|
Catch::EmbeddedRunner runner;
|
|
|
|
runner.runMatching( "./mixed/Misc/Sections/nested2" );
|
|
CHECK( runner.getSuccessCount() == 2 );
|
|
CHECK( runner.getFailureCount() == 1 );
|
|
|
|
}
|