From 70178026e6f15f8f8b46b00713974a6cba16c828 Mon Sep 17 00:00:00 2001 From: Fraser Hutchison Date: Fri, 7 Mar 2014 21:48:46 +0000 Subject: [PATCH] Added trivial test executable which doesn't use Catch's main() function. --- projects/CMake/CMakeLists.txt | 4 +++- projects/SelfTest/TestExternalMain.cpp | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 projects/SelfTest/TestExternalMain.cpp diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index c31ec32b..b4f8d959 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -23,13 +23,15 @@ set(SOURCES ${SELF_TEST_DIR}/VariadicMacrosTests.cpp ) -# configure the executable +# configure the executables include_directories(${CATCH_DIR}/include) add_executable(SelfTest ${SOURCES}) +add_executable(SelfTestExternalMain ${SELF_TEST_DIR}/TestExternalMain.cpp) # configure unit tests via CTest enable_testing() add_test(NAME RunTests COMMAND SelfTest) +add_test(NAME RunExternalMainTests COMMAND SelfTestExternalMain) add_test(NAME ListTests COMMAND SelfTest --list-tests) set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") diff --git a/projects/SelfTest/TestExternalMain.cpp b/projects/SelfTest/TestExternalMain.cpp new file mode 100644 index 00000000..9e978c3e --- /dev/null +++ b/projects/SelfTest/TestExternalMain.cpp @@ -0,0 +1,14 @@ +/* + * Created by Fraser on 07/03/2014. + * Copyright 2014 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) + */ + +#define CATCH_CONFIG_RUNNER +#include "catch.hpp" + +int main (int argc, char * const argv[]) { + return Catch::Session().run( argc, argv ); +}