mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-27 06:45:40 +02:00
Compare commits
42 Commits
v2.0.0-dev
...
v2.0.0-dev
Author | SHA1 | Date | |
---|---|---|---|
![]() |
bd46f66754 | ||
![]() |
e9f0773f37 | ||
![]() |
54f1ce2af2 | ||
![]() |
0a146e3af7 | ||
![]() |
b9ff7ec301 | ||
![]() |
a63b4a75bd | ||
![]() |
8da0d0473b | ||
![]() |
40209d1ae0 | ||
![]() |
4e85267203 | ||
![]() |
eaf850cd0c | ||
![]() |
9aa96712ae | ||
![]() |
6105282c4f | ||
![]() |
ca7021ae19 | ||
![]() |
03d41ce5b9 | ||
![]() |
c5608f0202 | ||
![]() |
8c39f9a725 | ||
![]() |
4e5a67bc44 | ||
![]() |
2d37649377 | ||
![]() |
8d03cb4915 | ||
![]() |
b000411434 | ||
![]() |
aef2e4d9e7 | ||
![]() |
ab5d176195 | ||
![]() |
b3a923133d | ||
![]() |
35bad89684 | ||
![]() |
792d3d0a26 | ||
![]() |
be067bce37 | ||
![]() |
115db71bab | ||
![]() |
3a5b951256 | ||
![]() |
4e4a13dfb4 | ||
![]() |
e8ec6bd73c | ||
![]() |
e871742534 | ||
![]() |
6388fc946f | ||
![]() |
a4df0b2c37 | ||
![]() |
97edf7ce65 | ||
![]() |
49a1408ff2 | ||
![]() |
9796c516bb | ||
![]() |
255f7d7369 | ||
![]() |
46e28791ff | ||
![]() |
0673b9be35 | ||
![]() |
48db47c737 | ||
![]() |
cde57d9365 | ||
![]() |
13213faa4e |
@@ -85,16 +85,9 @@ CheckFileList(TEST_SOURCES ${SELF_TEST_DIR})
|
|||||||
set(SURROGATE_SOURCES
|
set(SURROGATE_SOURCES
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp
|
${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp
|
${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_capture.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_config.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_exception.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_registry_hub.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp
|
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_runner.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_testcase.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp
|
${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp
|
${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_streambuf.cpp
|
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_test_case_tracker.cpp
|
${SELF_TEST_DIR}/SurrogateCpps/catch_test_case_tracker.cpp
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp
|
${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp
|
||||||
${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp
|
${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp
|
||||||
@@ -105,7 +98,6 @@ CheckFileList(SURROGATE_SOURCES ${SELF_TEST_DIR}/SurrogateCpps)
|
|||||||
# Please keep these ordered alphabetically
|
# Please keep these ordered alphabetically
|
||||||
set(TOP_LEVEL_HEADERS
|
set(TOP_LEVEL_HEADERS
|
||||||
${HEADER_DIR}/catch.hpp
|
${HEADER_DIR}/catch.hpp
|
||||||
${HEADER_DIR}/catch_session.hpp
|
|
||||||
${HEADER_DIR}/catch_with_main.hpp
|
${HEADER_DIR}/catch_with_main.hpp
|
||||||
)
|
)
|
||||||
CheckFileList(TOP_LEVEL_HEADERS ${HEADER_DIR})
|
CheckFileList(TOP_LEVEL_HEADERS ${HEADER_DIR})
|
||||||
@@ -119,18 +111,18 @@ CheckFileList(EXTERNAL_HEADERS ${HEADER_DIR}/external)
|
|||||||
|
|
||||||
# Please keep these ordered alphabetically
|
# Please keep these ordered alphabetically
|
||||||
set(INTERNAL_HEADERS
|
set(INTERNAL_HEADERS
|
||||||
${HEADER_DIR}/internal/catch_approx.hpp
|
${HEADER_DIR}/internal/catch_approx.h
|
||||||
${HEADER_DIR}/internal/catch_assertionhandler.h
|
${HEADER_DIR}/internal/catch_assertionhandler.h
|
||||||
${HEADER_DIR}/internal/catch_assertioninfo.h
|
${HEADER_DIR}/internal/catch_assertioninfo.h
|
||||||
${HEADER_DIR}/internal/catch_assertionresult.h
|
${HEADER_DIR}/internal/catch_assertionresult.h
|
||||||
${HEADER_DIR}/internal/catch_capture.hpp
|
${HEADER_DIR}/internal/catch_capture.hpp
|
||||||
${HEADER_DIR}/internal/catch_capture_matchers.h
|
${HEADER_DIR}/internal/catch_capture_matchers.h
|
||||||
${HEADER_DIR}/internal/catch_clara.h
|
${HEADER_DIR}/internal/catch_clara.h
|
||||||
${HEADER_DIR}/internal/catch_commandline.hpp
|
${HEADER_DIR}/internal/catch_commandline.h
|
||||||
${HEADER_DIR}/internal/catch_common.h
|
${HEADER_DIR}/internal/catch_common.h
|
||||||
${HEADER_DIR}/internal/catch_compiler_capabilities.h
|
${HEADER_DIR}/internal/catch_compiler_capabilities.h
|
||||||
${HEADER_DIR}/internal/catch_config.hpp
|
${HEADER_DIR}/internal/catch_config.hpp
|
||||||
${HEADER_DIR}/internal/catch_console_colour.hpp
|
${HEADER_DIR}/internal/catch_console_colour.h
|
||||||
${HEADER_DIR}/internal/catch_context.h
|
${HEADER_DIR}/internal/catch_context.h
|
||||||
${HEADER_DIR}/internal/catch_debug_console.h
|
${HEADER_DIR}/internal/catch_debug_console.h
|
||||||
${HEADER_DIR}/internal/catch_debugger.h
|
${HEADER_DIR}/internal/catch_debugger.h
|
||||||
@@ -152,23 +144,24 @@ set(INTERNAL_HEADERS
|
|||||||
${HEADER_DIR}/internal/catch_interfaces_testcase.h
|
${HEADER_DIR}/internal/catch_interfaces_testcase.h
|
||||||
${HEADER_DIR}/internal/catch_leak_detector.h
|
${HEADER_DIR}/internal/catch_leak_detector.h
|
||||||
${HEADER_DIR}/internal/catch_list.h
|
${HEADER_DIR}/internal/catch_list.h
|
||||||
${HEADER_DIR}/internal/catch_matchers.hpp
|
${HEADER_DIR}/internal/catch_matchers.h
|
||||||
${HEADER_DIR}/internal/catch_matchers_string.h
|
${HEADER_DIR}/internal/catch_matchers_string.h
|
||||||
${HEADER_DIR}/internal/catch_matchers_vector.h
|
${HEADER_DIR}/internal/catch_matchers_vector.h
|
||||||
${HEADER_DIR}/internal/catch_message.h
|
${HEADER_DIR}/internal/catch_message.h
|
||||||
${HEADER_DIR}/internal/catch_notimplemented_exception.h
|
|
||||||
${HEADER_DIR}/internal/catch_objc.hpp
|
${HEADER_DIR}/internal/catch_objc.hpp
|
||||||
${HEADER_DIR}/internal/catch_objc_arc.hpp
|
${HEADER_DIR}/internal/catch_objc_arc.hpp
|
||||||
${HEADER_DIR}/internal/catch_option.hpp
|
${HEADER_DIR}/internal/catch_option.hpp
|
||||||
${HEADER_DIR}/internal/catch_platform.h
|
${HEADER_DIR}/internal/catch_platform.h
|
||||||
|
${HEADER_DIR}/internal/catch_random_number_generator.h
|
||||||
${HEADER_DIR}/internal/catch_reenable_warnings.h
|
${HEADER_DIR}/internal/catch_reenable_warnings.h
|
||||||
${HEADER_DIR}/internal/catch_reporter_registrars.hpp
|
${HEADER_DIR}/internal/catch_reporter_registrars.hpp
|
||||||
${HEADER_DIR}/internal/catch_reporter_registry.hpp
|
${HEADER_DIR}/internal/catch_reporter_registry.h
|
||||||
${HEADER_DIR}/internal/catch_result_type.h
|
${HEADER_DIR}/internal/catch_result_type.h
|
||||||
${HEADER_DIR}/internal/catch_run_context.hpp
|
${HEADER_DIR}/internal/catch_run_context.h
|
||||||
${HEADER_DIR}/internal/catch_benchmark.h
|
${HEADER_DIR}/internal/catch_benchmark.h
|
||||||
${HEADER_DIR}/internal/catch_section.h
|
${HEADER_DIR}/internal/catch_section.h
|
||||||
${HEADER_DIR}/internal/catch_section_info.h
|
${HEADER_DIR}/internal/catch_section_info.h
|
||||||
|
${HEADER_DIR}/internal/catch_session.h
|
||||||
${HEADER_DIR}/internal/catch_startup_exception_registry.h
|
${HEADER_DIR}/internal/catch_startup_exception_registry.h
|
||||||
${HEADER_DIR}/internal/catch_stream.h
|
${HEADER_DIR}/internal/catch_stream.h
|
||||||
${HEADER_DIR}/internal/catch_streambuf.h
|
${HEADER_DIR}/internal/catch_streambuf.h
|
||||||
@@ -179,19 +172,19 @@ set(INTERNAL_HEADERS
|
|||||||
${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.h
|
${HEADER_DIR}/internal/catch_tag_alias_autoregistrar.h
|
||||||
${HEADER_DIR}/internal/catch_tag_alias_registry.h
|
${HEADER_DIR}/internal/catch_tag_alias_registry.h
|
||||||
${HEADER_DIR}/internal/catch_test_case_info.h
|
${HEADER_DIR}/internal/catch_test_case_info.h
|
||||||
${HEADER_DIR}/internal/catch_test_case_registry_impl.hpp
|
${HEADER_DIR}/internal/catch_test_case_registry_impl.h
|
||||||
${HEADER_DIR}/internal/catch_test_case_tracker.hpp
|
${HEADER_DIR}/internal/catch_test_case_tracker.h
|
||||||
${HEADER_DIR}/internal/catch_test_registry.hpp
|
${HEADER_DIR}/internal/catch_test_registry.h
|
||||||
${HEADER_DIR}/internal/catch_test_spec.hpp
|
${HEADER_DIR}/internal/catch_test_spec.h
|
||||||
${HEADER_DIR}/internal/catch_test_spec_parser.hpp
|
${HEADER_DIR}/internal/catch_test_spec_parser.h
|
||||||
${HEADER_DIR}/internal/catch_text.h
|
${HEADER_DIR}/internal/catch_text.h
|
||||||
${HEADER_DIR}/internal/catch_timer.h
|
${HEADER_DIR}/internal/catch_timer.h
|
||||||
${HEADER_DIR}/internal/catch_tostring.h
|
${HEADER_DIR}/internal/catch_tostring.h
|
||||||
${HEADER_DIR}/internal/catch_totals.hpp
|
${HEADER_DIR}/internal/catch_totals.h
|
||||||
${HEADER_DIR}/internal/catch_version.h
|
${HEADER_DIR}/internal/catch_version.h
|
||||||
${HEADER_DIR}/internal/catch_wildcard_pattern.hpp
|
${HEADER_DIR}/internal/catch_wildcard_pattern.h
|
||||||
${HEADER_DIR}/internal/catch_windows_h_proxy.h
|
${HEADER_DIR}/internal/catch_windows_h_proxy.h
|
||||||
${HEADER_DIR}/internal/catch_xmlwriter.hpp
|
${HEADER_DIR}/internal/catch_xmlwriter.h
|
||||||
)
|
)
|
||||||
set(IMPL_SOURCES
|
set(IMPL_SOURCES
|
||||||
${HEADER_DIR}/internal/catch_approx.cpp
|
${HEADER_DIR}/internal/catch_approx.cpp
|
||||||
@@ -210,20 +203,29 @@ set(IMPL_SOURCES
|
|||||||
${HEADER_DIR}/internal/catch_errno_guard.cpp
|
${HEADER_DIR}/internal/catch_errno_guard.cpp
|
||||||
${HEADER_DIR}/internal/catch_exception_translator_registry.cpp
|
${HEADER_DIR}/internal/catch_exception_translator_registry.cpp
|
||||||
${HEADER_DIR}/internal/catch_fatal_condition.cpp
|
${HEADER_DIR}/internal/catch_fatal_condition.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_capture.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_config.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_exception.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_registry_hub.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_runner.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_interfaces_testcase.cpp
|
||||||
${HEADER_DIR}/internal/catch_list.cpp
|
${HEADER_DIR}/internal/catch_list.cpp
|
||||||
${HEADER_DIR}/internal/catch_leak_detector.cpp
|
${HEADER_DIR}/internal/catch_leak_detector.cpp
|
||||||
${HEADER_DIR}/internal/catch_matchers.cpp
|
${HEADER_DIR}/internal/catch_matchers.cpp
|
||||||
${HEADER_DIR}/internal/catch_matchers_string.cpp
|
${HEADER_DIR}/internal/catch_matchers_string.cpp
|
||||||
${HEADER_DIR}/internal/catch_message.cpp
|
${HEADER_DIR}/internal/catch_message.cpp
|
||||||
${HEADER_DIR}/internal/catch_notimplemented_exception.cpp
|
|
||||||
${HEADER_DIR}/internal/catch_registry_hub.cpp
|
${HEADER_DIR}/internal/catch_registry_hub.cpp
|
||||||
${HEADER_DIR}/internal/catch_interfaces_reporter.cpp
|
${HEADER_DIR}/internal/catch_interfaces_reporter.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_random_number_generator.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_reporter_registry.cpp
|
||||||
${HEADER_DIR}/internal/catch_result_type.cpp
|
${HEADER_DIR}/internal/catch_result_type.cpp
|
||||||
${HEADER_DIR}/internal/catch_run_context.cpp
|
${HEADER_DIR}/internal/catch_run_context.cpp
|
||||||
${HEADER_DIR}/internal/catch_section.cpp
|
${HEADER_DIR}/internal/catch_section.cpp
|
||||||
${HEADER_DIR}/internal/catch_section_info.cpp
|
${HEADER_DIR}/internal/catch_section_info.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_session.cpp
|
||||||
${HEADER_DIR}/internal/catch_startup_exception_registry.cpp
|
${HEADER_DIR}/internal/catch_startup_exception_registry.cpp
|
||||||
${HEADER_DIR}/internal/catch_stream.cpp
|
${HEADER_DIR}/internal/catch_stream.cpp
|
||||||
|
${HEADER_DIR}/internal/catch_streambuf.cpp
|
||||||
${HEADER_DIR}/internal/catch_stringref.cpp
|
${HEADER_DIR}/internal/catch_stringref.cpp
|
||||||
${HEADER_DIR}/internal/catch_string_manip.cpp
|
${HEADER_DIR}/internal/catch_string_manip.cpp
|
||||||
${HEADER_DIR}/internal/catch_tag_alias.cpp
|
${HEADER_DIR}/internal/catch_tag_alias.cpp
|
||||||
@@ -297,8 +299,13 @@ if (NOT NO_SELFTEST)
|
|||||||
|
|
||||||
# Add desired warnings
|
# Add desired warnings
|
||||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" )
|
||||||
target_compile_options( SelfTest PRIVATE -Wall -Wextra )
|
target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code )
|
||||||
target_compile_options( Benchmark PRIVATE -Wall -Wextra )
|
target_compile_options( Benchmark PRIVATE -Wall -Wextra -Wunreachable-code )
|
||||||
|
endif()
|
||||||
|
# Clang specific warning go here
|
||||||
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
|
# Actually keep these
|
||||||
|
target_compile_options( SelfTest PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn )
|
||||||
endif()
|
endif()
|
||||||
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
|
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
|
||||||
target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX )
|
target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX )
|
||||||
@@ -316,6 +323,9 @@ if (NOT NO_SELFTEST)
|
|||||||
add_test(NAME ListTags COMMAND SelfTest --list-tags)
|
add_test(NAME ListTags COMMAND SelfTest --list-tags)
|
||||||
set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")
|
set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags")
|
||||||
|
|
||||||
|
# AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable
|
||||||
|
add_test(NAME ApprovalTests COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
|
||||||
|
set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed")
|
||||||
endif() # !NO_SELFTEST
|
endif() # !NO_SELFTEST
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@ from conans import ConanFile
|
|||||||
|
|
||||||
class CatchConan(ConanFile):
|
class CatchConan(ConanFile):
|
||||||
name = "Catch"
|
name = "Catch"
|
||||||
version = "2.0.0-develop.3"
|
version = "2.0.0-develop.4"
|
||||||
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
||||||
author = "philsquared"
|
author = "philsquared"
|
||||||
generators = "cmake"
|
generators = "cmake"
|
||||||
|
@@ -17,6 +17,10 @@
|
|||||||
* `*_THROWS_AS(expr, exception_type)` now unconditionally appends `const&` to the exception type.
|
* `*_THROWS_AS(expr, exception_type)` now unconditionally appends `const&` to the exception type.
|
||||||
* `CATCH_CONFIG_FAST_COMPILE` now affects the `CHECK_` family of assertions as well as `REQUIRE_` family of assertions
|
* `CATCH_CONFIG_FAST_COMPILE` now affects the `CHECK_` family of assertions as well as `REQUIRE_` family of assertions
|
||||||
* This is most noticeable in `CHECK(throws())`, which would previously report failure, properly stringify the exception and continue. Now it will report failure and stop executing current section.
|
* This is most noticeable in `CHECK(throws())`, which would previously report failure, properly stringify the exception and continue. Now it will report failure and stop executing current section.
|
||||||
|
* Removed deprecated matcher utility functions `Not`, `AllOf` and `AnyOf`.
|
||||||
|
* They are superseded by operators `!`, `&&` and `||`, which are natural and do not have limited arity
|
||||||
|
* No longer accept non-const comparison operators
|
||||||
|
|
||||||
|
|
||||||
## Improvements
|
## Improvements
|
||||||
* Reporters and Listeners can be defined in files different from the main file
|
* Reporters and Listeners can be defined in files different from the main file
|
||||||
@@ -36,14 +40,21 @@
|
|||||||
* All parts of matchers can be removed from a TU by defining `CATCH_CONFIG_DISABLE_MATCHERS`
|
* All parts of matchers can be removed from a TU by defining `CATCH_CONFIG_DISABLE_MATCHERS`
|
||||||
* This can be used to somewhat speed up compilation times
|
* This can be used to somewhat speed up compilation times
|
||||||
* An experimental implementation of `CATCH_CONFIG_DISABLE` has been added
|
* An experimental implementation of `CATCH_CONFIG_DISABLE` has been added
|
||||||
* Speeds up compilation by removing away Catch tests
|
* Inspired by Doctest's `DOCTEST_CONFIG_DISABLE`
|
||||||
* Currently removes all assertions and prevents `TEST_CASE` registrations
|
|
||||||
* Useful for implementing tests in source files
|
* Useful for implementing tests in source files
|
||||||
* ie for functions in anonymous namespaces
|
* ie for functions in anonymous namespaces
|
||||||
* Inspired by Doctest's `DOCTEST_CONFIG_DISABLE`
|
* Removes all assertions
|
||||||
|
* Prevents `TEST_CASE` registrations
|
||||||
|
* Exception translators are not registered
|
||||||
|
* Reporters are not registered
|
||||||
|
* Listeners are not registered
|
||||||
|
* More warnings are silenced
|
||||||
|
* Don't use console colour if running in XCode
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
* Explicit constructor in reporter base class
|
||||||
|
* Many fixes for building in Objective-C context
|
||||||
|
* Do not use SEH and console api under UWP
|
||||||
|
|
||||||
## Internal changes
|
## Internal changes
|
||||||
* The development version now uses .cpp files instead of header files containing implementation.
|
* The development version now uses .cpp files instead of header files containing implementation.
|
||||||
@@ -53,7 +64,6 @@
|
|||||||
* New library (TextFlow) is used for formatting text to output
|
* New library (TextFlow) is used for formatting text to output
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Older versions
|
# Older versions
|
||||||
|
|
||||||
## 1.9.x
|
## 1.9.x
|
||||||
|
@@ -20,6 +20,9 @@
|
|||||||
#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
|
#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
|
||||||
# define CATCH_IMPL
|
# define CATCH_IMPL
|
||||||
# define CATCH_CONFIG_EXTERNAL_INTERFACES
|
# define CATCH_CONFIG_EXTERNAL_INTERFACES
|
||||||
|
# if defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
||||||
|
# undef CATCH_CONFIG_DISABLE_MATCHERS
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "internal/catch_platform.h"
|
#include "internal/catch_platform.h"
|
||||||
@@ -32,14 +35,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "internal/catch_tag_alias_autoregistrar.h"
|
#include "internal/catch_tag_alias_autoregistrar.h"
|
||||||
#include "internal/catch_test_registry.hpp"
|
#include "internal/catch_test_registry.h"
|
||||||
#include "internal/catch_capture.hpp"
|
#include "internal/catch_capture.hpp"
|
||||||
#include "internal/catch_section.h"
|
#include "internal/catch_section.h"
|
||||||
#include "internal/catch_benchmark.h"
|
#include "internal/catch_benchmark.h"
|
||||||
#include "internal/catch_interfaces_exception.h"
|
#include "internal/catch_interfaces_exception.h"
|
||||||
#include "internal/catch_approx.hpp"
|
#include "internal/catch_approx.h"
|
||||||
#include "internal/catch_compiler_capabilities.h"
|
#include "internal/catch_compiler_capabilities.h"
|
||||||
#include "internal/catch_interfaces_tag_alias_registry.h"
|
#include "internal/catch_string_manip.h"
|
||||||
|
|
||||||
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
||||||
#include "internal/catch_capture_matchers.h"
|
#include "internal/catch_capture_matchers.h"
|
||||||
|
@@ -1,264 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 31/10/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)
|
|
||||||
*/
|
|
||||||
#ifndef TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
|
||||||
#define TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
|
||||||
|
|
||||||
#include "internal/catch_commandline.hpp"
|
|
||||||
#include "internal/catch_console_colour.hpp"
|
|
||||||
#include "internal/catch_enforce.h"
|
|
||||||
#include "internal/catch_list.h"
|
|
||||||
#include "internal/catch_run_context.hpp"
|
|
||||||
#include "internal/catch_stream.h"
|
|
||||||
#include "internal/catch_test_spec.hpp"
|
|
||||||
#include "internal/catch_version.h"
|
|
||||||
#include "internal/catch_interfaces_reporter.h"
|
|
||||||
#include "internal/catch_startup_exception_registry.h"
|
|
||||||
#include "internal/catch_text.h"
|
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <limits>
|
|
||||||
#include <iomanip>
|
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
IStreamingReporterPtr createReporter( std::string const& reporterName, IConfigPtr const& config ) {
|
|
||||||
auto reporter = getRegistryHub().getReporterRegistry().create( reporterName, config );
|
|
||||||
CATCH_ENFORCE( reporter, "No reporter registered with name: '" << reporterName << "'" );
|
|
||||||
|
|
||||||
return reporter;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef CATCH_CONFIG_DEFAULT_REPORTER
|
|
||||||
#define CATCH_CONFIG_DEFAULT_REPORTER "console"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
IStreamingReporterPtr makeReporter( std::shared_ptr<Config> const& config ) {
|
|
||||||
auto const& reporterNames = config->getReporterNames();
|
|
||||||
if( reporterNames.empty() )
|
|
||||||
return createReporter(CATCH_CONFIG_DEFAULT_REPORTER, config );
|
|
||||||
|
|
||||||
IStreamingReporterPtr reporter;
|
|
||||||
for( auto const& name : reporterNames )
|
|
||||||
addReporter( reporter, createReporter( name, config ) );
|
|
||||||
return reporter;
|
|
||||||
}
|
|
||||||
void addListeners( IStreamingReporterPtr& reporters, IConfigPtr const& config ) {
|
|
||||||
auto const& listeners = getRegistryHub().getReporterRegistry().getListeners();
|
|
||||||
for( auto const& listener : listeners )
|
|
||||||
addReporter(reporters, listener->create( ReporterConfig( config ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Totals runTests( std::shared_ptr<Config> const& config ) {
|
|
||||||
|
|
||||||
IStreamingReporterPtr reporter = makeReporter( config );
|
|
||||||
addListeners( reporter, config );
|
|
||||||
|
|
||||||
RunContext context( config, std::move( reporter ) );
|
|
||||||
|
|
||||||
Totals totals;
|
|
||||||
|
|
||||||
context.testGroupStarting( config->name(), 1, 1 );
|
|
||||||
|
|
||||||
TestSpec testSpec = config->testSpec();
|
|
||||||
if( !testSpec.hasFilters() )
|
|
||||||
testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "~[.]" ).testSpec(); // All not hidden tests
|
|
||||||
|
|
||||||
std::vector<TestCase> const& allTestCases = getAllTestCasesSorted( *config );
|
|
||||||
for( auto const& testCase : allTestCases ) {
|
|
||||||
if( !context.aborting() && matchTest( testCase, testSpec, *config ) )
|
|
||||||
totals += context.runTest( testCase );
|
|
||||||
else
|
|
||||||
context.reporter().skipTest( testCase );
|
|
||||||
}
|
|
||||||
|
|
||||||
context.testGroupEnded( config->name(), totals, 1, 1 );
|
|
||||||
return totals;
|
|
||||||
}
|
|
||||||
|
|
||||||
void applyFilenamesAsTags( IConfig const& config ) {
|
|
||||||
auto& tests = const_cast<std::vector<TestCase>&>( getAllTestCasesSorted( config ) );
|
|
||||||
for( auto& testCase : tests ) {
|
|
||||||
auto tags = testCase.tags;
|
|
||||||
|
|
||||||
std::string filename = testCase.lineInfo.file;
|
|
||||||
std::string::size_type lastSlash = filename.find_last_of( "\\/" );
|
|
||||||
if( lastSlash != std::string::npos )
|
|
||||||
filename = filename.substr( lastSlash+1 );
|
|
||||||
|
|
||||||
std::string::size_type lastDot = filename.find_last_of( '.' );
|
|
||||||
if( lastDot != std::string::npos )
|
|
||||||
filename = filename.substr( 0, lastDot );
|
|
||||||
|
|
||||||
tags.push_back( '#' + filename );
|
|
||||||
setTags( testCase, tags );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class Session : NonCopyable {
|
|
||||||
static const int MaxExitCode;
|
|
||||||
public:
|
|
||||||
|
|
||||||
Session() {
|
|
||||||
static bool alreadyInstantiated = false;
|
|
||||||
if( alreadyInstantiated )
|
|
||||||
CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" );
|
|
||||||
alreadyInstantiated = true;
|
|
||||||
m_cli = makeCommandLineParser( m_configData );
|
|
||||||
}
|
|
||||||
~Session() override {
|
|
||||||
Catch::cleanUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
void showHelp() const {
|
|
||||||
Catch::cout()
|
|
||||||
<< "\nCatch v" << libraryVersion() << "\n"
|
|
||||||
<< m_cli << std::endl
|
|
||||||
<< "For more detailed usage please see the project docs\n" << std::endl;
|
|
||||||
}
|
|
||||||
void libIdentify() {
|
|
||||||
Catch::cout()
|
|
||||||
<< std::left << std::setw(16) << "description: " << "A Catch test executable\n"
|
|
||||||
<< std::left << std::setw(16) << "category: " << "testframework\n"
|
|
||||||
<< std::left << std::setw(16) << "framework: " << "Catch Test\n"
|
|
||||||
<< std::left << std::setw(16) << "version: " << libraryVersion() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int applyCommandLine( int argc, char* argv[] ) {
|
|
||||||
auto result = m_cli.parse( clara::Args( argc, argv ) );
|
|
||||||
if( !result ) {
|
|
||||||
Catch::cerr()
|
|
||||||
<< Colour( Colour::Red )
|
|
||||||
<< "\nError(s) in input:\n"
|
|
||||||
<< Column( result.errorMessage() ).indent( 2 )
|
|
||||||
<< "\n\n";
|
|
||||||
Catch::cerr() << "Run with -? for usage\n" << std::endl;
|
|
||||||
return MaxExitCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_configData.showHelp )
|
|
||||||
showHelp();
|
|
||||||
if( m_configData.libIdentify )
|
|
||||||
libIdentify();
|
|
||||||
m_config.reset();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void useConfigData( ConfigData const& configData ) {
|
|
||||||
m_configData = configData;
|
|
||||||
m_config.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
int run( int argc, char* argv[] ) {
|
|
||||||
const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions();
|
|
||||||
if ( !exceptions.empty() ) {
|
|
||||||
Catch::cerr() << "Errors occured during startup!" << '\n';
|
|
||||||
// iterate over all exceptions and notify user
|
|
||||||
for ( const auto& ex_ptr : exceptions ) {
|
|
||||||
try {
|
|
||||||
std::rethrow_exception(ex_ptr);
|
|
||||||
} catch ( std::exception const& ex ) {
|
|
||||||
Catch::cerr() << ex.what() << '\n';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
int returnCode = applyCommandLine( argc, argv );
|
|
||||||
if( returnCode == 0 )
|
|
||||||
returnCode = run();
|
|
||||||
return returnCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(WIN32) && defined(UNICODE)
|
|
||||||
int run( int argc, wchar_t* const argv[] ) {
|
|
||||||
|
|
||||||
char **utf8Argv = new char *[ argc ];
|
|
||||||
|
|
||||||
for ( int i = 0; i < argc; ++i ) {
|
|
||||||
int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL );
|
|
||||||
|
|
||||||
utf8Argv[ i ] = new char[ bufSize ];
|
|
||||||
|
|
||||||
WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
int returnCode = run( argc, utf8Argv );
|
|
||||||
|
|
||||||
for ( int i = 0; i < argc; ++i )
|
|
||||||
delete [] utf8Argv[ i ];
|
|
||||||
|
|
||||||
delete [] utf8Argv;
|
|
||||||
|
|
||||||
return returnCode;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
int run() {
|
|
||||||
if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {
|
|
||||||
Catch::cout() << "...waiting for enter/ return before starting" << std::endl;
|
|
||||||
static_cast<void>(std::getchar());
|
|
||||||
}
|
|
||||||
int exitCode = runInternal();
|
|
||||||
if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {
|
|
||||||
Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl;
|
|
||||||
static_cast<void>(std::getchar());
|
|
||||||
}
|
|
||||||
return exitCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
clara::Parser const& cli() const {
|
|
||||||
return m_cli;
|
|
||||||
}
|
|
||||||
void cli( clara::Parser const& newParser ) {
|
|
||||||
m_cli = newParser;
|
|
||||||
}
|
|
||||||
ConfigData& configData() {
|
|
||||||
return m_configData;
|
|
||||||
}
|
|
||||||
Config& config() {
|
|
||||||
if( !m_config )
|
|
||||||
m_config = std::make_shared<Config>( m_configData );
|
|
||||||
return *m_config;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
int runInternal() {
|
|
||||||
if( m_configData.showHelp || m_configData.libIdentify )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
config(); // Force config to be constructed
|
|
||||||
|
|
||||||
seedRng( *m_config );
|
|
||||||
|
|
||||||
if( m_configData.filenamesAsTags )
|
|
||||||
applyFilenamesAsTags( *m_config );
|
|
||||||
|
|
||||||
// Handle list request
|
|
||||||
if( Option<std::size_t> listed = list( config() ) )
|
|
||||||
return static_cast<int>( *listed );
|
|
||||||
|
|
||||||
return (std::min)( MaxExitCode, static_cast<int>( runTests( m_config ).assertions.failed ) );
|
|
||||||
}
|
|
||||||
catch( std::exception& ex ) {
|
|
||||||
Catch::cerr() << ex.what() << std::endl;
|
|
||||||
return MaxExitCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
clara::Parser m_cli;
|
|
||||||
ConfigData m_configData;
|
|
||||||
std::shared_ptr<Config> m_config;
|
|
||||||
};
|
|
||||||
|
|
||||||
const int Session::MaxExitCode = 255;
|
|
||||||
|
|
||||||
} // end namespace Catch
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
|
2
include/external/clara.hpp
vendored
2
include/external/clara.hpp
vendored
@@ -135,7 +135,7 @@ namespace Catch { namespace clara { namespace TextFlow {
|
|||||||
|
|
||||||
auto operator *() const -> std::string {
|
auto operator *() const -> std::string {
|
||||||
assert( m_stringIndex < m_column.m_strings.size() );
|
assert( m_stringIndex < m_column.m_strings.size() );
|
||||||
assert( m_pos < m_end );
|
assert( m_pos <= m_end );
|
||||||
if( m_pos + m_column.m_width < m_end )
|
if( m_pos + m_column.m_width < m_end )
|
||||||
return addIndentAndSuffix(line().substr(m_pos, m_len));
|
return addIndentAndSuffix(line().substr(m_pos, m_len));
|
||||||
else
|
else
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_approx.hpp"
|
#include "catch_approx.h"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
@@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):
|
AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):
|
||||||
resultType(_resultType),
|
lazyExpression(_lazyExpression),
|
||||||
lazyExpression(_lazyExpression) {}
|
resultType(_resultType) {}
|
||||||
|
|
||||||
std::string AssertionResultData::reconstructExpression() const {
|
std::string AssertionResultData::reconstructExpression() const {
|
||||||
|
|
||||||
|
@@ -23,13 +23,12 @@ namespace Catch {
|
|||||||
|
|
||||||
AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );
|
AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );
|
||||||
|
|
||||||
ResultWas::OfType resultType = ResultWas::Unknown;
|
|
||||||
std::string message;
|
std::string message;
|
||||||
|
mutable std::string reconstructedExpression;
|
||||||
LazyExpression lazyExpression;
|
LazyExpression lazyExpression;
|
||||||
|
ResultWas::OfType resultType;
|
||||||
|
|
||||||
std::string reconstructExpression() const;
|
std::string reconstructExpression() const;
|
||||||
mutable std::string reconstructedExpression;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AssertionResult {
|
class AssertionResult {
|
||||||
|
@@ -19,8 +19,8 @@ namespace Catch {
|
|||||||
class BenchmarkLooper {
|
class BenchmarkLooper {
|
||||||
|
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
size_t m_count = 0;
|
std::size_t m_count = 0;
|
||||||
size_t m_iterationsToRun = 1;
|
std::size_t m_iterationsToRun = 1;
|
||||||
uint64_t m_resolution;
|
uint64_t m_resolution;
|
||||||
Timer m_timer;
|
Timer m_timer;
|
||||||
|
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#include "catch_assertionhandler.h"
|
#include "catch_assertionhandler.h"
|
||||||
#include "catch_message.h"
|
#include "catch_message.h"
|
||||||
#include "catch_interfaces_capture.h"
|
#include "catch_interfaces_capture.h"
|
||||||
|
#include "catch_debugger.h"
|
||||||
|
|
||||||
#if !defined(CATCH_CONFIG_DISABLE)
|
#if !defined(CATCH_CONFIG_DISABLE)
|
||||||
|
|
||||||
@@ -38,8 +39,6 @@
|
|||||||
|
|
||||||
#else // CATCH_CONFIG_FAST_COMPILE
|
#else // CATCH_CONFIG_FAST_COMPILE
|
||||||
|
|
||||||
#include "catch_debugger.h"
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// In the event of a failure works out if the debugger needs to be invoked
|
// In the event of a failure works out if the debugger needs to be invoked
|
||||||
// and/or an exception thrown and takes appropriate action.
|
// and/or an exception thrown and takes appropriate action.
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#define TWOBLUECUBES_CATCH_CAPTURE_MATCHERS_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_CAPTURE_MATCHERS_HPP_INCLUDED
|
||||||
|
|
||||||
#include "catch_capture.hpp"
|
#include "catch_capture.hpp"
|
||||||
#include "catch_matchers.hpp"
|
#include "catch_matchers.h"
|
||||||
#include "catch_matchers_string.h"
|
#include "catch_matchers_string.h"
|
||||||
#include "catch_matchers_vector.h"
|
#include "catch_matchers_vector.h"
|
||||||
|
|
||||||
|
@@ -16,9 +16,18 @@
|
|||||||
#endif
|
#endif
|
||||||
#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1
|
#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wweak-vtables"
|
||||||
|
#pragma clang diagnostic ignored "-Wexit-time-destructors"
|
||||||
|
#pragma clang diagnostic ignored "-Wshadow"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../external/clara.hpp"
|
#include "../external/clara.hpp"
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
// Restore Clara's value for console width, if present
|
// Restore Clara's value for console width, if present
|
||||||
#ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH
|
#ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_commandline.hpp"
|
#include "catch_commandline.h"
|
||||||
|
|
||||||
#include "catch_string_manip.h"
|
#include "catch_string_manip.h"
|
||||||
|
|
||||||
|
@@ -29,14 +29,6 @@ namespace Catch {
|
|||||||
return line < other.line || ( line == other.line && (std::strcmp(file, other.file) < 0));
|
return line < other.line || ( line == other.line && (std::strcmp(file, other.file) < 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void seedRng( IConfig const& config ) {
|
|
||||||
if( config.rngSeed() != 0 )
|
|
||||||
std::srand( config.rngSeed() );
|
|
||||||
}
|
|
||||||
unsigned int rngSeed() {
|
|
||||||
return getCurrentContext().getConfig()->rngSeed();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
|
std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {
|
||||||
#ifndef __GNUG__
|
#ifndef __GNUG__
|
||||||
os << info.file << '(' << info.line << ')';
|
os << info.file << '(' << info.line << ')';
|
||||||
@@ -54,4 +46,7 @@ namespace Catch {
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NonCopyable::NonCopyable() = default;
|
||||||
|
NonCopyable::~NonCopyable() = default;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -18,17 +18,12 @@
|
|||||||
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
|
# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define INTERNAL_CATCH_STRINGIFY2( expr ) #expr
|
|
||||||
#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )
|
|
||||||
|
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct IConfig;
|
|
||||||
|
|
||||||
struct CaseSensitive { enum Choice {
|
struct CaseSensitive { enum Choice {
|
||||||
Yes,
|
Yes,
|
||||||
No
|
No
|
||||||
@@ -41,7 +36,7 @@ namespace Catch {
|
|||||||
NonCopyable& operator = ( NonCopyable && ) = delete;
|
NonCopyable& operator = ( NonCopyable && ) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NonCopyable() {}
|
NonCopyable();
|
||||||
virtual ~NonCopyable();
|
virtual ~NonCopyable();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -70,9 +65,6 @@ namespace Catch {
|
|||||||
bool alwaysTrue();
|
bool alwaysTrue();
|
||||||
bool alwaysFalse();
|
bool alwaysFalse();
|
||||||
|
|
||||||
void seedRng( IConfig const& config );
|
|
||||||
unsigned int rngSeed();
|
|
||||||
|
|
||||||
// Use this in variadic streaming macros to allow
|
// Use this in variadic streaming macros to allow
|
||||||
// >> +StreamEndStop
|
// >> +StreamEndStop
|
||||||
// as well as
|
// as well as
|
||||||
|
@@ -35,11 +35,11 @@
|
|||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
|
|
||||||
|
# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||||
# define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
|
||||||
_Pragma( "clang diagnostic push" ) \
|
_Pragma( "clang diagnostic push" ) \
|
||||||
_Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" )
|
_Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \
|
||||||
# define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
|
_Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"")
|
||||||
|
# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
|
||||||
_Pragma( "clang diagnostic pop" )
|
_Pragma( "clang diagnostic pop" )
|
||||||
|
|
||||||
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
|
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
|
||||||
@@ -80,7 +80,13 @@
|
|||||||
// Visual C++
|
// Visual C++
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
|
// Universal Windows platform does not support SEH
|
||||||
|
// Or console colours (or console at all...)
|
||||||
|
# if (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||||
|
# define CATCH_CONFIG_COLOUR_NONE
|
||||||
|
# else
|
||||||
# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
|
# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
|
||||||
|
# endif
|
||||||
|
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
@@ -111,9 +117,9 @@
|
|||||||
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
|
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
|
||||||
# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
|
# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
#if !defined(CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS)
|
#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS)
|
||||||
# define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS
|
# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
|
||||||
# define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8,9 +8,12 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|
||||||
|
|
||||||
#include "catch_test_spec_parser.hpp"
|
#include "catch_test_spec_parser.h"
|
||||||
#include "catch_interfaces_config.h"
|
#include "catch_interfaces_config.h"
|
||||||
|
|
||||||
|
// Libstdc++ doesn't like incomplete classes for unique_ptr
|
||||||
|
#include "catch_stream.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -59,7 +62,6 @@ namespace Catch {
|
|||||||
|
|
||||||
|
|
||||||
class Config : public IConfig {
|
class Config : public IConfig {
|
||||||
virtual void dummy();
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Config() = default;
|
Config() = default;
|
||||||
|
@@ -6,13 +6,21 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_console_colour.hpp"
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wexit-time-destructors"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "catch_console_colour.h"
|
||||||
#include "catch_enforce.h"
|
#include "catch_enforce.h"
|
||||||
#include "catch_errno_guard.h"
|
#include "catch_errno_guard.h"
|
||||||
#include "catch_interfaces_config.h"
|
#include "catch_interfaces_config.h"
|
||||||
#include "catch_stream.h"
|
#include "catch_stream.h"
|
||||||
#include "catch_context.h"
|
#include "catch_context.h"
|
||||||
#include "catch_platform.h"
|
#include "catch_platform.h"
|
||||||
|
#include "catch_debugger.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -149,6 +157,13 @@ namespace {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool useColourOnPlatform() {
|
||||||
|
return
|
||||||
|
#ifdef CATCH_PLATFORM_MAC
|
||||||
|
!isDebuggerActive() &&
|
||||||
|
#endif
|
||||||
|
isatty(STDOUT_FILENO);
|
||||||
|
}
|
||||||
IColourImpl* platformColourInstance() {
|
IColourImpl* platformColourInstance() {
|
||||||
ErrnoGuard guard;
|
ErrnoGuard guard;
|
||||||
IConfigPtr config = getCurrentContext().getConfig();
|
IConfigPtr config = getCurrentContext().getConfig();
|
||||||
@@ -156,7 +171,7 @@ namespace {
|
|||||||
? config->useColour()
|
? config->useColour()
|
||||||
: UseColour::Auto;
|
: UseColour::Auto;
|
||||||
if( colourMode == UseColour::Auto )
|
if( colourMode == UseColour::Auto )
|
||||||
colourMode = isatty(STDOUT_FILENO)
|
colourMode = useColourOnPlatform()
|
||||||
? UseColour::Yes
|
? UseColour::Yes
|
||||||
: UseColour::No;
|
: UseColour::No;
|
||||||
return colourMode == UseColour::Yes
|
return colourMode == UseColour::Yes
|
||||||
@@ -202,3 +217,8 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@@ -24,6 +24,8 @@ namespace Catch {
|
|||||||
return m_config;
|
return m_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual ~Context() override;
|
||||||
|
|
||||||
public: // IMutableContext
|
public: // IMutableContext
|
||||||
virtual void setResultCapture( IResultCapture* resultCapture ) override {
|
virtual void setResultCapture( IResultCapture* resultCapture ) override {
|
||||||
m_resultCapture = resultCapture;
|
m_resultCapture = resultCapture;
|
||||||
@@ -59,4 +61,7 @@ namespace Catch {
|
|||||||
delete currentContext;
|
delete currentContext;
|
||||||
currentContext = nullptr;
|
currentContext = nullptr;
|
||||||
}
|
}
|
||||||
|
IContext::~IContext() = default;
|
||||||
|
IMutableContext::~IMutableContext() = default;
|
||||||
|
Context::~Context() = default;
|
||||||
}
|
}
|
||||||
|
@@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
class TestCase;
|
|
||||||
class Stream;
|
|
||||||
struct IResultCapture;
|
struct IResultCapture;
|
||||||
struct IRunner;
|
struct IRunner;
|
||||||
struct IConfig;
|
struct IConfig;
|
||||||
@@ -22,7 +20,7 @@ namespace Catch {
|
|||||||
|
|
||||||
struct IContext
|
struct IContext
|
||||||
{
|
{
|
||||||
virtual ~IContext() = default;
|
virtual ~IContext();
|
||||||
|
|
||||||
virtual IResultCapture* getResultCapture() = 0;
|
virtual IResultCapture* getResultCapture() = 0;
|
||||||
virtual IRunner* getRunner() = 0;
|
virtual IRunner* getRunner() = 0;
|
||||||
@@ -31,7 +29,7 @@ namespace Catch {
|
|||||||
|
|
||||||
struct IMutableContext : IContext
|
struct IMutableContext : IContext
|
||||||
{
|
{
|
||||||
virtual ~IMutableContext() = default;
|
virtual ~IMutableContext();
|
||||||
virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
|
virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
|
||||||
virtual void setRunner( IRunner* runner ) = 0;
|
virtual void setRunner( IRunner* runner ) = 0;
|
||||||
virtual void setConfig( IConfigPtr const& config ) = 0;
|
virtual void setConfig( IConfigPtr const& config ) = 0;
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
int mib[4];
|
int mib[4];
|
||||||
struct kinfo_proc info;
|
struct kinfo_proc info;
|
||||||
size_t size;
|
std::size_t size;
|
||||||
|
|
||||||
// Initialize the flags so that, if sysctl fails for some bizarre
|
// Initialize the flags so that, if sysctl fails for some bizarre
|
||||||
// reason, we get a predictable result.
|
// reason, we get a predictable result.
|
||||||
|
@@ -11,7 +11,9 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, std::string const& op, std::string const& rhs ) {
|
ITransientExpression::~ITransientExpression() = default;
|
||||||
|
|
||||||
|
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
|
||||||
if( lhs.size() + rhs.size() < 40 &&
|
if( lhs.size() + rhs.size() < 40 &&
|
||||||
lhs.find('\n') == std::string::npos &&
|
lhs.find('\n') == std::string::npos &&
|
||||||
rhs.find('\n') == std::string::npos )
|
rhs.find('\n') == std::string::npos )
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
|
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
|
||||||
#pragma warning(disable:4018) // more "signed/unsigned mismatch"
|
#pragma warning(disable:4018) // more "signed/unsigned mismatch"
|
||||||
#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)
|
#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)
|
||||||
|
#pragma warning(disable:4180) // qualifier applied to function type has no meaning
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
@@ -29,16 +30,16 @@ namespace Catch {
|
|||||||
|
|
||||||
// We don't actually need a virtual destructore, but many static analysers
|
// We don't actually need a virtual destructore, but many static analysers
|
||||||
// complain if it's not here :-(
|
// complain if it's not here :-(
|
||||||
virtual ~ITransientExpression() = default;
|
virtual ~ITransientExpression();
|
||||||
};
|
};
|
||||||
|
|
||||||
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, std::string const& op, std::string const& rhs );
|
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );
|
||||||
|
|
||||||
template<typename LhsT, typename RhsT>
|
template<typename LhsT, typename RhsT>
|
||||||
class BinaryExpr : public ITransientExpression {
|
class BinaryExpr : public ITransientExpression {
|
||||||
bool m_result;
|
bool m_result;
|
||||||
LhsT m_lhs;
|
LhsT m_lhs;
|
||||||
std::string m_op;
|
StringRef m_op;
|
||||||
RhsT m_rhs;
|
RhsT m_rhs;
|
||||||
|
|
||||||
auto isBinaryExpression() const -> bool override { return true; }
|
auto isBinaryExpression() const -> bool override { return true; }
|
||||||
@@ -50,8 +51,8 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BinaryExpr( bool comparisionResult, LhsT lhs, StringRef op, RhsT rhs )
|
BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs )
|
||||||
: m_result( comparisionResult ),
|
: m_result( comparisonResult ),
|
||||||
m_lhs( lhs ),
|
m_lhs( lhs ),
|
||||||
m_op( op ),
|
m_op( op ),
|
||||||
m_rhs( rhs )
|
m_rhs( rhs )
|
||||||
@@ -76,26 +77,26 @@ namespace Catch {
|
|||||||
|
|
||||||
// Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
|
// Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
|
||||||
template<typename LhsT, typename RhsT>
|
template<typename LhsT, typename RhsT>
|
||||||
auto compareEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) == rhs; };
|
auto compareEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return lhs == rhs; };
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); };
|
auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); };
|
auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; };
|
auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; };
|
auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }
|
||||||
|
|
||||||
template<typename LhsT, typename RhsT>
|
template<typename LhsT, typename RhsT>
|
||||||
auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) != rhs; };
|
auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return lhs != rhs; };
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); };
|
auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); };
|
auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; };
|
auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; };
|
auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }
|
||||||
|
|
||||||
|
|
||||||
template<typename LhsT>
|
template<typename LhsT>
|
||||||
@@ -150,10 +151,6 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct Decomposer {
|
struct Decomposer {
|
||||||
template<typename T>
|
|
||||||
auto operator <= ( T& lhs ) -> ExprLhs<T&> {
|
|
||||||
return ExprLhs<T&>( lhs );
|
|
||||||
}
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
auto operator <= ( T const& lhs ) -> ExprLhs<T const&> {
|
auto operator <= ( T const& lhs ) -> ExprLhs<T const&> {
|
||||||
return ExprLhs<T const&>( lhs );
|
return ExprLhs<T const&>( lhs );
|
||||||
@@ -165,8 +162,4 @@ namespace Catch {
|
|||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_DECOMPOSER_H_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_DECOMPOSER_H_INCLUDED
|
||||||
|
@@ -8,6 +8,8 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include "catch_session.h"
|
||||||
|
|
||||||
#ifndef __OBJC__
|
#ifndef __OBJC__
|
||||||
|
|
||||||
#if defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
|
#if defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
|
||||||
@@ -30,7 +32,7 @@ int main (int argc, char * const argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Catch::registerTestMethods();
|
Catch::registerTestMethods();
|
||||||
int result = Catch::Session().run( argc, (char* const*)argv );
|
int result = Catch::Session().run( argc, (char**)argv );
|
||||||
|
|
||||||
#if !CATCH_ARC_ENABLED
|
#if !CATCH_ARC_ENABLED
|
||||||
[pool drain];
|
[pool drain];
|
||||||
|
@@ -30,7 +30,7 @@ namespace Catch {
|
|||||||
return tryTranslators();
|
return tryTranslators();
|
||||||
}
|
}
|
||||||
@catch (NSException *exception) {
|
@catch (NSException *exception) {
|
||||||
return Catch::toString( [exception description] );
|
return Catch::Detail::stringify( [exception description] );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
return tryTranslators();
|
return tryTranslators();
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#define TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED
|
||||||
|
|
||||||
#include "../reporters/catch_reporter_bases.hpp"
|
#include "../reporters/catch_reporter_bases.hpp"
|
||||||
|
#include "catch_console_colour.h"
|
||||||
#include "catch_reporter_registrars.hpp"
|
#include "catch_reporter_registrars.hpp"
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H_INCLUDED
|
||||||
|
@@ -12,16 +12,12 @@
|
|||||||
#include "catch_context.h"
|
#include "catch_context.h"
|
||||||
#include "catch_interfaces_capture.h"
|
#include "catch_interfaces_capture.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace {
|
||||||
|
|
||||||
// Report the error condition
|
// Report the error condition
|
||||||
void reportFatal( std::string const& message ) {
|
void reportFatal( char const * const message ) {
|
||||||
IContext& context = Catch::getCurrentContext();
|
Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );
|
||||||
IResultCapture* resultCapture = context.getResultCapture();
|
}
|
||||||
resultCapture->handleFatalErrorCondition( message );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Catch
|
|
||||||
|
|
||||||
#if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////
|
#if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////
|
||||||
|
|
||||||
@@ -39,7 +35,7 @@ namespace Catch {
|
|||||||
// There is no 1-1 mapping between signals and windows exceptions.
|
// There is no 1-1 mapping between signals and windows exceptions.
|
||||||
// Windows can easily distinguish between SO and SigSegV,
|
// Windows can easily distinguish between SO and SigSegV,
|
||||||
// but SigInt, SigTerm, etc are handled differently.
|
// but SigInt, SigTerm, etc are handled differently.
|
||||||
SignalDefs signalDefs[] = {
|
static SignalDefs signalDefs[] = {
|
||||||
{ EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" },
|
{ EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" },
|
||||||
{ EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" },
|
{ EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" },
|
||||||
{ EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" },
|
{ EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" },
|
||||||
@@ -111,7 +107,7 @@ namespace Catch {
|
|||||||
int id;
|
int id;
|
||||||
const char* name;
|
const char* name;
|
||||||
};
|
};
|
||||||
SignalDefs signalDefs[] = {
|
static SignalDefs signalDefs[] = {
|
||||||
{ SIGINT, "SIGINT - Terminal interrupt signal" },
|
{ SIGINT, "SIGINT - Terminal interrupt signal" },
|
||||||
{ SIGILL, "SIGILL - Illegal instruction signal" },
|
{ SIGILL, "SIGILL - Illegal instruction signal" },
|
||||||
{ SIGFPE, "SIGFPE - Floating point error signal" },
|
{ SIGFPE, "SIGFPE - Floating point error signal" },
|
||||||
@@ -122,7 +118,7 @@ namespace Catch {
|
|||||||
|
|
||||||
|
|
||||||
void FatalConditionHandler::handleSignal( int sig ) {
|
void FatalConditionHandler::handleSignal( int sig ) {
|
||||||
std::string name = "<unknown signal>";
|
char const * name = "<unknown signal>";
|
||||||
for (auto const& def : signalDefs) {
|
for (auto const& def : signalDefs) {
|
||||||
if (sig == def.id) {
|
if (sig == def.id) {
|
||||||
name = def.name;
|
name = def.name;
|
||||||
|
@@ -13,12 +13,6 @@
|
|||||||
#include "catch_platform.h"
|
#include "catch_platform.h"
|
||||||
#include "catch_compiler_capabilities.h"
|
#include "catch_compiler_capabilities.h"
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
// Report the error condition
|
|
||||||
void reportFatal( std::string const& message );
|
|
||||||
|
|
||||||
} // namespace Catch
|
|
||||||
|
|
||||||
#if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////
|
#if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////
|
||||||
#include "catch_windows_h_proxy.h"
|
#include "catch_windows_h_proxy.h"
|
||||||
|
@@ -8,55 +8,22 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED
|
||||||
|
|
||||||
// Collect all the implementation files together here
|
|
||||||
// These are the equivalent of what would usually be cpp files
|
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wweak-vtables"
|
#pragma clang diagnostic ignored "-Wweak-vtables"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Keep these here for external reporters
|
||||||
|
#include "catch_test_spec.h"
|
||||||
|
#include "catch_test_case_tracker.h"
|
||||||
|
|
||||||
#include "internal/catch_notimplemented_exception.h"
|
#include "catch_leak_detector.h"
|
||||||
|
|
||||||
|
|
||||||
// Temporary hack to fix separately provided reporters
|
|
||||||
#include "../reporters/catch_reporter_bases.hpp"
|
|
||||||
#include "catch_reporter_registrars.hpp"
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "internal/catch_leak_detector.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include "../catch_session.hpp"
|
|
||||||
#include "catch_test_spec.hpp"
|
|
||||||
#include "catch_test_case_tracker.hpp"
|
|
||||||
|
|
||||||
// Cpp files will be included in the single-header file here
|
// Cpp files will be included in the single-header file here
|
||||||
// ~*~* CATCH_CPP_STITCH_PLACE *~*~
|
// ~*~* CATCH_CPP_STITCH_PLACE *~*~
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
LeakDetector leakDetector;
|
LeakDetector leakDetector;
|
||||||
|
|
||||||
// These are all here to avoid warnings about not having any out of line
|
|
||||||
// virtual methods
|
|
||||||
NonCopyable::~NonCopyable() {}
|
|
||||||
IStream::~IStream() noexcept {}
|
|
||||||
FileStream::~FileStream() noexcept {}
|
|
||||||
CoutStream::~CoutStream() noexcept {}
|
|
||||||
DebugOutStream::~DebugOutStream() noexcept {}
|
|
||||||
StreamBufBase::~StreamBufBase() noexcept {}
|
|
||||||
IResultCapture::~IResultCapture() {}
|
|
||||||
ITestInvoker::~ITestInvoker() {}
|
|
||||||
ITestCaseRegistry::~ITestCaseRegistry() {}
|
|
||||||
IRegistryHub::~IRegistryHub() {}
|
|
||||||
IMutableRegistryHub::~IMutableRegistryHub() {}
|
|
||||||
IExceptionTranslator::~IExceptionTranslator() {}
|
|
||||||
IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() {}
|
|
||||||
IRunner::~IRunner() {}
|
|
||||||
IConfig::~IConfig() {}
|
|
||||||
|
|
||||||
void Config::dummy() {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
|
5
include/internal/catch_interfaces_capture.cpp
Normal file
5
include/internal/catch_interfaces_capture.cpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#include "catch_interfaces_capture.h"
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
IResultCapture::~IResultCapture() = default;
|
||||||
|
}
|
@@ -10,15 +10,15 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "catch_stringref.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
class TestCase;
|
|
||||||
class AssertionResult;
|
class AssertionResult;
|
||||||
struct AssertionInfo;
|
struct AssertionInfo;
|
||||||
struct SectionInfo;
|
struct SectionInfo;
|
||||||
struct SectionEndInfo;
|
struct SectionEndInfo;
|
||||||
struct MessageInfo;
|
struct MessageInfo;
|
||||||
class ScopedMessageBuilder;
|
|
||||||
struct Counts;
|
struct Counts;
|
||||||
struct BenchmarkInfo;
|
struct BenchmarkInfo;
|
||||||
struct BenchmarkStats;
|
struct BenchmarkStats;
|
||||||
@@ -45,7 +45,7 @@ namespace Catch {
|
|||||||
|
|
||||||
virtual void exceptionEarlyReported() = 0;
|
virtual void exceptionEarlyReported() = 0;
|
||||||
|
|
||||||
virtual void handleFatalErrorCondition( std::string const& message ) = 0;
|
virtual void handleFatalErrorCondition( StringRef message ) = 0;
|
||||||
|
|
||||||
virtual bool lastAssertionPassed() = 0;
|
virtual bool lastAssertionPassed() = 0;
|
||||||
virtual void assertionPassed() = 0;
|
virtual void assertionPassed() = 0;
|
||||||
|
5
include/internal/catch_interfaces_config.cpp
Normal file
5
include/internal/catch_interfaces_config.cpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#include "internal/catch_interfaces_config.h"
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
IConfig::~IConfig() = default;
|
||||||
|
}
|
6
include/internal/catch_interfaces_exception.cpp
Normal file
6
include/internal/catch_interfaces_exception.cpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "internal/catch_interfaces_exception.h"
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
IExceptionTranslator::~IExceptionTranslator() = default;
|
||||||
|
IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;
|
||||||
|
}
|
6
include/internal/catch_interfaces_registry_hub.cpp
Normal file
6
include/internal/catch_interfaces_registry_hub.cpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "internal/catch_interfaces_registry_hub.h"
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
IRegistryHub::~IRegistryHub() = default;
|
||||||
|
IMutableRegistryHub::~IMutableRegistryHub() = default;
|
||||||
|
}
|
@@ -50,6 +50,8 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AssertionStats::~AssertionStats() = default;
|
||||||
|
|
||||||
SectionStats::SectionStats( SectionInfo const& _sectionInfo,
|
SectionStats::SectionStats( SectionInfo const& _sectionInfo,
|
||||||
Counts const& _assertions,
|
Counts const& _assertions,
|
||||||
double _durationInSeconds,
|
double _durationInSeconds,
|
||||||
@@ -60,6 +62,8 @@ namespace Catch {
|
|||||||
missingAssertions( _missingAssertions )
|
missingAssertions( _missingAssertions )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
SectionStats::~SectionStats() = default;
|
||||||
|
|
||||||
|
|
||||||
TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo,
|
TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo,
|
||||||
Totals const& _totals,
|
Totals const& _totals,
|
||||||
@@ -73,6 +77,8 @@ namespace Catch {
|
|||||||
aborting( _aborting )
|
aborting( _aborting )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
TestCaseStats::~TestCaseStats() = default;
|
||||||
|
|
||||||
|
|
||||||
TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo,
|
TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo,
|
||||||
Totals const& _totals,
|
Totals const& _totals,
|
||||||
@@ -87,6 +93,8 @@ namespace Catch {
|
|||||||
aborting( false )
|
aborting( false )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
TestGroupStats::~TestGroupStats() = default;
|
||||||
|
|
||||||
TestRunStats::TestRunStats( TestRunInfo const& _runInfo,
|
TestRunStats::TestRunStats( TestRunInfo const& _runInfo,
|
||||||
Totals const& _totals,
|
Totals const& _totals,
|
||||||
bool _aborting )
|
bool _aborting )
|
||||||
@@ -95,9 +103,14 @@ namespace Catch {
|
|||||||
aborting( _aborting )
|
aborting( _aborting )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
TestRunStats::~TestRunStats() = default;
|
||||||
|
|
||||||
|
void IStreamingReporter::fatalErrorEncountered( StringRef ) {}
|
||||||
bool IStreamingReporter::isMulti() const { return false; }
|
bool IStreamingReporter::isMulti() const { return false; }
|
||||||
|
|
||||||
|
IReporterFactory::~IReporterFactory() = default;
|
||||||
|
IReporterRegistry::~IReporterRegistry() = default;
|
||||||
|
|
||||||
void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter ) {
|
void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter ) {
|
||||||
|
|
||||||
if( !existingReporter ) {
|
if( !existingReporter ) {
|
||||||
|
@@ -11,11 +11,12 @@
|
|||||||
#include "catch_section_info.h"
|
#include "catch_section_info.h"
|
||||||
#include "catch_common.h"
|
#include "catch_common.h"
|
||||||
#include "catch_config.hpp"
|
#include "catch_config.hpp"
|
||||||
#include "catch_totals.hpp"
|
#include "catch_totals.h"
|
||||||
#include "catch_test_case_info.h"
|
#include "catch_test_case_info.h"
|
||||||
#include "catch_assertionresult.h"
|
#include "catch_assertionresult.h"
|
||||||
#include "catch_message.h"
|
#include "catch_message.h"
|
||||||
#include "catch_option.hpp"
|
#include "catch_option.hpp"
|
||||||
|
#include "catch_stringref.h"
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -80,7 +81,7 @@ namespace Catch {
|
|||||||
AssertionStats( AssertionStats && ) = default;
|
AssertionStats( AssertionStats && ) = default;
|
||||||
AssertionStats& operator = ( AssertionStats const& ) = default;
|
AssertionStats& operator = ( AssertionStats const& ) = default;
|
||||||
AssertionStats& operator = ( AssertionStats && ) = default;
|
AssertionStats& operator = ( AssertionStats && ) = default;
|
||||||
virtual ~AssertionStats() = default;
|
virtual ~AssertionStats();
|
||||||
|
|
||||||
AssertionResult assertionResult;
|
AssertionResult assertionResult;
|
||||||
std::vector<MessageInfo> infoMessages;
|
std::vector<MessageInfo> infoMessages;
|
||||||
@@ -96,7 +97,7 @@ namespace Catch {
|
|||||||
SectionStats( SectionStats && ) = default;
|
SectionStats( SectionStats && ) = default;
|
||||||
SectionStats& operator = ( SectionStats const& ) = default;
|
SectionStats& operator = ( SectionStats const& ) = default;
|
||||||
SectionStats& operator = ( SectionStats && ) = default;
|
SectionStats& operator = ( SectionStats && ) = default;
|
||||||
virtual ~SectionStats() = default;
|
virtual ~SectionStats();
|
||||||
|
|
||||||
SectionInfo sectionInfo;
|
SectionInfo sectionInfo;
|
||||||
Counts assertions;
|
Counts assertions;
|
||||||
@@ -115,7 +116,7 @@ namespace Catch {
|
|||||||
TestCaseStats( TestCaseStats && ) = default;
|
TestCaseStats( TestCaseStats && ) = default;
|
||||||
TestCaseStats& operator = ( TestCaseStats const& ) = default;
|
TestCaseStats& operator = ( TestCaseStats const& ) = default;
|
||||||
TestCaseStats& operator = ( TestCaseStats && ) = default;
|
TestCaseStats& operator = ( TestCaseStats && ) = default;
|
||||||
virtual ~TestCaseStats() = default;
|
virtual ~TestCaseStats();
|
||||||
|
|
||||||
TestCaseInfo testInfo;
|
TestCaseInfo testInfo;
|
||||||
Totals totals;
|
Totals totals;
|
||||||
@@ -134,7 +135,7 @@ namespace Catch {
|
|||||||
TestGroupStats( TestGroupStats && ) = default;
|
TestGroupStats( TestGroupStats && ) = default;
|
||||||
TestGroupStats& operator = ( TestGroupStats const& ) = default;
|
TestGroupStats& operator = ( TestGroupStats const& ) = default;
|
||||||
TestGroupStats& operator = ( TestGroupStats && ) = default;
|
TestGroupStats& operator = ( TestGroupStats && ) = default;
|
||||||
virtual ~TestGroupStats() = default;
|
virtual ~TestGroupStats();
|
||||||
|
|
||||||
GroupInfo groupInfo;
|
GroupInfo groupInfo;
|
||||||
Totals totals;
|
Totals totals;
|
||||||
@@ -150,7 +151,7 @@ namespace Catch {
|
|||||||
TestRunStats( TestRunStats && ) = default;
|
TestRunStats( TestRunStats && ) = default;
|
||||||
TestRunStats& operator = ( TestRunStats const& ) = default;
|
TestRunStats& operator = ( TestRunStats const& ) = default;
|
||||||
TestRunStats& operator = ( TestRunStats && ) = default;
|
TestRunStats& operator = ( TestRunStats && ) = default;
|
||||||
virtual ~TestRunStats() = default;
|
virtual ~TestRunStats();
|
||||||
|
|
||||||
TestRunInfo runInfo;
|
TestRunInfo runInfo;
|
||||||
Totals totals;
|
Totals totals;
|
||||||
@@ -162,10 +163,9 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
struct BenchmarkStats {
|
struct BenchmarkStats {
|
||||||
BenchmarkInfo info;
|
BenchmarkInfo info;
|
||||||
size_t iterations;
|
std::size_t iterations;
|
||||||
uint64_t elapsedTimeInNanoseconds;
|
uint64_t elapsedTimeInNanoseconds;
|
||||||
};
|
};
|
||||||
class MultipleReporters;
|
|
||||||
|
|
||||||
struct IStreamingReporter {
|
struct IStreamingReporter {
|
||||||
virtual ~IStreamingReporter() = default;
|
virtual ~IStreamingReporter() = default;
|
||||||
@@ -202,12 +202,15 @@ namespace Catch {
|
|||||||
|
|
||||||
virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
|
virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
|
||||||
|
|
||||||
|
// Default empty implementation provided
|
||||||
|
virtual void fatalErrorEncountered( StringRef name );
|
||||||
|
|
||||||
virtual bool isMulti() const;
|
virtual bool isMulti() const;
|
||||||
};
|
};
|
||||||
using IStreamingReporterPtr = std::unique_ptr<IStreamingReporter>;
|
using IStreamingReporterPtr = std::unique_ptr<IStreamingReporter>;
|
||||||
|
|
||||||
struct IReporterFactory {
|
struct IReporterFactory {
|
||||||
virtual ~IReporterFactory() = default;
|
virtual ~IReporterFactory();
|
||||||
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0;
|
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0;
|
||||||
virtual std::string getDescription() const = 0;
|
virtual std::string getDescription() const = 0;
|
||||||
};
|
};
|
||||||
@@ -217,7 +220,7 @@ namespace Catch {
|
|||||||
using FactoryMap = std::map<std::string, IReporterFactoryPtr>;
|
using FactoryMap = std::map<std::string, IReporterFactoryPtr>;
|
||||||
using Listeners = std::vector<IReporterFactoryPtr>;
|
using Listeners = std::vector<IReporterFactoryPtr>;
|
||||||
|
|
||||||
virtual ~IReporterRegistry() = default;
|
virtual ~IReporterRegistry();
|
||||||
virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0;
|
virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0;
|
||||||
virtual FactoryMap const& getFactories() const = 0;
|
virtual FactoryMap const& getFactories() const = 0;
|
||||||
virtual Listeners const& getListeners() const = 0;
|
virtual Listeners const& getListeners() const = 0;
|
||||||
|
5
include/internal/catch_interfaces_runner.cpp
Normal file
5
include/internal/catch_interfaces_runner.cpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#include "internal/catch_interfaces_runner.h"
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
IRunner::~IRunner() = default;
|
||||||
|
}
|
@@ -9,7 +9,6 @@
|
|||||||
#define TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_INTERFACES_RUNNER_H_INCLUDED
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
class TestCase;
|
|
||||||
|
|
||||||
struct IRunner {
|
struct IRunner {
|
||||||
virtual ~IRunner();
|
virtual ~IRunner();
|
||||||
|
6
include/internal/catch_interfaces_testcase.cpp
Normal file
6
include/internal/catch_interfaces_testcase.cpp
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include "internal/catch_interfaces_testcase.h"
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
ITestInvoker::~ITestInvoker() = default;
|
||||||
|
ITestCaseRegistry::~ITestCaseRegistry() = default;
|
||||||
|
}
|
@@ -15,8 +15,8 @@
|
|||||||
#include "catch_stream.h"
|
#include "catch_stream.h"
|
||||||
#include "catch_text.h"
|
#include "catch_text.h"
|
||||||
|
|
||||||
#include "catch_console_colour.hpp"
|
#include "catch_console_colour.h"
|
||||||
#include "catch_test_spec_parser.hpp"
|
#include "catch_test_spec_parser.h"
|
||||||
#include "catch_tostring.h"
|
#include "catch_tostring.h"
|
||||||
#include "catch_string_manip.h"
|
#include "catch_string_manip.h"
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_matchers.hpp"
|
#include "catch_matchers.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace Matchers {
|
namespace Matchers {
|
||||||
@@ -17,6 +17,8 @@ namespace Matchers {
|
|||||||
return m_cachedToString;
|
return m_cachedToString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MatcherUntypedBase::~MatcherUntypedBase() = default;
|
||||||
|
|
||||||
} // namespace Impl
|
} // namespace Impl
|
||||||
} // namespace Matchers
|
} // namespace Matchers
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ namespace Matchers {
|
|||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~MatcherUntypedBase() = default;
|
virtual ~MatcherUntypedBase();
|
||||||
virtual std::string describe() const = 0;
|
virtual std::string describe() const = 0;
|
||||||
mutable std::string m_cachedToString;
|
mutable std::string m_cachedToString;
|
||||||
};
|
};
|
||||||
@@ -148,31 +148,6 @@ namespace Matchers {
|
|||||||
|
|
||||||
} // namespace Impl
|
} // namespace Impl
|
||||||
|
|
||||||
|
|
||||||
// The following functions create the actual matcher objects.
|
|
||||||
// This allows the types to be inferred
|
|
||||||
// - deprecated: prefer ||, && and !
|
|
||||||
template<typename T>
|
|
||||||
Impl::MatchNotOf<T> Not( Impl::MatcherBase<T> const& underlyingMatcher ) {
|
|
||||||
return Impl::MatchNotOf<T>( underlyingMatcher );
|
|
||||||
}
|
|
||||||
template<typename T>
|
|
||||||
Impl::MatchAllOf<T> AllOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2 ) {
|
|
||||||
return Impl::MatchAllOf<T>() && m1 && m2;
|
|
||||||
}
|
|
||||||
template<typename T>
|
|
||||||
Impl::MatchAllOf<T> AllOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2, Impl::MatcherBase<T> const& m3 ) {
|
|
||||||
return Impl::MatchAllOf<T>() && m1 && m2 && m3;
|
|
||||||
}
|
|
||||||
template<typename T>
|
|
||||||
Impl::MatchAnyOf<T> AnyOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2 ) {
|
|
||||||
return Impl::MatchAnyOf<T>() || m1 || m2;
|
|
||||||
}
|
|
||||||
template<typename T>
|
|
||||||
Impl::MatchAnyOf<T> AnyOf( Impl::MatcherBase<T> const& m1, Impl::MatcherBase<T> const& m2, Impl::MatcherBase<T> const& m3 ) {
|
|
||||||
return Impl::MatchAnyOf<T>() || m1 || m2 || m3;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Matchers
|
} // namespace Matchers
|
||||||
|
|
||||||
using namespace Matchers;
|
using namespace Matchers;
|
@@ -8,7 +8,7 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_MATCHERS_STRING_H_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_MATCHERS_STRING_H_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_MATCHERS_STRING_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_MATCHERS_STRING_H_INCLUDED
|
||||||
|
|
||||||
#include "catch_matchers.hpp"
|
#include "catch_matchers.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_MATCHERS_VECTOR_H_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_MATCHERS_VECTOR_H_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_MATCHERS_VECTOR_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_MATCHERS_VECTOR_H_INCLUDED
|
||||||
|
|
||||||
#include "catch_matchers.hpp"
|
#include "catch_matchers.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace Matchers {
|
namespace Matchers {
|
||||||
@@ -78,7 +78,7 @@ namespace Matchers {
|
|||||||
// - then just call that directly
|
// - then just call that directly
|
||||||
if (m_comparator.size() != v.size())
|
if (m_comparator.size() != v.size())
|
||||||
return false;
|
return false;
|
||||||
for (size_t i = 0; i < v.size(); ++i)
|
for (std::size_t i = 0; i < v.size(); ++i)
|
||||||
if (m_comparator[i] != v[i])
|
if (m_comparator[i] != v[i])
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
@@ -21,9 +21,9 @@ namespace Catch {
|
|||||||
ResultWas::OfType _type );
|
ResultWas::OfType _type );
|
||||||
|
|
||||||
std::string macroName;
|
std::string macroName;
|
||||||
|
std::string message;
|
||||||
SourceLineInfo lineInfo;
|
SourceLineInfo lineInfo;
|
||||||
ResultWas::OfType type;
|
ResultWas::OfType type;
|
||||||
std::string message;
|
|
||||||
unsigned int sequence;
|
unsigned int sequence;
|
||||||
|
|
||||||
bool operator == ( MessageInfo const& other ) const;
|
bool operator == ( MessageInfo const& other ) const;
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 5/8/2012.
|
|
||||||
* Copyright 2012 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_notimplemented_exception.h"
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
NotImplementedException::NotImplementedException( SourceLineInfo const& lineInfo ) {
|
|
||||||
std::ostringstream oss;
|
|
||||||
oss << lineInfo << ": function ";
|
|
||||||
oss << "not implemented";
|
|
||||||
m_what = oss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* NotImplementedException::what() const noexcept {
|
|
||||||
return m_what.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace Catch
|
|
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 5/8/2012.
|
|
||||||
* Copyright 2012 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)
|
|
||||||
*/
|
|
||||||
#ifndef TWOBLUECUBES_CATCH_NOTIMPLEMENTED_EXCEPTION_H_INCLUDED
|
|
||||||
#define TWOBLUECUBES_CATCH_NOTIMPLEMENTED_EXCEPTION_H_INCLUDED
|
|
||||||
|
|
||||||
#include "catch_common.h"
|
|
||||||
|
|
||||||
#include <exception>
|
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
class NotImplementedException : public std::exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NotImplementedException( SourceLineInfo const& lineInfo );
|
|
||||||
|
|
||||||
virtual ~NotImplementedException() noexcept = default;
|
|
||||||
|
|
||||||
virtual const char* what() const noexcept override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string m_what;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end namespace Catch
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
#define CATCH_NOT_IMPLEMENTED throw Catch::NotImplementedException( CATCH_INTERNAL_LINEINFO )
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_NOTIMPLEMENTED_EXCEPTION_H_INCLUDED
|
|
@@ -18,6 +18,8 @@
|
|||||||
// in catch.hpp first to make sure they are included by the single
|
// in catch.hpp first to make sure they are included by the single
|
||||||
// header for non obj-usage
|
// header for non obj-usage
|
||||||
#include "catch_test_case_info.h"
|
#include "catch_test_case_info.h"
|
||||||
|
#include "catch_string_manip.h"
|
||||||
|
#include "catch_tostring.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// This protocol is really only here for (self) documenting purposes, since
|
// This protocol is really only here for (self) documenting purposes, since
|
||||||
@@ -70,8 +72,8 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t registerTestMethods() {
|
inline std::size_t registerTestMethods() {
|
||||||
size_t noTestMethods = 0;
|
std::size_t noTestMethods = 0;
|
||||||
int noClasses = objc_getClassList( nullptr, 0 );
|
int noClasses = objc_getClassList( nullptr, 0 );
|
||||||
|
|
||||||
Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
|
Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);
|
||||||
@@ -91,7 +93,7 @@ namespace Catch {
|
|||||||
std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
|
std::string desc = Detail::getAnnotation( cls, "Description", testCaseName );
|
||||||
const char* className = class_getName( cls );
|
const char* className = class_getName( cls );
|
||||||
|
|
||||||
getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo() ) );
|
getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo("",0) ) );
|
||||||
noTestMethods++;
|
noTestMethods++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,7 +120,7 @@ namespace Catch {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* m_substr;
|
NSString* CATCH_ARC_STRONG m_substr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Equals : StringHolder {
|
struct Equals : StringHolder {
|
||||||
@@ -130,7 +132,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string describe() const override {
|
std::string describe() const override {
|
||||||
return "equals string: " + Catch::toString( m_substr );
|
return "equals string: " + Catch::Detail::stringify( m_substr );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -143,7 +145,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string describe() const override {
|
std::string describe() const override {
|
||||||
return "contains string: " + Catch::toString( m_substr );
|
return "contains string: " + Catch::Detail::stringify( m_substr );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -156,7 +158,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string describe() const override {
|
std::string describe() const override {
|
||||||
return "starts with: " + Catch::toString( m_substr );
|
return "starts with: " + Catch::Detail::stringify( m_substr );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
struct EndsWith : StringHolder {
|
struct EndsWith : StringHolder {
|
||||||
@@ -168,7 +170,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string describe() const override {
|
std::string describe() const override {
|
||||||
return "ends with: " + Catch::toString( m_substr );
|
return "ends with: " + Catch::Detail::stringify( m_substr );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -196,15 +198,18 @@ namespace Catch {
|
|||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define OC_TEST_CASE( name, desc )\
|
#define OC_MAKE_UNIQUE_NAME( root, uniqueSuffix ) root##uniqueSuffix
|
||||||
+(NSString*) INTERNAL_CATCH_UNIQUE_NAME( Catch_Name_test ) \
|
#define OC_TEST_CASE2( name, desc, uniqueSuffix ) \
|
||||||
|
+(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Name_test_, uniqueSuffix ) \
|
||||||
{ \
|
{ \
|
||||||
return @ name; \
|
return @ name; \
|
||||||
} \
|
} \
|
||||||
+(NSString*) INTERNAL_CATCH_UNIQUE_NAME( Catch_Description_test ) \
|
+(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Description_test_, uniqueSuffix ) \
|
||||||
{ \
|
{ \
|
||||||
return @ desc; \
|
return @ desc; \
|
||||||
} \
|
} \
|
||||||
-(void) INTERNAL_CATCH_UNIQUE_NAME( Catch_TestCase_test )
|
-(void) OC_MAKE_UNIQUE_NAME( Catch_TestCase_test_, uniqueSuffix )
|
||||||
|
|
||||||
|
#define OC_TEST_CASE( name, desc ) OC_TEST_CASE2( name, desc, __LINE__ )
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_OBJC_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_OBJC_HPP_INCLUDED
|
||||||
|
31
include/internal/catch_random_number_generator.cpp
Normal file
31
include/internal/catch_random_number_generator.cpp
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Created by Martin on 30/08/2017.
|
||||||
|
*
|
||||||
|
* 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_random_number_generator.h"
|
||||||
|
#include "catch_context.h"
|
||||||
|
#include "catch_interfaces_config.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
|
||||||
|
void seedRng( IConfig const& config ) {
|
||||||
|
if( config.rngSeed() != 0 )
|
||||||
|
std::srand( config.rngSeed() );
|
||||||
|
}
|
||||||
|
unsigned int rngSeed() {
|
||||||
|
return getCurrentContext().getConfig()->rngSeed();
|
||||||
|
}
|
||||||
|
|
||||||
|
RandomNumberGenerator::result_type RandomNumberGenerator::operator()( result_type n ) const {
|
||||||
|
return std::rand() % n;
|
||||||
|
}
|
||||||
|
RandomNumberGenerator::result_type RandomNumberGenerator::operator()() const {
|
||||||
|
return std::rand() % max();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
40
include/internal/catch_random_number_generator.h
Normal file
40
include/internal/catch_random_number_generator.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Created by Martin on 30/08/2017.
|
||||||
|
*
|
||||||
|
* 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)
|
||||||
|
*/
|
||||||
|
#ifndef TWOBLUECUBES_CATCH_RANDOM_NUMBER_GENERATOR_H_INCLUDED
|
||||||
|
#define TWOBLUECUBES_CATCH_RANDOM_NUMBER_GENERATOR_H_INCLUDED
|
||||||
|
|
||||||
|
#include "catch_random_number_generator.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
|
||||||
|
struct IConfig;
|
||||||
|
|
||||||
|
void seedRng( IConfig const& config );
|
||||||
|
|
||||||
|
unsigned int rngSeed();
|
||||||
|
|
||||||
|
struct RandomNumberGenerator {
|
||||||
|
using result_type = std::ptrdiff_t;
|
||||||
|
|
||||||
|
static constexpr result_type min() { return 0; }
|
||||||
|
static constexpr result_type max() { return 1000000; }
|
||||||
|
|
||||||
|
result_type operator()( result_type n ) const;
|
||||||
|
result_type operator()() const;
|
||||||
|
|
||||||
|
template<typename V>
|
||||||
|
static void shuffle( V& vector ) {
|
||||||
|
RandomNumberGenerator rng;
|
||||||
|
std::shuffle( vector.begin(), vector.end(), rng );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // TWOBLUECUBES_CATCH_RANDOM_NUMBER_GENERATOR_H_INCLUDED
|
@@ -9,8 +9,8 @@
|
|||||||
#include "catch_interfaces_registry_hub.h"
|
#include "catch_interfaces_registry_hub.h"
|
||||||
|
|
||||||
#include "catch_context.h"
|
#include "catch_context.h"
|
||||||
#include "catch_test_case_registry_impl.hpp"
|
#include "catch_test_case_registry_impl.h"
|
||||||
#include "catch_reporter_registry.hpp"
|
#include "catch_reporter_registry.h"
|
||||||
#include "catch_exception_translator_registry.h"
|
#include "catch_exception_translator_registry.h"
|
||||||
#include "catch_tag_alias_registry.h"
|
#include "catch_tag_alias_registry.h"
|
||||||
#include "catch_startup_exception_registry.h"
|
#include "catch_startup_exception_registry.h"
|
||||||
@@ -23,8 +23,7 @@ namespace Catch {
|
|||||||
private NonCopyable {
|
private NonCopyable {
|
||||||
|
|
||||||
public: // IRegistryHub
|
public: // IRegistryHub
|
||||||
RegistryHub() {
|
RegistryHub() = default;
|
||||||
}
|
|
||||||
IReporterRegistry const& getReporterRegistry() const override {
|
IReporterRegistry const& getReporterRegistry() const override {
|
||||||
return m_reporterRegistry;
|
return m_reporterRegistry;
|
||||||
}
|
}
|
||||||
|
@@ -58,11 +58,14 @@ namespace Catch {
|
|||||||
#if !defined(CATCH_CONFIG_DISABLE)
|
#if !defined(CATCH_CONFIG_DISABLE)
|
||||||
|
|
||||||
#define CATCH_REGISTER_REPORTER( name, reporterType ) \
|
#define CATCH_REGISTER_REPORTER( name, reporterType ) \
|
||||||
namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); }
|
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||||
|
namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } \
|
||||||
|
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
|
||||||
|
|
||||||
#define CATCH_REGISTER_LISTENER( listenerType ) \
|
#define CATCH_REGISTER_LISTENER( listenerType ) \
|
||||||
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
|
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||||
|
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } \
|
||||||
|
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
|
||||||
#else // CATCH_CONFIG_DISABLE
|
#else // CATCH_CONFIG_DISABLE
|
||||||
|
|
||||||
#define CATCH_REGISTER_REPORTER(name, reporterType)
|
#define CATCH_REGISTER_REPORTER(name, reporterType)
|
||||||
|
34
include/internal/catch_reporter_registry.cpp
Normal file
34
include/internal/catch_reporter_registry.cpp
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Created by Martin on 31/08/2017.
|
||||||
|
*
|
||||||
|
* 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_reporter_registry.h"
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
|
||||||
|
ReporterRegistry::~ReporterRegistry() = default;
|
||||||
|
|
||||||
|
IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const {
|
||||||
|
auto it = m_factories.find( name );
|
||||||
|
if( it == m_factories.end() )
|
||||||
|
return nullptr;
|
||||||
|
return it->second->create( ReporterConfig( config ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {
|
||||||
|
m_factories.emplace(name, factory);
|
||||||
|
}
|
||||||
|
void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) {
|
||||||
|
m_listeners.push_back( factory );
|
||||||
|
}
|
||||||
|
|
||||||
|
IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const {
|
||||||
|
return m_factories;
|
||||||
|
}
|
||||||
|
IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const {
|
||||||
|
return m_listeners;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
37
include/internal/catch_reporter_registry.h
Normal file
37
include/internal/catch_reporter_registry.h
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Created by Phil on 29/10/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)
|
||||||
|
*/
|
||||||
|
#ifndef TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED
|
||||||
|
#define TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED
|
||||||
|
|
||||||
|
#include "catch_interfaces_reporter.h"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
|
||||||
|
class ReporterRegistry : public IReporterRegistry {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
~ReporterRegistry() override;
|
||||||
|
|
||||||
|
IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override;
|
||||||
|
|
||||||
|
void registerReporter( std::string const& name, IReporterFactoryPtr const& factory );
|
||||||
|
void registerListener( IReporterFactoryPtr const& factory );
|
||||||
|
|
||||||
|
FactoryMap const& getFactories() const override;
|
||||||
|
Listeners const& getListeners() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
FactoryMap m_factories;
|
||||||
|
Listeners m_listeners;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED
|
@@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Created by Phil on 29/10/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)
|
|
||||||
*/
|
|
||||||
#ifndef TWOBLUECUBES_CATCH_REPORTER_REGISTRY_HPP_INCLUDED
|
|
||||||
#define TWOBLUECUBES_CATCH_REPORTER_REGISTRY_HPP_INCLUDED
|
|
||||||
|
|
||||||
#include "catch_interfaces_reporter.h"
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
class ReporterRegistry : public IReporterRegistry {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
~ReporterRegistry() override {}
|
|
||||||
|
|
||||||
IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override {
|
|
||||||
auto it = m_factories.find( name );
|
|
||||||
if( it == m_factories.end() )
|
|
||||||
return nullptr;
|
|
||||||
return it->second->create( ReporterConfig( config ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {
|
|
||||||
m_factories.emplace(name, factory);
|
|
||||||
}
|
|
||||||
void registerListener( IReporterFactoryPtr const& factory ) {
|
|
||||||
m_listeners.push_back( factory );
|
|
||||||
}
|
|
||||||
|
|
||||||
FactoryMap const& getFactories() const override {
|
|
||||||
return m_factories;
|
|
||||||
}
|
|
||||||
Listeners const& getListeners() const override {
|
|
||||||
return m_listeners;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
FactoryMap m_factories;
|
|
||||||
Listeners m_listeners;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRY_HPP_INCLUDED
|
|
@@ -1,6 +1,7 @@
|
|||||||
#include "catch_run_context.hpp"
|
#include "catch_run_context.h"
|
||||||
#include "catch_context.h"
|
#include "catch_context.h"
|
||||||
#include "catch_enforce.h"
|
#include "catch_enforce.h"
|
||||||
|
#include "catch_random_number_generator.h"
|
||||||
#include "catch_stream.h"
|
#include "catch_stream.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@@ -207,11 +208,13 @@ namespace Catch {
|
|||||||
m_shouldReportUnexpected = false;
|
m_shouldReportUnexpected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunContext::handleFatalErrorCondition(std::string const & message) {
|
void RunContext::handleFatalErrorCondition( StringRef message ) {
|
||||||
|
// First notify reporter that bad things happened
|
||||||
|
m_reporter->fatalErrorEncountered(message);
|
||||||
|
|
||||||
// Don't rebuild the result -- the stringification itself can cause more fatal errors
|
// Don't rebuild the result -- the stringification itself can cause more fatal errors
|
||||||
// Instead, fake a result data.
|
// Instead, fake a result data.
|
||||||
AssertionResultData tempResult( ResultWas::Unknown, { false } );
|
AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } );
|
||||||
tempResult.resultType = ResultWas::FatalErrorCondition;
|
|
||||||
tempResult.message = message;
|
tempResult.message = message;
|
||||||
AssertionResult result(m_lastAssertionInfo, tempResult);
|
AssertionResult result(m_lastAssertionInfo, tempResult);
|
||||||
|
|
||||||
@@ -220,7 +223,7 @@ namespace Catch {
|
|||||||
handleUnfinishedSections();
|
handleUnfinishedSections();
|
||||||
|
|
||||||
// Recreate section for test case (as we will lose the one that was in scope)
|
// Recreate section for test case (as we will lose the one that was in scope)
|
||||||
TestCaseInfo const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
|
auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
|
||||||
SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);
|
SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);
|
||||||
|
|
||||||
Counts assertions;
|
Counts assertions;
|
||||||
@@ -228,7 +231,7 @@ namespace Catch {
|
|||||||
SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false);
|
SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false);
|
||||||
m_reporter->sectionEnded(testCaseSectionStats);
|
m_reporter->sectionEnded(testCaseSectionStats);
|
||||||
|
|
||||||
TestCaseInfo testInfo = m_activeTestCase->getTestCaseInfo();
|
auto const& testInfo = m_activeTestCase->getTestCaseInfo();
|
||||||
|
|
||||||
Totals deltaTotals;
|
Totals deltaTotals;
|
||||||
deltaTotals.testCases.failed = 1;
|
deltaTotals.testCases.failed = 1;
|
||||||
@@ -262,7 +265,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) {
|
void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) {
|
||||||
TestCaseInfo const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
|
auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
|
||||||
SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);
|
SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);
|
||||||
m_reporter->sectionStarting(testCaseSection);
|
m_reporter->sectionStarting(testCaseSection);
|
||||||
Counts prevAssertions = m_totals.assertions;
|
Counts prevAssertions = m_totals.assertions;
|
||||||
@@ -324,7 +327,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IResultCapture& getResultCapture() {
|
IResultCapture& getResultCapture() {
|
||||||
if (IResultCapture* capture = getCurrentContext().getResultCapture())
|
if (auto* capture = getCurrentContext().getResultCapture())
|
||||||
return *capture;
|
return *capture;
|
||||||
else
|
else
|
||||||
CATCH_INTERNAL_ERROR("No result capture instance");
|
CATCH_INTERNAL_ERROR("No result capture instance");
|
||||||
|
@@ -12,12 +12,12 @@
|
|||||||
#include "catch_interfaces_reporter.h"
|
#include "catch_interfaces_reporter.h"
|
||||||
#include "catch_interfaces_exception.h"
|
#include "catch_interfaces_exception.h"
|
||||||
#include "catch_config.hpp"
|
#include "catch_config.hpp"
|
||||||
#include "catch_test_registry.hpp"
|
#include "catch_test_registry.h"
|
||||||
#include "catch_test_case_info.h"
|
#include "catch_test_case_info.h"
|
||||||
#include "catch_capture.hpp"
|
#include "catch_capture.hpp"
|
||||||
#include "catch_totals.hpp"
|
#include "catch_totals.h"
|
||||||
#include "catch_test_spec.hpp"
|
#include "catch_test_spec.h"
|
||||||
#include "catch_test_case_tracker.hpp"
|
#include "catch_test_case_tracker.h"
|
||||||
#include "catch_timer.h"
|
#include "catch_timer.h"
|
||||||
#include "catch_assertionhandler.h"
|
#include "catch_assertionhandler.h"
|
||||||
#include "catch_fatal_condition.h"
|
#include "catch_fatal_condition.h"
|
||||||
@@ -100,7 +100,7 @@ namespace Catch {
|
|||||||
|
|
||||||
void exceptionEarlyReported() override;
|
void exceptionEarlyReported() override;
|
||||||
|
|
||||||
void handleFatalErrorCondition(std::string const& message) override;
|
void handleFatalErrorCondition( StringRef message ) override;
|
||||||
|
|
||||||
bool lastAssertionPassed() override;
|
bool lastAssertionPassed() override;
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ namespace Catch {
|
|||||||
std::vector<SectionEndInfo> m_unfinishedSections;
|
std::vector<SectionEndInfo> m_unfinishedSections;
|
||||||
std::vector<ITracker*> m_activeSections;
|
std::vector<ITracker*> m_activeSections;
|
||||||
TrackerContext m_trackerContext;
|
TrackerContext m_trackerContext;
|
||||||
size_t m_prevPassed = 0;
|
std::size_t m_prevPassed = 0;
|
||||||
bool m_shouldReportUnexpected = true;
|
bool m_shouldReportUnexpected = true;
|
||||||
};
|
};
|
||||||
|
|
@@ -9,7 +9,7 @@
|
|||||||
#define TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
|
||||||
|
|
||||||
#include "catch_section_info.h"
|
#include "catch_section_info.h"
|
||||||
#include "catch_totals.hpp"
|
#include "catch_totals.h"
|
||||||
#include "catch_timer.h"
|
#include "catch_timer.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#define TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED
|
||||||
|
|
||||||
#include "catch_common.h"
|
#include "catch_common.h"
|
||||||
#include "catch_totals.hpp"
|
#include "catch_totals.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
263
include/internal/catch_session.cpp
Normal file
263
include/internal/catch_session.cpp
Normal file
@@ -0,0 +1,263 @@
|
|||||||
|
/*
|
||||||
|
* Created by Martin on 31/08/2017.
|
||||||
|
*
|
||||||
|
* 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_session.h"
|
||||||
|
#include "catch_commandline.h"
|
||||||
|
#include "catch_console_colour.h"
|
||||||
|
#include "catch_enforce.h"
|
||||||
|
#include "catch_list.h"
|
||||||
|
#include "catch_run_context.h"
|
||||||
|
#include "catch_stream.h"
|
||||||
|
#include "catch_test_spec.h"
|
||||||
|
#include "catch_version.h"
|
||||||
|
#include "catch_interfaces_reporter.h"
|
||||||
|
#include "catch_random_number_generator.h"
|
||||||
|
#include "catch_startup_exception_registry.h"
|
||||||
|
#include "catch_text.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
const int MaxExitCode = 255;
|
||||||
|
using Catch::IStreamingReporterPtr;
|
||||||
|
using Catch::IConfigPtr;
|
||||||
|
using Catch::Config;
|
||||||
|
|
||||||
|
IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) {
|
||||||
|
auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config);
|
||||||
|
CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'");
|
||||||
|
|
||||||
|
return reporter;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef CATCH_CONFIG_DEFAULT_REPORTER
|
||||||
|
#define CATCH_CONFIG_DEFAULT_REPORTER "console"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IStreamingReporterPtr makeReporter(std::shared_ptr<Config> const& config) {
|
||||||
|
auto const& reporterNames = config->getReporterNames();
|
||||||
|
if (reporterNames.empty())
|
||||||
|
return createReporter(CATCH_CONFIG_DEFAULT_REPORTER, config);
|
||||||
|
|
||||||
|
IStreamingReporterPtr reporter;
|
||||||
|
for (auto const& name : reporterNames)
|
||||||
|
addReporter(reporter, createReporter(name, config));
|
||||||
|
return reporter;
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef CATCH_CONFIG_DEFAULT_REPORTER
|
||||||
|
|
||||||
|
void addListeners(IStreamingReporterPtr& reporters, IConfigPtr const& config) {
|
||||||
|
auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
|
||||||
|
for (auto const& listener : listeners)
|
||||||
|
addReporter(reporters, listener->create(Catch::ReporterConfig(config)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Catch::Totals runTests(std::shared_ptr<Config> const& config) {
|
||||||
|
using namespace Catch;
|
||||||
|
IStreamingReporterPtr reporter = makeReporter(config);
|
||||||
|
addListeners(reporter, config);
|
||||||
|
|
||||||
|
RunContext context(config, std::move(reporter));
|
||||||
|
|
||||||
|
Totals totals;
|
||||||
|
|
||||||
|
context.testGroupStarting(config->name(), 1, 1);
|
||||||
|
|
||||||
|
TestSpec testSpec = config->testSpec();
|
||||||
|
if (!testSpec.hasFilters())
|
||||||
|
testSpec = TestSpecParser(ITagAliasRegistry::get()).parse("~[.]").testSpec(); // All not hidden tests
|
||||||
|
|
||||||
|
auto const& allTestCases = getAllTestCasesSorted(*config);
|
||||||
|
for (auto const& testCase : allTestCases) {
|
||||||
|
if (!context.aborting() && matchTest(testCase, testSpec, *config))
|
||||||
|
totals += context.runTest(testCase);
|
||||||
|
else
|
||||||
|
context.reporter().skipTest(testCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
context.testGroupEnded(config->name(), totals, 1, 1);
|
||||||
|
return totals;
|
||||||
|
}
|
||||||
|
|
||||||
|
void applyFilenamesAsTags(Catch::IConfig const& config) {
|
||||||
|
using namespace Catch;
|
||||||
|
auto& tests = const_cast<std::vector<TestCase>&>(getAllTestCasesSorted(config));
|
||||||
|
for (auto& testCase : tests) {
|
||||||
|
auto tags = testCase.tags;
|
||||||
|
|
||||||
|
std::string filename = testCase.lineInfo.file;
|
||||||
|
auto lastSlash = filename.find_last_of("\\/");
|
||||||
|
if (lastSlash != std::string::npos) {
|
||||||
|
filename.erase(0, lastSlash);
|
||||||
|
filename[0] = '#';
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lastDot = filename.find_last_of('.');
|
||||||
|
if (lastDot != std::string::npos) {
|
||||||
|
filename.erase(lastDot);
|
||||||
|
}
|
||||||
|
|
||||||
|
tags.push_back(std::move(filename));
|
||||||
|
setTags(testCase, tags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
|
||||||
|
Session::Session() {
|
||||||
|
static bool alreadyInstantiated = false;
|
||||||
|
if( alreadyInstantiated )
|
||||||
|
CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" );
|
||||||
|
alreadyInstantiated = true;
|
||||||
|
m_cli = makeCommandLineParser( m_configData );
|
||||||
|
}
|
||||||
|
Session::~Session() {
|
||||||
|
Catch::cleanUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Session::showHelp() const {
|
||||||
|
Catch::cout()
|
||||||
|
<< "\nCatch v" << libraryVersion() << "\n"
|
||||||
|
<< m_cli << std::endl
|
||||||
|
<< "For more detailed usage please see the project docs\n" << std::endl;
|
||||||
|
}
|
||||||
|
void Session::libIdentify() {
|
||||||
|
Catch::cout()
|
||||||
|
<< std::left << std::setw(16) << "description: " << "A Catch test executable\n"
|
||||||
|
<< std::left << std::setw(16) << "category: " << "testframework\n"
|
||||||
|
<< std::left << std::setw(16) << "framework: " << "Catch Test\n"
|
||||||
|
<< std::left << std::setw(16) << "version: " << libraryVersion() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Session::applyCommandLine( int argc, char* argv[] ) {
|
||||||
|
auto result = m_cli.parse( clara::Args( argc, argv ) );
|
||||||
|
if( !result ) {
|
||||||
|
Catch::cerr()
|
||||||
|
<< Colour( Colour::Red )
|
||||||
|
<< "\nError(s) in input:\n"
|
||||||
|
<< Column( result.errorMessage() ).indent( 2 )
|
||||||
|
<< "\n\n";
|
||||||
|
Catch::cerr() << "Run with -? for usage\n" << std::endl;
|
||||||
|
return MaxExitCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_configData.showHelp )
|
||||||
|
showHelp();
|
||||||
|
if( m_configData.libIdentify )
|
||||||
|
libIdentify();
|
||||||
|
m_config.reset();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Session::useConfigData( ConfigData const& configData ) {
|
||||||
|
m_configData = configData;
|
||||||
|
m_config.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
int Session::run( int argc, char* argv[] ) {
|
||||||
|
const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions();
|
||||||
|
if ( !exceptions.empty() ) {
|
||||||
|
Catch::cerr() << "Errors occured during startup!" << '\n';
|
||||||
|
// iterate over all exceptions and notify user
|
||||||
|
for ( const auto& ex_ptr : exceptions ) {
|
||||||
|
try {
|
||||||
|
std::rethrow_exception(ex_ptr);
|
||||||
|
} catch ( std::exception const& ex ) {
|
||||||
|
Catch::cerr() << ex.what() << '\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
int returnCode = applyCommandLine( argc, argv );
|
||||||
|
if( returnCode == 0 )
|
||||||
|
returnCode = run();
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(WIN32) && defined(UNICODE)
|
||||||
|
int Session::run( int argc, wchar_t* const argv[] ) {
|
||||||
|
|
||||||
|
char **utf8Argv = new char *[ argc ];
|
||||||
|
|
||||||
|
for ( int i = 0; i < argc; ++i ) {
|
||||||
|
int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL );
|
||||||
|
|
||||||
|
utf8Argv[ i ] = new char[ bufSize ];
|
||||||
|
|
||||||
|
WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
int returnCode = run( argc, utf8Argv );
|
||||||
|
|
||||||
|
for ( int i = 0; i < argc; ++i )
|
||||||
|
delete [] utf8Argv[ i ];
|
||||||
|
|
||||||
|
delete [] utf8Argv;
|
||||||
|
|
||||||
|
return returnCode;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
int Session::run() {
|
||||||
|
if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {
|
||||||
|
Catch::cout() << "...waiting for enter/ return before starting" << std::endl;
|
||||||
|
static_cast<void>(std::getchar());
|
||||||
|
}
|
||||||
|
int exitCode = runInternal();
|
||||||
|
if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {
|
||||||
|
Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl;
|
||||||
|
static_cast<void>(std::getchar());
|
||||||
|
}
|
||||||
|
return exitCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
clara::Parser const& Session::cli() const {
|
||||||
|
return m_cli;
|
||||||
|
}
|
||||||
|
void Session::cli( clara::Parser const& newParser ) {
|
||||||
|
m_cli = newParser;
|
||||||
|
}
|
||||||
|
ConfigData& Session::configData() {
|
||||||
|
return m_configData;
|
||||||
|
}
|
||||||
|
Config& Session::config() {
|
||||||
|
if( !m_config )
|
||||||
|
m_config = std::make_shared<Config>( m_configData );
|
||||||
|
return *m_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Session::runInternal() {
|
||||||
|
if( m_configData.showHelp || m_configData.libIdentify )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
config(); // Force config to be constructed
|
||||||
|
|
||||||
|
seedRng( *m_config );
|
||||||
|
|
||||||
|
if( m_configData.filenamesAsTags )
|
||||||
|
applyFilenamesAsTags( *m_config );
|
||||||
|
|
||||||
|
// Handle list request
|
||||||
|
if( Option<std::size_t> listed = list( config() ) )
|
||||||
|
return static_cast<int>( *listed );
|
||||||
|
|
||||||
|
return (std::min)( MaxExitCode, static_cast<int>( runTests( m_config ).assertions.failed ) );
|
||||||
|
}
|
||||||
|
catch( std::exception& ex ) {
|
||||||
|
Catch::cerr() << ex.what() << std::endl;
|
||||||
|
return MaxExitCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end namespace Catch
|
52
include/internal/catch_session.h
Normal file
52
include/internal/catch_session.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Created by Phil on 31/10/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)
|
||||||
|
*/
|
||||||
|
#ifndef TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
||||||
|
#define TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include "catch_commandline.h"
|
||||||
|
#include "catch_config.hpp"
|
||||||
|
#include "catch_text.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
|
||||||
|
class Session : NonCopyable {
|
||||||
|
public:
|
||||||
|
|
||||||
|
Session();
|
||||||
|
~Session() override;
|
||||||
|
|
||||||
|
void showHelp() const;
|
||||||
|
void libIdentify();
|
||||||
|
|
||||||
|
int applyCommandLine( int argc, char* argv[] );
|
||||||
|
|
||||||
|
void useConfigData( ConfigData const& configData );
|
||||||
|
|
||||||
|
int run( int argc, char* argv[] );
|
||||||
|
#if defined(WIN32) && defined(UNICODE)
|
||||||
|
int run( int argc, wchar_t* const argv[] );
|
||||||
|
#endif
|
||||||
|
int run();
|
||||||
|
|
||||||
|
clara::Parser const& cli() const;
|
||||||
|
void cli( clara::Parser const& newParser );
|
||||||
|
ConfigData& configData();
|
||||||
|
Config& config();
|
||||||
|
private:
|
||||||
|
int runInternal();
|
||||||
|
|
||||||
|
clara::Parser m_cli;
|
||||||
|
ConfigData m_configData;
|
||||||
|
std::shared_ptr<Config> m_config;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // end namespace Catch
|
||||||
|
|
||||||
|
#endif // TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
template<typename WriterF, size_t bufferSize=256>
|
template<typename WriterF, std::size_t bufferSize=256>
|
||||||
class StreamBufImpl : public StreamBufBase {
|
class StreamBufImpl : public StreamBufBase {
|
||||||
char data[bufferSize];
|
char data[bufferSize];
|
||||||
WriterF m_writer;
|
WriterF m_writer;
|
||||||
@@ -57,6 +57,8 @@ namespace Catch {
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
Catch::IStream::~IStream() = default;
|
||||||
|
|
||||||
FileStream::FileStream( std::string const& filename ) {
|
FileStream::FileStream( std::string const& filename ) {
|
||||||
m_ofs.open( filename.c_str() );
|
m_ofs.open( filename.c_str() );
|
||||||
CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" );
|
CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" );
|
||||||
|
@@ -24,7 +24,7 @@ namespace Catch {
|
|||||||
|
|
||||||
|
|
||||||
struct IStream {
|
struct IStream {
|
||||||
virtual ~IStream() noexcept;
|
virtual ~IStream();
|
||||||
virtual std::ostream& stream() const = 0;
|
virtual std::ostream& stream() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ namespace Catch {
|
|||||||
mutable std::ofstream m_ofs;
|
mutable std::ofstream m_ofs;
|
||||||
public:
|
public:
|
||||||
FileStream( std::string const& filename );
|
FileStream( std::string const& filename );
|
||||||
~FileStream() noexcept override;
|
~FileStream() override = default;
|
||||||
public: // IStream
|
public: // IStream
|
||||||
std::ostream& stream() const override;
|
std::ostream& stream() const override;
|
||||||
};
|
};
|
||||||
@@ -42,7 +42,7 @@ namespace Catch {
|
|||||||
mutable std::ostream m_os;
|
mutable std::ostream m_os;
|
||||||
public:
|
public:
|
||||||
CoutStream();
|
CoutStream();
|
||||||
~CoutStream() noexcept override;
|
~CoutStream() override = default;
|
||||||
|
|
||||||
public: // IStream
|
public: // IStream
|
||||||
std::ostream& stream() const override;
|
std::ostream& stream() const override;
|
||||||
@@ -54,7 +54,7 @@ namespace Catch {
|
|||||||
mutable std::ostream m_os;
|
mutable std::ostream m_os;
|
||||||
public:
|
public:
|
||||||
DebugOutStream();
|
DebugOutStream();
|
||||||
~DebugOutStream() noexcept override;
|
~DebugOutStream() override = default;
|
||||||
|
|
||||||
public: // IStream
|
public: // IStream
|
||||||
std::ostream& stream() const override;
|
std::ostream& stream() const override;
|
||||||
|
12
include/internal/catch_streambuf.cpp
Normal file
12
include/internal/catch_streambuf.cpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* Created by Martin on 31/08/2017.
|
||||||
|
*
|
||||||
|
* 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_streambuf.h"
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
StreamBufBase::~StreamBufBase() = default;
|
||||||
|
}
|
@@ -8,15 +8,13 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_STREAMBUF_H_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_STREAMBUF_H_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_STREAMBUF_H_INCLUDED
|
#define TWOBLUECUBES_CATCH_STREAMBUF_H_INCLUDED
|
||||||
|
|
||||||
#include "catch_compiler_capabilities.h"
|
|
||||||
|
|
||||||
#include <streambuf>
|
#include <streambuf>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
class StreamBufBase : public std::streambuf {
|
class StreamBufBase : public std::streambuf {
|
||||||
public:
|
public:
|
||||||
virtual ~StreamBufBase() noexcept;
|
virtual ~StreamBufBase();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,12 +5,20 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wexit-time-destructors"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "catch_stringref.h"
|
#include "catch_stringref.h"
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
auto getEmptyStringRef() -> StringRef {
|
auto getEmptyStringRef() -> StringRef {
|
||||||
@@ -160,3 +168,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
@@ -25,7 +25,7 @@ namespace Catch {
|
|||||||
class StringRef {
|
class StringRef {
|
||||||
friend struct StringRefTestAccess;
|
friend struct StringRefTestAccess;
|
||||||
|
|
||||||
using size_type = size_t;
|
using size_type = std::size_t;
|
||||||
|
|
||||||
char const* m_start;
|
char const* m_start;
|
||||||
size_type m_size;
|
size_type m_size;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_tag_alias_registry.h"
|
#include "catch_tag_alias_registry.h"
|
||||||
#include "catch_console_colour.hpp"
|
#include "catch_console_colour.h"
|
||||||
#include "catch_enforce.h"
|
#include "catch_enforce.h"
|
||||||
#include "catch_interfaces_registry_hub.h"
|
#include "catch_interfaces_registry_hub.h"
|
||||||
#include "catch_stream.h"
|
#include "catch_stream.h"
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "catch_test_case_info.h"
|
#include "catch_test_case_info.h"
|
||||||
#include "catch_enforce.h"
|
#include "catch_enforce.h"
|
||||||
#include "catch_test_spec.hpp"
|
#include "catch_test_spec.h"
|
||||||
#include "catch_interfaces_testcase.h"
|
#include "catch_interfaces_testcase.h"
|
||||||
#include "catch_string_manip.h"
|
#include "catch_string_manip.h"
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ namespace Catch {
|
|||||||
std::string TestCaseInfo::tagsAsString() const {
|
std::string TestCaseInfo::tagsAsString() const {
|
||||||
std::string ret;
|
std::string ret;
|
||||||
// '[' and ']' per tag
|
// '[' and ']' per tag
|
||||||
size_t full_size = 2 * tags.size();
|
std::size_t full_size = 2 * tags.size();
|
||||||
for (const auto& tag : tags) {
|
for (const auto& tag : tags) {
|
||||||
full_size += tag.size();
|
full_size += tag.size();
|
||||||
}
|
}
|
||||||
|
@@ -5,11 +5,12 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_test_case_registry_impl.hpp"
|
#include "catch_test_case_registry_impl.h"
|
||||||
|
|
||||||
#include "catch_context.h"
|
#include "catch_context.h"
|
||||||
#include "catch_enforce.h"
|
#include "catch_enforce.h"
|
||||||
#include "catch_interfaces_registry_hub.h"
|
#include "catch_interfaces_registry_hub.h"
|
||||||
|
#include "catch_random_number_generator.h"
|
||||||
#include "catch_string_manip.h"
|
#include "catch_string_manip.h"
|
||||||
#include "catch_test_case_info.h"
|
#include "catch_test_case_info.h"
|
||||||
|
|
||||||
@@ -17,9 +18,6 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
RandomNumberGenerator::result_type RandomNumberGenerator::operator()( result_type n ) const { return std::rand() % n; }
|
|
||||||
RandomNumberGenerator::result_type RandomNumberGenerator::operator()() const { return std::rand() % max(); }
|
|
||||||
|
|
||||||
std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
|
std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
|
||||||
|
|
||||||
std::vector<TestCase> sorted = unsortedTestCases;
|
std::vector<TestCase> sorted = unsortedTestCases;
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED
|
||||||
|
|
||||||
#include "catch_test_registry.hpp"
|
#include "catch_test_registry.h"
|
||||||
#include "catch_test_spec.hpp"
|
#include "catch_test_spec.h"
|
||||||
#include "catch_interfaces_config.h"
|
#include "catch_interfaces_config.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -22,21 +22,6 @@ namespace Catch {
|
|||||||
class TestCase;
|
class TestCase;
|
||||||
struct IConfig;
|
struct IConfig;
|
||||||
|
|
||||||
struct RandomNumberGenerator {
|
|
||||||
using result_type = std::ptrdiff_t;
|
|
||||||
|
|
||||||
result_type operator()( result_type n ) const;
|
|
||||||
|
|
||||||
static constexpr result_type min() { return 0; }
|
|
||||||
static constexpr result_type max() { return 1000000; }
|
|
||||||
result_type operator()() const;
|
|
||||||
template<typename V>
|
|
||||||
static void shuffle( V& vector ) {
|
|
||||||
RandomNumberGenerator rng;
|
|
||||||
std::shuffle( vector.begin(), vector.end(), rng );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases );
|
std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases );
|
||||||
bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
|
bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
|
||||||
|
|
||||||
@@ -58,7 +43,7 @@ namespace Catch {
|
|||||||
std::vector<TestCase> m_functions;
|
std::vector<TestCase> m_functions;
|
||||||
mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder;
|
mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder;
|
||||||
mutable std::vector<TestCase> m_sortedFunctions;
|
mutable std::vector<TestCase> m_sortedFunctions;
|
||||||
size_t m_unnamedCount = 0;
|
std::size_t m_unnamedCount = 0;
|
||||||
std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised
|
std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised
|
||||||
};
|
};
|
||||||
|
|
@@ -5,7 +5,7 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_test_case_tracker.hpp"
|
#include "catch_test_case_tracker.h"
|
||||||
|
|
||||||
#include "catch_enforce.h"
|
#include "catch_enforce.h"
|
||||||
|
|
||||||
@@ -14,7 +14,10 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wexit-time-destructors"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace TestCaseTracking {
|
namespace TestCaseTracking {
|
||||||
@@ -25,6 +28,8 @@ namespace TestCaseTracking {
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
ITracker::~ITracker() = default;
|
||||||
|
|
||||||
|
|
||||||
TrackerContext& TrackerContext::instance() {
|
TrackerContext& TrackerContext::instance() {
|
||||||
static TrackerContext s_instance;
|
static TrackerContext s_instance;
|
||||||
@@ -276,4 +281,6 @@ using TestCaseTracking::IndexTracker;
|
|||||||
|
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS
|
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
namespace TestCaseTracking {
|
namespace TestCaseTracking {
|
||||||
|
|
||||||
@@ -32,7 +30,7 @@ namespace TestCaseTracking {
|
|||||||
using ITrackerPtr = std::shared_ptr<ITracker>;
|
using ITrackerPtr = std::shared_ptr<ITracker>;
|
||||||
|
|
||||||
struct ITracker {
|
struct ITracker {
|
||||||
virtual ~ITracker() = default;
|
virtual ~ITracker();
|
||||||
|
|
||||||
// static queries
|
// static queries
|
||||||
virtual NameAndLocation const& nameAndLocation() const = 0;
|
virtual NameAndLocation const& nameAndLocation() const = 0;
|
||||||
@@ -182,6 +180,4 @@ using TestCaseTracking::IndexTracker;
|
|||||||
|
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED
|
@@ -5,8 +5,8 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_test_registry.hpp"
|
#include "catch_test_registry.h"
|
||||||
#include "catch_test_case_registry_impl.hpp"
|
#include "catch_test_case_registry_impl.h"
|
||||||
#include "catch_interfaces_registry_hub.h"
|
#include "catch_interfaces_registry_hub.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
@@ -32,4 +32,6 @@ namespace Catch {
|
|||||||
getMutableRegistryHub().registerStartupException();
|
getMutableRegistryHub().registerStartupException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AutoReg::~AutoReg() = default;
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ struct NameAndTags {
|
|||||||
|
|
||||||
struct AutoReg : NonCopyable {
|
struct AutoReg : NonCopyable {
|
||||||
AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept;
|
AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept;
|
||||||
~AutoReg() = default;
|
~AutoReg();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
@@ -63,38 +63,38 @@ struct AutoReg : NonCopyable {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
|
#define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
|
||||||
static void TestName(); \
|
static void TestName(); \
|
||||||
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
|
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
|
||||||
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
|
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
|
||||||
static void TestName()
|
static void TestName()
|
||||||
#define INTERNAL_CATCH_TESTCASE( ... ) \
|
#define INTERNAL_CATCH_TESTCASE( ... ) \
|
||||||
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
|
INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
|
#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
|
||||||
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
|
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
|
||||||
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
|
#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
|
||||||
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||||
namespace{ \
|
namespace{ \
|
||||||
struct TestName : ClassName{ \
|
struct TestName : ClassName{ \
|
||||||
void test(); \
|
void test(); \
|
||||||
}; \
|
}; \
|
||||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||||
} \
|
} \
|
||||||
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
|
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \
|
||||||
void TestName::test()
|
void TestName::test()
|
||||||
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
|
#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
|
||||||
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
|
INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
|
#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
|
||||||
CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
|
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||||
CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
|
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
|
||||||
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
|
@@ -5,7 +5,7 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_test_spec.hpp"
|
#include "catch_test_spec.h"
|
||||||
#include "catch_string_manip.h"
|
#include "catch_string_manip.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -15,6 +15,11 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
|
TestSpec::Pattern::~Pattern() = default;
|
||||||
|
TestSpec::NamePattern::~NamePattern() = default;
|
||||||
|
TestSpec::TagPattern::~TagPattern() = default;
|
||||||
|
TestSpec::ExcludedPattern::~ExcludedPattern() = default;
|
||||||
|
|
||||||
TestSpec::NamePattern::NamePattern( std::string const& name )
|
TestSpec::NamePattern::NamePattern( std::string const& name )
|
||||||
: m_wildcardPattern( toLower( name ), CaseSensitive::No )
|
: m_wildcardPattern( toLower( name ), CaseSensitive::No )
|
||||||
{}
|
{}
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#pragma clang diagnostic ignored "-Wpadded"
|
#pragma clang diagnostic ignored "-Wpadded"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "catch_wildcard_pattern.hpp"
|
#include "catch_wildcard_pattern.h"
|
||||||
#include "catch_test_case_info.h"
|
#include "catch_test_case_info.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -24,7 +24,7 @@ namespace Catch {
|
|||||||
|
|
||||||
class TestSpec {
|
class TestSpec {
|
||||||
struct Pattern {
|
struct Pattern {
|
||||||
virtual ~Pattern() = default;
|
virtual ~Pattern();
|
||||||
virtual bool matches( TestCaseInfo const& testCase ) const = 0;
|
virtual bool matches( TestCaseInfo const& testCase ) const = 0;
|
||||||
};
|
};
|
||||||
using PatternPtr = std::shared_ptr<Pattern>;
|
using PatternPtr = std::shared_ptr<Pattern>;
|
||||||
@@ -32,7 +32,7 @@ namespace Catch {
|
|||||||
class NamePattern : public Pattern {
|
class NamePattern : public Pattern {
|
||||||
public:
|
public:
|
||||||
NamePattern( std::string const& name );
|
NamePattern( std::string const& name );
|
||||||
virtual ~NamePattern() = default;
|
virtual ~NamePattern();
|
||||||
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
||||||
private:
|
private:
|
||||||
WildcardPattern m_wildcardPattern;
|
WildcardPattern m_wildcardPattern;
|
||||||
@@ -41,7 +41,7 @@ namespace Catch {
|
|||||||
class TagPattern : public Pattern {
|
class TagPattern : public Pattern {
|
||||||
public:
|
public:
|
||||||
TagPattern( std::string const& tag );
|
TagPattern( std::string const& tag );
|
||||||
virtual ~TagPattern() = default;
|
virtual ~TagPattern();
|
||||||
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
||||||
private:
|
private:
|
||||||
std::string m_tag;
|
std::string m_tag;
|
||||||
@@ -50,7 +50,7 @@ namespace Catch {
|
|||||||
class ExcludedPattern : public Pattern {
|
class ExcludedPattern : public Pattern {
|
||||||
public:
|
public:
|
||||||
ExcludedPattern( PatternPtr const& underlyingPattern );
|
ExcludedPattern( PatternPtr const& underlyingPattern );
|
||||||
virtual ~ExcludedPattern() = default;
|
virtual ~ExcludedPattern();
|
||||||
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
virtual bool matches( TestCaseInfo const& testCase ) const override;
|
||||||
private:
|
private:
|
||||||
PatternPtr m_underlyingPattern;
|
PatternPtr m_underlyingPattern;
|
@@ -5,7 +5,7 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_test_spec_parser.hpp"
|
#include "catch_test_spec_parser.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#pragma clang diagnostic ignored "-Wpadded"
|
#pragma clang diagnostic ignored "-Wpadded"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "catch_test_spec.hpp"
|
#include "catch_test_spec.h"
|
||||||
#include "catch_string_manip.h"
|
#include "catch_string_manip.h"
|
||||||
#include "catch_interfaces_tag_alias_registry.h"
|
#include "catch_interfaces_tag_alias_registry.h"
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ namespace Catch {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
void addPattern() {
|
void addPattern() {
|
||||||
std::string token = subString();
|
std::string token = subString();
|
||||||
for( size_t i = 0; i < m_escapeChars.size(); ++i )
|
for( std::size_t i = 0; i < m_escapeChars.size(); ++i )
|
||||||
token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 );
|
token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 );
|
||||||
m_escapeChars.clear();
|
m_escapeChars.clear();
|
||||||
if( startsWith( token, "exclude:" ) ) {
|
if( startsWith( token, "exclude:" ) ) {
|
@@ -20,7 +20,7 @@ namespace Catch {
|
|||||||
uint64_t sum = 0;
|
uint64_t sum = 0;
|
||||||
static const uint64_t iterations = 1000000;
|
static const uint64_t iterations = 1000000;
|
||||||
|
|
||||||
for( size_t i = 0; i < iterations; ++i ) {
|
for( std::size_t i = 0; i < iterations; ++i ) {
|
||||||
|
|
||||||
uint64_t ticks;
|
uint64_t ticks;
|
||||||
uint64_t baseTicks = getCurrentNanosecondsSinceEpoch();
|
uint64_t baseTicks = getCurrentNanosecondsSinceEpoch();
|
||||||
|
@@ -6,6 +6,13 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wexit-time-destructors"
|
||||||
|
# pragma clang diagnostic ignored "-Wglobal-constructors"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "catch_tostring.h"
|
#include "catch_tostring.h"
|
||||||
#include "catch_interfaces_config.h"
|
#include "catch_interfaces_config.h"
|
||||||
#include "catch_context.h"
|
#include "catch_context.h"
|
||||||
@@ -210,20 +217,9 @@ std::string StringMaker<double>::convert(double value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __OBJC__
|
} // end namespace Catch
|
||||||
std::string StringMaker<NSString*>::convert(NSString* nsstring) {
|
|
||||||
if (!nsstring)
|
#if defined(__clang__)
|
||||||
return "nil";
|
# pragma clang diagnostic pop
|
||||||
return "@" + toString([nsstring UTF8String]);
|
|
||||||
}
|
|
||||||
std::string StringMaker<NSString * CATCH_ARC_STRONG>::convert(NSString* CATCH_ARC_STRONG nsstring) {
|
|
||||||
if (!nsstring)
|
|
||||||
return "nil";
|
|
||||||
return "@" + toString([nsstring UTF8String]);
|
|
||||||
}
|
|
||||||
std::string StringMaker<NSObject*>::convert(NSObject* nsObject) {
|
|
||||||
return ::Catch::Detail::stringify([nsObject description]);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} // end namespace Catch
|
|
||||||
|
@@ -20,6 +20,11 @@
|
|||||||
#include "catch_objc_arc.hpp"
|
#include "catch_objc_arc.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// We need a dummy global operator<< so we can bring it into Catch namespace later
|
// We need a dummy global operator<< so we can bring it into Catch namespace later
|
||||||
struct Catch_global_namespace_dummy;
|
struct Catch_global_namespace_dummy;
|
||||||
@@ -299,19 +304,31 @@ namespace Catch {
|
|||||||
#ifdef __OBJC__
|
#ifdef __OBJC__
|
||||||
template<>
|
template<>
|
||||||
struct StringMaker<NSString*> {
|
struct StringMaker<NSString*> {
|
||||||
static std::string convert(NSString* nsstring);
|
static std::string convert(NSString * nsstring) {
|
||||||
};
|
if (!nsstring)
|
||||||
template<>
|
return "nil";
|
||||||
struct StringMaker<NSString* CATCH_ARC_STRONG> {
|
return std::string("@") + [nsstring UTF8String];
|
||||||
static std::string convert(NSString * CATCH_ARC_STRONG nsstring);
|
}
|
||||||
};
|
};
|
||||||
template<>
|
template<>
|
||||||
struct StringMaker<NSObject*> {
|
struct StringMaker<NSObject*> {
|
||||||
static std::string convert(NSObject* nsObject);
|
static std::string convert(NSObject* nsObject) {
|
||||||
};
|
return ::Catch::Detail::stringify([nsObject description]);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
namespace Detail {
|
||||||
|
inline std::string stringify( NSString* nsstring ) {
|
||||||
|
return StringMaker<NSString*>::convert( nsstring );
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Detail
|
||||||
|
#endif // __OBJC__
|
||||||
|
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_TOSTRING_H_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_TOSTRING_H_INCLUDED
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_totals.hpp"
|
#include "catch_totals.h"
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Version const& libraryVersion() {
|
Version const& libraryVersion() {
|
||||||
static Version version( 2, 0, 0, "develop", 3 );
|
static Version version( 2, 0, 0, "develop", 4 );
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_wildcard_pattern.hpp"
|
#include "catch_wildcard_pattern.h"
|
||||||
#include "catch_enforce.h"
|
#include "catch_enforce.h"
|
||||||
#include "catch_string_manip.h"
|
#include "catch_string_manip.h"
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch_xmlwriter.hpp"
|
#include "catch_xmlwriter.h"
|
||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ namespace Catch {
|
|||||||
// + 1 for decimal point
|
// + 1 for decimal point
|
||||||
// + 3 for the 3 decimal places
|
// + 3 for the 3 decimal places
|
||||||
// + 1 for null terminator
|
// + 1 for null terminator
|
||||||
const size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
|
const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;
|
||||||
char buffer[maxDoubleSize];
|
char buffer[maxDoubleSize];
|
||||||
|
|
||||||
// Save previous errno, to prevent sprintf from overwriting it
|
// Save previous errno, to prevent sprintf from overwriting it
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#include "catch_reporter_bases.hpp"
|
#include "catch_reporter_bases.hpp"
|
||||||
|
|
||||||
#include "../internal/catch_reporter_registrars.hpp"
|
#include "../internal/catch_reporter_registrars.hpp"
|
||||||
#include "../internal/catch_console_colour.hpp"
|
#include "internal/catch_console_colour.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#include "catch_reporter_bases.hpp"
|
#include "catch_reporter_bases.hpp"
|
||||||
|
|
||||||
#include "../internal/catch_reporter_registrars.hpp"
|
#include "../internal/catch_reporter_registrars.hpp"
|
||||||
#include "../internal/catch_console_colour.hpp"
|
#include "internal/catch_console_colour.h"
|
||||||
#include "../internal/catch_version.h"
|
#include "../internal/catch_version.h"
|
||||||
#include "../internal/catch_text.h"
|
#include "../internal/catch_text.h"
|
||||||
#include "../internal/catch_stringref.h"
|
#include "../internal/catch_stringref.h"
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
std::size_t makeRatio( std::size_t number, std::size_t total ) {
|
std::size_t makeRatio( std::size_t number, std::size_t total ) {
|
||||||
std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number/ total : 0;
|
std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number/ total : 0;
|
||||||
@@ -95,7 +97,7 @@ namespace {
|
|||||||
tp.m_currentColumn++;
|
tp.m_currentColumn++;
|
||||||
|
|
||||||
auto colInfo = tp.m_columnInfos[tp.m_currentColumn];
|
auto colInfo = tp.m_columnInfos[tp.m_currentColumn];
|
||||||
auto padding = ( strSize+2 < static_cast<size_t>( colInfo.width ) )
|
auto padding = ( strSize+2 < static_cast<std::size_t>( colInfo.width ) )
|
||||||
? std::string( colInfo.width-(strSize+2), ' ' )
|
? std::string( colInfo.width-(strSize+2), ' ' )
|
||||||
: std::string();
|
: std::string();
|
||||||
if( colInfo.justification == ColumnInfo::Left )
|
if( colInfo.justification == ColumnInfo::Left )
|
||||||
@@ -186,9 +188,7 @@ namespace {
|
|||||||
return os << duration.value() << " " << duration.unitsAsString();
|
return os << duration.value() << " " << duration.unitsAsString();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
} // end anon namespace
|
||||||
|
|
||||||
namespace Catch {
|
|
||||||
|
|
||||||
struct ConsoleReporter : StreamingReporterBase<ConsoleReporter> {
|
struct ConsoleReporter : StreamingReporterBase<ConsoleReporter> {
|
||||||
TablePrinter m_tablePrinter;
|
TablePrinter m_tablePrinter;
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "../internal/catch_tostring.h"
|
#include "../internal/catch_tostring.h"
|
||||||
#include "../internal/catch_reporter_registrars.hpp"
|
#include "../internal/catch_reporter_registrars.hpp"
|
||||||
#include "../internal/catch_xmlwriter.hpp"
|
#include "internal/catch_xmlwriter.h"
|
||||||
#include "../internal/catch_timer.h"
|
#include "../internal/catch_timer.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@@ -26,7 +26,7 @@ namespace Catch {
|
|||||||
// Also, UTC only, again because of backward compatibility (%z is C++11)
|
// Also, UTC only, again because of backward compatibility (%z is C++11)
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
std::time(&rawtime);
|
std::time(&rawtime);
|
||||||
const size_t timeStampSize = sizeof("2017-01-16T17:06:45Z");
|
auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
std::tm timeInfo = {};
|
std::tm timeInfo = {};
|
||||||
|
@@ -19,7 +19,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::set<Verbosity> MultipleReporters::getSupportedVerbosities() {
|
std::set<Verbosity> MultipleReporters::getSupportedVerbosities() {
|
||||||
return { };
|
return std::set<Verbosity>{ };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,6 +4,8 @@
|
|||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* 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)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
#ifndef TWOBLUECUBES_CATCH_MULTI_REPORTER_H_INCLUDED
|
||||||
|
#define TWOBLUECUBES_CATCH_MULTI_REPORTER_H_INCLUDED
|
||||||
|
|
||||||
#include "../internal/catch_interfaces_reporter.h"
|
#include "../internal/catch_interfaces_reporter.h"
|
||||||
|
|
||||||
@@ -43,3 +45,5 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
|
#endif // TWOBLUECUBES_CATCH_MULTI_REPORTER_H_INCLUDED
|
||||||
|
@@ -59,18 +59,18 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t counter = 0;
|
std::size_t counter = 0;
|
||||||
class AssertionPrinter {
|
class AssertionPrinter {
|
||||||
public:
|
public:
|
||||||
AssertionPrinter& operator= ( AssertionPrinter const& ) = delete;
|
AssertionPrinter& operator= ( AssertionPrinter const& ) = delete;
|
||||||
AssertionPrinter( AssertionPrinter const& ) = delete;
|
AssertionPrinter( AssertionPrinter const& ) = delete;
|
||||||
AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, size_t counter )
|
AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter )
|
||||||
: stream( _stream )
|
: stream( _stream )
|
||||||
, result( _stats.assertionResult )
|
, result( _stats.assertionResult )
|
||||||
, messages( _stats.infoMessages )
|
, messages( _stats.infoMessages )
|
||||||
, itMessage( _stats.infoMessages.begin() )
|
, itMessage( _stats.infoMessages.begin() )
|
||||||
, printInfoMessages( true )
|
, printInfoMessages( true )
|
||||||
, counter(counter)
|
, counter(_counter)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void print() {
|
void print() {
|
||||||
@@ -232,7 +232,7 @@ namespace Catch {
|
|||||||
std::vector<MessageInfo> messages;
|
std::vector<MessageInfo> messages;
|
||||||
std::vector<MessageInfo>::const_iterator itMessage;
|
std::vector<MessageInfo>::const_iterator itMessage;
|
||||||
bool printInfoMessages;
|
bool printInfoMessages;
|
||||||
size_t counter;
|
std::size_t counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
void printTotals( const Totals& totals ) const {
|
void printTotals( const Totals& totals ) const {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user