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

summaryrefslogtreecommitdiffhomepage
path: root/Test
diff options
context:
space:
mode:
authorPhil Nash2010-11-29 19:40:44 +0000
committerPhil Nash2010-11-29 19:40:44 +0000
commite6b2b0e656d52f95a9fd292199f9eefb59eae585 (patch)
treeb6f1dce7164b84a38d9d9be2226655f322362b1a /Test
parent3d6fa6897096bd4d0ad1bf3a28436dc9fc922caf (diff)
downloadcatch3-e6b2b0e656d52f95a9fd292199f9eefb59eae585.tar.gz
Implemented more reporter methods and started to fill out Section impl
Diffstat (limited to 'Test')
-rw-r--r--Test/MiscTests.cpp31
-rw-r--r--Test/Test.xcodeproj/project.pbxproj36
-rw-r--r--Test/TestMain.cpp14
-rw-r--r--Test/TrickyTests.cpp1
4 files changed, 70 insertions, 12 deletions
diff --git a/Test/MiscTests.cpp b/Test/MiscTests.cpp
new file mode 100644
index 00000000..ea004cc8
--- /dev/null
+++ b/Test/MiscTests.cpp
@@ -0,0 +1,31 @@
+/*
+ * MiscTests.cpp
+ * Catch - Test
+ *
+ * Created by Phil on 29/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)
+ *
+ */
+
+#include "../catch.hpp"
+
+TEST_CASE( "succeeding/Misc/Sections", "random SECTION tests" )
+{
+ int a = 1;
+ int b = 2;
+
+ SECTION( "s1", "doesn't equal" )
+ {
+ EXPECT( a != b );
+ EXPECT( b != a );
+ }
+
+ SECTION( "s2", "not equal" )
+ {
+ EXPECT_NOT( a == b);
+ }
+
+}
diff --git a/Test/Test.xcodeproj/project.pbxproj b/Test/Test.xcodeproj/project.pbxproj
index 4cb5cb97..0731e547 100644
--- a/Test/Test.xcodeproj/project.pbxproj
+++ b/Test/Test.xcodeproj/project.pbxproj
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
4A3BFFB9128DCF06005609E3 /* TestMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A3BFFB8128DCF06005609E3 /* TestMain.cpp */; };
+ 4AA7EA9212A438C7005A0B97 /* MiscTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AA7EA9112A438C7005A0B97 /* MiscTests.cpp */; };
4AFC38CD12887D80003A0C29 /* ConditionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC38CC12887D80003A0C29 /* ConditionTests.cpp */; };
4AFC3A9912893C56003A0C29 /* ExceptionTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC3A9812893C56003A0C29 /* ExceptionTests.cpp */; };
4AFC3AA912893E54003A0C29 /* MessageTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4AFC3AA812893E54003A0C29 /* MessageTests.cpp */; };
@@ -32,6 +33,8 @@
/* Begin PBXFileReference section */
4A3BFFB8128DCF06005609E3 /* TestMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestMain.cpp; sourceTree = "<group>"; };
4A3BFFF0128DD23C005609E3 /* catch_runnerconfig.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_runnerconfig.hpp; path = ../internal/catch_runnerconfig.hpp; sourceTree = SOURCE_ROOT; };
+ 4AA7E968129FA1DF005A0B97 /* catch_reporter_junit.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_reporter_junit.hpp; path = ../../../Lib/Catch/catch_reporter_junit.hpp; sourceTree = SOURCE_ROOT; };
+ 4AA7EA9112A438C7005A0B97 /* MiscTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MiscTests.cpp; sourceTree = "<group>"; };
4AFC341512809A36003A0C29 /* catch_capture.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_capture.hpp; path = ../internal/catch_capture.hpp; sourceTree = SOURCE_ROOT; };
4AFC341612809A36003A0C29 /* catch_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = catch_common.h; path = ../internal/catch_common.h; sourceTree = SOURCE_ROOT; };
4AFC341712809A36003A0C29 /* catch_registry.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_registry.hpp; path = ../internal/catch_registry.hpp; sourceTree = SOURCE_ROOT; };
@@ -80,13 +83,9 @@
08FB7795FE84155DC02AAC07 /* Source */ = {
isa = PBXGroup;
children = (
+ 4AA7E96C129FA2A0005A0B97 /* Tests */,
4A3BFFB8128DCF06005609E3 /* TestMain.cpp */,
4AFC341312809A12003A0C29 /* Catch */,
- 4AFC38CC12887D80003A0C29 /* ConditionTests.cpp */,
- 4AFC3A9812893C56003A0C29 /* ExceptionTests.cpp */,
- 4AFC3AA812893E54003A0C29 /* MessageTests.cpp */,
- 4AFC3B0A12894114003A0C29 /* ClassTests.cpp */,
- 4AFC3B661289C7E3003A0C29 /* TrickyTests.cpp */,
);
name = Source;
sourceTree = "<group>";
@@ -99,14 +98,36 @@
name = Products;
sourceTree = "<group>";
};
+ 4AA7E96B129FA282005A0B97 /* Reporters */ = {
+ isa = PBXGroup;
+ children = (
+ 4AFC341D12809A45003A0C29 /* catch_reporter_basic.hpp */,
+ 4AFC341E12809A45003A0C29 /* catch_reporter_xml.hpp */,
+ 4AA7E968129FA1DF005A0B97 /* catch_reporter_junit.hpp */,
+ );
+ name = Reporters;
+ sourceTree = "<group>";
+ };
+ 4AA7E96C129FA2A0005A0B97 /* Tests */ = {
+ isa = PBXGroup;
+ children = (
+ 4AA7EA9112A438C7005A0B97 /* MiscTests.cpp */,
+ 4AFC38CC12887D80003A0C29 /* ConditionTests.cpp */,
+ 4AFC3A9812893C56003A0C29 /* ExceptionTests.cpp */,
+ 4AFC3AA812893E54003A0C29 /* MessageTests.cpp */,
+ 4AFC3B0A12894114003A0C29 /* ClassTests.cpp */,
+ 4AFC3B661289C7E3003A0C29 /* TrickyTests.cpp */,
+ );
+ name = Tests;
+ sourceTree = "<group>";
+ };
4AFC341312809A12003A0C29 /* Catch */ = {
isa = PBXGroup;
children = (
4AFC342012809A45003A0C29 /* catch.hpp */,
4AFC341C12809A45003A0C29 /* catch_default_main.hpp */,
- 4AFC341D12809A45003A0C29 /* catch_reporter_basic.hpp */,
- 4AFC341E12809A45003A0C29 /* catch_reporter_xml.hpp */,
4AFC38161284B387003A0C29 /* catch_runner.hpp */,
+ 4AA7E96B129FA282005A0B97 /* Reporters */,
4AFC341412809A1B003A0C29 /* Internal */,
);
name = Catch;
@@ -187,6 +208,7 @@
4AFC3B0B12894114003A0C29 /* ClassTests.cpp in Sources */,
4AFC3B671289C7E3003A0C29 /* TrickyTests.cpp in Sources */,
4A3BFFB9128DCF06005609E3 /* TestMain.cpp in Sources */,
+ 4AA7EA9212A438C7005A0B97 /* MiscTests.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Test/TestMain.cpp b/Test/TestMain.cpp
index 98f85160..0fc13551 100644
--- a/Test/TestMain.cpp
+++ b/Test/TestMain.cpp
@@ -14,6 +14,7 @@
#include "../catch_runner.hpp"
// This code runs the meta tests and verifies that the failing ones failed and the successful ones succeeded
+/*
int main (int argc, char * const argv[])
{
using namespace Catch;
@@ -22,17 +23,18 @@ int main (int argc, char * const argv[])
if( argc > 1 && ( std::string( argv[1] ) == "-s" || std::string( argv[1] ) == "--success" ) )
showAllResults = true;
+ std::ostringstream ossSucceeding;
+ std::ostringstream ossFailing;
+
ReporterConfig reporterConfig( ReporterConfig::Include::SuccessfulResults );
BasicReporter reporter (reporterConfig );
- Runner runner;
- runner.setReporter( &reporter );
- std::ostringstream ossSucceeding;
+ Runner runner( &reporter );
+
reporterConfig.setStreamBuf( ossSucceeding.rdbuf() );
runner.runMatching( "succeeding/*" );
std::string succeedingResults = ossSucceeding.str();
- std::ostringstream ossFailing;
reporterConfig.setStreamBuf( ossFailing.rdbuf() );
runner.runMatching( "failing/*" );
std::string failingResults = ossFailing.str();
@@ -56,10 +58,12 @@ int main (int argc, char * const argv[])
{
std::cout << failingResults << "\n\n";
}
-
+
if( result == 0 )
{
std::cout << "All " << runner.getSuccessCount() + runner.getFailureCount() << " tests completed successfully" << std::endl;
}
return result;
}
+*/
+#include "catch_default_main.hpp" \ No newline at end of file
diff --git a/Test/TrickyTests.cpp b/Test/TrickyTests.cpp
index 73378323..3b74675d 100644
--- a/Test/TrickyTests.cpp
+++ b/Test/TrickyTests.cpp
@@ -41,3 +41,4 @@ TEST_CASE( "succeeding/Tricky/complex lhs", "Where the LHS is not a simple value
// This only captures part of the expression, but issues a warning about the rest
EXPECT( a == 2 || b == 2 );
}
+