2010-11-10 00:24:00 +01:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
#include "catch_self_test.hpp"
|
2011-04-01 09:15:58 +02:00
|
|
|
|
2012-05-16 16:02:51 +02:00
|
|
|
TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results" ) {
|
2011-03-11 20:44:59 +01:00
|
|
|
using namespace Catch;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
SECTION( "selftest/expected result",
|
2012-05-16 16:02:51 +02:00
|
|
|
"Tests do what they claim" ) {
|
|
|
|
|
2011-03-11 20:44:59 +01:00
|
|
|
SECTION( "selftest/expected result/failing tests",
|
2012-05-16 16:02:51 +02:00
|
|
|
"Tests in the 'failing' branch fail" ) {
|
2011-03-11 20:44:59 +01:00
|
|
|
MetaTestRunner::runMatching( "./failing/*", MetaTestRunner::Expected::ToFail );
|
|
|
|
}
|
|
|
|
|
|
|
|
SECTION( "selftest/expected result/succeeding tests",
|
2012-05-16 16:02:51 +02:00
|
|
|
"Tests in the 'succeeding' branch succeed" ) {
|
2011-03-11 20:44:59 +01:00
|
|
|
MetaTestRunner::runMatching( "./succeeding/*", MetaTestRunner::Expected::ToSucceed );
|
|
|
|
}
|
|
|
|
}
|
2012-03-04 22:18:46 +01:00
|
|
|
|
2011-03-11 20:44:59 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
SECTION( "selftest/test counts",
|
2012-05-16 16:02:51 +02:00
|
|
|
"Number of test cases that run is fixed" ) {
|
2011-03-11 20:44:59 +01:00
|
|
|
EmbeddedRunner runner;
|
|
|
|
|
|
|
|
SECTION( "selftest/test counts/succeeding tests",
|
2012-05-16 16:02:51 +02:00
|
|
|
"Number of 'succeeding' tests is fixed" ) {
|
2011-03-11 20:44:59 +01:00
|
|
|
runner.runMatching( "./succeeding/*" );
|
2012-05-24 09:29:03 +02:00
|
|
|
CHECK( runner.getTotals().assertions.passed == 277 );
|
2012-02-23 19:51:21 +01:00
|
|
|
CHECK( runner.getTotals().assertions.failed == 0 );
|
2011-03-11 20:44:59 +01:00
|
|
|
}
|
2010-11-29 20:40:44 +01:00
|
|
|
|
2011-03-11 20:44:59 +01:00
|
|
|
SECTION( "selftest/test counts/failing tests",
|
2012-05-16 16:02:51 +02:00
|
|
|
"Number of 'failing' tests is fixed" ) {
|
2011-03-11 20:44:59 +01:00
|
|
|
runner.runMatching( "./failing/*" );
|
2012-02-23 19:51:21 +01:00
|
|
|
CHECK( runner.getTotals().assertions.passed == 0 );
|
2012-05-24 09:29:03 +02:00
|
|
|
CHECK( runner.getTotals().assertions.failed == 72 );
|
2011-03-11 20:44:59 +01:00
|
|
|
}
|
|
|
|
}
|
2010-11-10 00:24:00 +01:00
|
|
|
}
|
2011-02-21 19:48:00 +01:00
|
|
|
|
2012-05-16 16:02:51 +02:00
|
|
|
TEST_CASE( "meta/Misc/Sections", "looped tests" ) {
|
2011-02-21 19:48:00 +01:00
|
|
|
Catch::EmbeddedRunner runner;
|
|
|
|
|
2011-02-21 19:50:35 +01:00
|
|
|
runner.runMatching( "./mixed/Misc/Sections/nested2" );
|
2012-02-23 19:51:21 +01:00
|
|
|
CHECK( runner.getTotals().assertions.passed == 2 );
|
|
|
|
CHECK( runner.getTotals().assertions.failed == 1 );
|
2011-02-21 19:48:00 +01:00
|
|
|
}
|