Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/TestMain.cpp
diff options
context:
space:
mode:
authorPhil Nash2011-04-26 08:32:40 +0100
committerPhil Nash2011-04-26 08:32:40 +0100
commit823ea3efd44b988e4e50a05069b19062587e72c9 (patch)
tree65c5c6a1549c0e0d299c0fa40352f813dba7ae65 /projects/SelfTest/TestMain.cpp
parent02c877f91644e498ce0c9c257823e63a1154c652 (diff)
downloadcatch3-823ea3efd44b988e4e50a05069b19062587e72c9.tar.gz
Re-org
Diffstat (limited to 'projects/SelfTest/TestMain.cpp')
-rw-r--r--projects/SelfTest/TestMain.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp
new file mode 100644
index 00000000..969eba4d
--- /dev/null
+++ b/projects/SelfTest/TestMain.cpp
@@ -0,0 +1,75 @@
+/*
+ * 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_with_main.hpp"
+#include "internal/catch_self_test.hpp"
+
+#include "catch_runner.hpp"
+int main (int argc, char * const argv[])
+{
+ return Catch::Main( argc, argv );
+}
+
+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() == 223 );
+ 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() == 60 );
+ }
+ }
+}
+
+TEST_CASE( "meta/Misc/Sections", "looped tests" )
+{
+ Catch::EmbeddedRunner runner;
+
+ runner.runMatching( "./mixed/Misc/Sections/nested2" );
+ CHECK( runner.getSuccessCount() == 2 );
+ CHECK( runner.getFailureCount() == 1 );
+
+}