[
  {
    "path": ".gitattributes",
    "content": "# This sets the default behaviour, overriding core.autocrlf\n* text=auto\n\n# All source files should have unix line-endings in the repository,\n# but convert to native line-endings on checkout\n*.cpp text\n*.h text\n*.hpp text\n\n# Windows specific files should retain windows line-endings\n*.sln text eol=crlf\n\n# Keep executable scripts with LFs so they can be run after being\n# checked out on Windows\n*.py text eol=lf\n\n\n# Keep the single include header with LFs to make sure it is uploaded,\n# hashed etc with LF\nsingle_include/*.hpp eol=lf\n# Also keep the LICENCE file with LFs for the same reason\nLICENCE.txt eol=lf\n"
  },
  {
    "path": ".gitignore",
    "content": ".idea/*.iml\n.idea/misc.xml\n.idea/modules.xml\n.idea/vcs.xml\n.idea/workspace.xml\n.idea/.name\n.idea/dictionaries/*\ncmake-build-*\n.vs\n*.pyc\n.idea/markdown-navigator.xml\n.idea/codeStyles/Project.xml\n.idea/markdown-navigator/profiles_settings.xml\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: cpp\nsudo: false\n\ncommon_sources: &all_sources\n  - ubuntu-toolchain-r-test\n  - llvm-toolchain-trusty\n  - llvm-toolchain-trusty-3.9\n  - llvm-toolchain-trusty-4.0\n  - llvm-toolchain-trusty-5.0\n\nmatrix:\n  include:\n\n    # 1/ Linux Clang Builds\n    - os: linux\n      compiler: clang\n      addons:\n        apt:\n          sources: *all_sources\n          packages: ['valgrind', 'lcov', 'clang-3.5']\n      env: COMPILER='clang++-3.5' VALGRIND=1\n\n    - os: linux\n      compiler: clang\n      addons:\n        apt:\n          sources: *all_sources\n          packages: ['valgrind', 'lcov', 'clang-3.6']\n      env: COMPILER='clang++-3.6' VALGRIND=1\n\n# Travis's containers do not seem to have Clang 3.7 in apt, no matter what sources I add.\n#    - os: linux\n#      compiler: clang\n#      addons:\n#        apt:\n#          sources: *all_sources\n#          packages: ['valgrind', 'clang-3.7']\n#      env: COMPILER='clang++-3.7' VALGRIND=1\n\n    - os: linux\n      compiler: clang\n      addons:\n        apt:\n          sources: *all_sources\n          packages: ['valgrind', 'lcov', 'clang-3.8']\n      env: COMPILER='clang++-3.8' VALGRIND=1\n\n    - os: linux\n      compiler: clang\n      addons:\n          apt:\n              sources: *all_sources\n              packages: ['clang-3.9', 'valgrind', 'lcov']\n      env: COMPILER='clang++-3.9' VALGRIND=1\n\n    - os: linux\n      compiler: clang\n      addons:\n          apt:\n              sources: *all_sources\n              packages: ['clang-4.0', 'valgrind', 'lcov']\n      env: COMPILER='clang++-4.0' VALGRIND=1\n\n    - os: linux\n      compiler: clang\n      addons:\n          apt:\n              sources: *all_sources\n              packages: ['clang-5.0', 'valgrind', 'lcov']\n      env: COMPILER='clang++-5.0' VALGRIND=1\n\n    # 2/ Linux GCC Builds\n    - os: linux\n      compiler: gcc\n      addons:\n        apt:\n         sources: ['ubuntu-toolchain-r-test']\n         packages: ['valgrind', 'lcov', 'g++-4.8']\n      env: COMPILER='g++-4.8' VALGRIND=1 COVERAGE=1\n\n    - os: linux\n      compiler: gcc\n      addons:\n        apt:\n          sources: *all_sources\n          packages: ['valgrind', 'lcov', 'g++-4.9']\n      env: COMPILER='g++-4.9' VALGRIND=1\n\n    - os: linux\n      compiler: gcc\n      addons:\n        apt:\n          sources: *all_sources\n          packages: ['valgrind', 'lcov', 'g++-5']\n      env: COMPILER='g++-5' VALGRIND=1\n\n    - os: linux\n      compiler: gcc\n      addons: &gcc6\n        apt:\n          sources: *all_sources\n          packages: ['valgrind', 'lcov', 'g++-6']\n      env: COMPILER='g++-6' VALGRIND=1\n\n    - os: linux\n      compiler: gcc\n      addons: &gcc7\n        apt:\n          sources: *all_sources\n          packages: ['valgrind', 'lcov', 'g++-7']\n      env: COMPILER='g++-7' VALGRIND=1\n      \n    - os: linux\n      compiler: gcc\n      addons: *gcc7\n      env: COMPILER='g++-7' CPP17=1 COVERAGE=1\n\n    # 5/ OSX Clang Builds\n    - os: osx\n      osx_image: xcode8.3\n      compiler: clang\n      env: COMPILER='clang++'\n\n    - os: osx\n      osx_image: xcode9\n      compiler: clang\n      env: COMPILER='clang++'\n\n    - os: osx\n      osx_image: xcode9.1\n      compiler: clang\n      env: COMPILER='clang++'\n\n    - os: osx\n      osx_image: xcode9.1\n      compiler: clang\n      env: COMPILER='clang++' CPP14=1\n\n\ninstall:\n  - DEPS_DIR=\"${TRAVIS_BUILD_DIR}/deps\"\n  - mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}\n  - |\n    if [[ \"${TRAVIS_OS_NAME}\" == \"linux\" ]]; then\n      CMAKE_URL=\"http://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz\"\n      mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake\n      export PATH=${DEPS_DIR}/cmake/bin:${PATH}\n    elif [[ \"${TRAVIS_OS_NAME}\" == \"osx\" ]]; then\n        which cmake || brew install cmake;\n    fi\n\nbefore_script:\n  - export CXX=${COMPILER}\n  - cd ${TRAVIS_BUILD_DIR}\n    # Use Debug builds for collecting coverage\n  - cmake -H. -BBuild-Debug -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=${COVERAGE} -DUSE_CPP14=${CPP14} -DUSE_CPP17=${CPP17}\n    # Don't bother with release build for coverage build\n  - cmake -H. -BBuild-Release -DCMAKE_BUILD_TYPE=Release\n\n\nscript:\n  - cd Build-Debug\n  - make -j 2\n  - CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2\n  - |\n    # Coverage collection does not work for OS X atm\n    if [[ \"${COVERAGE}\" == \"1\" ]]; then\n      make gcov\n      make lcov\n      bash <(curl -s https://codecov.io/bash) -X gcov || echo \"Codecov did not collect coverage reports\"\n    fi\n    # Go to release build\n  - cd ../Build-Release\n  - make -j 2\n  - CTEST_OUTPUT_ON_FAILURE=1 ctest -j 2\n"
  },
  {
    "path": "CMake/FindGcov.cmake",
    "content": "# This file is part of CMake-codecov.\n#\n# Copyright (c)\n#   2015-2017 RWTH Aachen University, Federal Republic of Germany\n#\n# See the LICENSE file in the package base directory for details\n#\n# Written by Alexander Haase, alexander.haase@rwth-aachen.de\n#\n\n\n# include required Modules\ninclude(FindPackageHandleStandardArgs)\n\n\n# Search for gcov binary.\nset(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})\nset(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY})\n\nget_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)\nforeach (LANG ${ENABLED_LANGUAGES})\n\t# Gcov evaluation is dependend on the used compiler. Check gcov support for\n\t# each compiler that is used. If gcov binary was already found for this\n\t# compiler, do not try to find it again.\n\tif (NOT GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN)\n\t\tget_filename_component(COMPILER_PATH \"${CMAKE_${LANG}_COMPILER}\" PATH)\n\n\t\tif (\"${CMAKE_${LANG}_COMPILER_ID}\" STREQUAL \"GNU\")\n\t\t\t# Some distributions like OSX (homebrew) ship gcov with the compiler\n\t\t\t# version appended as gcov-x. To find this binary we'll build the\n\t\t\t# suggested binary name with the compiler version.\n\t\t\tstring(REGEX MATCH \"^[0-9]+\" GCC_VERSION\n\t\t\t\t\"${CMAKE_${LANG}_COMPILER_VERSION}\")\n\n\t\t\tfind_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov\n\t\t\t\tHINTS ${COMPILER_PATH})\n\n\t\telseif (\"${CMAKE_${LANG}_COMPILER_ID}\" STREQUAL \"Clang\")\n\t\t\t# Some distributions like Debian ship llvm-cov with the compiler\n\t\t\t# version appended as llvm-cov-x.y. To find this binary we'll build\n\t\t\t# the suggested binary name with the compiler version.\n\t\t\tstring(REGEX MATCH \"^[0-9]+.[0-9]+\" LLVM_VERSION\n\t\t\t\t\"${CMAKE_${LANG}_COMPILER_VERSION}\")\n\n\t\t\t# llvm-cov prior version 3.5 seems to be not working with coverage\n\t\t\t# evaluation tools, but these versions are compatible with the gcc\n\t\t\t# gcov tool.\n\t\t\tif(LLVM_VERSION VERSION_GREATER 3.4)\n\t\t\t\tfind_program(LLVM_COV_BIN NAMES \"llvm-cov-${LLVM_VERSION}\"\n\t\t\t\t\t\"llvm-cov\" HINTS ${COMPILER_PATH})\n\t\t\t\tmark_as_advanced(LLVM_COV_BIN)\n\n\t\t\t\tif (LLVM_COV_BIN)\n\t\t\t\t\tfind_program(LLVM_COV_WRAPPER \"llvm-cov-wrapper\" PATHS\n\t\t\t\t\t\t${CMAKE_MODULE_PATH})\n\t\t\t\t\tif (LLVM_COV_WRAPPER)\n\t\t\t\t\t\tset(GCOV_BIN \"${LLVM_COV_WRAPPER}\" CACHE FILEPATH \"\")\n\n\t\t\t\t\t\t# set additional parameters\n\t\t\t\t\t\tset(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV\n\t\t\t\t\t\t\t\"LLVM_COV_BIN=${LLVM_COV_BIN}\" CACHE STRING\n\t\t\t\t\t\t\t\"Environment variables for llvm-cov-wrapper.\")\n\t\t\t\t\t\tmark_as_advanced(GCOV_${CMAKE_${LANG}_COMPILER_ID}_ENV)\n\t\t\t\t\tendif ()\n\t\t\t\tendif ()\n\t\t\tendif ()\n\n\t\t\tif (NOT GCOV_BIN)\n\t\t\t\t# Fall back to gcov binary if llvm-cov was not found or is\n\t\t\t\t# incompatible. This is the default on OSX, but may crash on\n\t\t\t\t# recent Linux versions.\n\t\t\t\tfind_program(GCOV_BIN gcov HINTS ${COMPILER_PATH})\n\t\t\tendif ()\n\t\tendif ()\n\n\n\t\tif (GCOV_BIN)\n\t\t\tset(GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN \"${GCOV_BIN}\" CACHE STRING\n\t\t\t\t\"${LANG} gcov binary.\")\n\n\t\t\tif (NOT CMAKE_REQUIRED_QUIET)\n\t\t\t\tmessage(\"-- Found gcov evaluation for \"\n\t\t\t\t\"${CMAKE_${LANG}_COMPILER_ID}: ${GCOV_BIN}\")\n\t\t\tendif()\n\n\t\t\tunset(GCOV_BIN CACHE)\n\t\tendif ()\n\tendif ()\nendforeach ()\n\n\n\n\n# Add a new global target for all gcov targets. This target could be used to\n# generate the gcov files for the whole project instead of calling <TARGET>-gcov\n# for each target.\nif (NOT TARGET gcov)\n\tadd_custom_target(gcov)\nendif (NOT TARGET gcov)\n\n\n\n# This function will add gcov evaluation for target <TNAME>. Only sources of\n# this target will be evaluated and no dependencies will be added. It will call\n# Gcov on any source file of <TNAME> once and store the gcov file in the same\n# directory.\nfunction (add_gcov_target TNAME)\n\tset(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)\n\n\t# We don't have to check, if the target has support for coverage, thus this\n\t# will be checked by add_coverage_target in Findcoverage.cmake. Instead we\n\t# have to determine which gcov binary to use.\n\tget_target_property(TSOURCES ${TNAME} SOURCES)\n\tset(SOURCES \"\")\n\tset(TCOMPILER \"\")\n\tforeach (FILE ${TSOURCES})\n\t\tcodecov_path_of_source(${FILE} FILE)\n\t\tif (NOT \"${FILE}\" STREQUAL \"\")\n\t\t\tcodecov_lang_of_source(${FILE} LANG)\n\t\t\tif (NOT \"${LANG}\" STREQUAL \"\")\n\t\t\t\tlist(APPEND SOURCES \"${FILE}\")\n\t\t\t\tset(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})\n\t\t\tendif ()\n\t\tendif ()\n\tendforeach ()\n\n\t# If no gcov binary was found, coverage data can't be evaluated.\n\tif (NOT GCOV_${TCOMPILER}_BIN)\n\t\tmessage(WARNING \"No coverage evaluation binary found for ${TCOMPILER}.\")\n\t\treturn()\n\tendif ()\n\n\tset(GCOV_BIN \"${GCOV_${TCOMPILER}_BIN}\")\n\tset(GCOV_ENV \"${GCOV_${TCOMPILER}_ENV}\")\n\n\n\tset(BUFFER \"\")\n\tforeach(FILE ${SOURCES})\n\t\tget_filename_component(FILE_PATH \"${TDIR}/${FILE}\" PATH)\n\n\t\t# call gcov\n\t\tadd_custom_command(OUTPUT ${TDIR}/${FILE}.gcov\n\t\t\tCOMMAND ${GCOV_ENV} ${GCOV_BIN} ${TDIR}/${FILE}.gcno > /dev/null\n\t\t\tDEPENDS ${TNAME} ${TDIR}/${FILE}.gcno\n\t\t\tWORKING_DIRECTORY ${FILE_PATH}\n\t\t)\n\n\t\tlist(APPEND BUFFER ${TDIR}/${FILE}.gcov)\n\tendforeach()\n\n\n\t# add target for gcov evaluation of <TNAME>\n\tadd_custom_target(${TNAME}-gcov DEPENDS ${BUFFER})\n\n\t# add evaluation target to the global gcov target.\n\tadd_dependencies(gcov ${TNAME}-gcov)\nendfunction (add_gcov_target)\n"
  },
  {
    "path": "CMake/FindLcov.cmake",
    "content": "# This file is part of CMake-codecov.\n#\n# Copyright (c)\n#   2015-2017 RWTH Aachen University, Federal Republic of Germany\n#\n# See the LICENSE file in the package base directory for details\n#\n# Written by Alexander Haase, alexander.haase@rwth-aachen.de\n#\n\n\n# configuration\nset(LCOV_DATA_PATH \"${CMAKE_BINARY_DIR}/lcov/data\")\nset(LCOV_DATA_PATH_INIT \"${LCOV_DATA_PATH}/init\")\nset(LCOV_DATA_PATH_CAPTURE \"${LCOV_DATA_PATH}/capture\")\nset(LCOV_HTML_PATH \"${CMAKE_BINARY_DIR}/lcov/html\")\n\n\n\n\n# Search for Gcov which is used by Lcov.\nfind_package(Gcov)\n\n\n\n\n# This function will add lcov evaluation for target <TNAME>. Only sources of\n# this target will be evaluated and no dependencies will be added. It will call\n# geninfo on any source file of <TNAME> once and store the info file in the same\n# directory.\n#\n# Note: This function is only a wrapper to define this function always, even if\n#   coverage is not supported by the compiler or disabled. This function must\n#   be defined here, because the module will be exited, if there is no coverage\n#   support by the compiler or it is disabled by the user.\nfunction (add_lcov_target TNAME)\n\tif (LCOV_FOUND)\n\t\t# capture initial coverage data\n\t\tlcov_capture_initial_tgt(${TNAME})\n\n\t\t# capture coverage data after execution\n\t\tlcov_capture_tgt(${TNAME})\n\tendif ()\nendfunction (add_lcov_target)\n\n\n\n\n# include required Modules\ninclude(FindPackageHandleStandardArgs)\n\n# Search for required lcov binaries.\nfind_program(LCOV_BIN lcov)\nfind_program(GENINFO_BIN geninfo)\nfind_program(GENHTML_BIN genhtml)\nfind_package_handle_standard_args(lcov\n\tREQUIRED_VARS LCOV_BIN GENINFO_BIN GENHTML_BIN\n)\n\n# enable genhtml C++ demangeling, if c++filt is found.\nset(GENHTML_CPPFILT_FLAG \"\")\nfind_program(CPPFILT_BIN c++filt)\nif (NOT CPPFILT_BIN STREQUAL \"\")\n\tset(GENHTML_CPPFILT_FLAG \"--demangle-cpp\")\nendif (NOT CPPFILT_BIN STREQUAL \"\")\n\n# enable no-external flag for lcov, if available.\nif (GENINFO_BIN AND NOT DEFINED GENINFO_EXTERN_FLAG)\n\tset(FLAG \"\")\n\texecute_process(COMMAND ${GENINFO_BIN} --help OUTPUT_VARIABLE GENINFO_HELP)\n\tstring(REGEX MATCH \"external\" GENINFO_RES \"${GENINFO_HELP}\")\n\tif (GENINFO_RES)\n\t\tset(FLAG \"--no-external\")\n\tendif ()\n\n\tset(GENINFO_EXTERN_FLAG \"${FLAG}\"\n\t\tCACHE STRING \"Geninfo flag to exclude system sources.\")\nendif ()\n\n# If Lcov was not found, exit module now.\nif (NOT LCOV_FOUND)\n\treturn()\nendif (NOT LCOV_FOUND)\n\n\n\n\n# Create directories to be used.\nfile(MAKE_DIRECTORY ${LCOV_DATA_PATH_INIT})\nfile(MAKE_DIRECTORY ${LCOV_DATA_PATH_CAPTURE})\n\nset(LCOV_REMOVE_PATTERNS \"\")\n\n# This function will merge lcov files to a single target file. Additional lcov\n# flags may be set with setting LCOV_EXTRA_FLAGS before calling this function.\nfunction (lcov_merge_files OUTFILE ...)\n\t# Remove ${OUTFILE} from ${ARGV} and generate lcov parameters with files.\n\tlist(REMOVE_AT ARGV 0)\n\n\t# Generate merged file.\n\tstring(REPLACE \"${CMAKE_BINARY_DIR}/\" \"\" FILE_REL \"${OUTFILE}\")\n\tadd_custom_command(OUTPUT \"${OUTFILE}.raw\"\n\t\tCOMMAND cat ${ARGV} > ${OUTFILE}.raw\n\t\tDEPENDS ${ARGV}\n\t\tCOMMENT \"Generating ${FILE_REL}\"\n\t)\n\n\tadd_custom_command(OUTPUT \"${OUTFILE}\"\n\t\tCOMMAND ${LCOV_BIN} --quiet -a ${OUTFILE}.raw --output-file ${OUTFILE}\n\t\t\t--base-directory ${PROJECT_SOURCE_DIR} ${LCOV_EXTRA_FLAGS}\n\t\tCOMMAND ${LCOV_BIN} --quiet -r ${OUTFILE} ${LCOV_REMOVE_PATTERNS}\n\t\t\t--output-file ${OUTFILE} ${LCOV_EXTRA_FLAGS}\n\t\tDEPENDS ${OUTFILE}.raw\n\t\tCOMMENT \"Post-processing ${FILE_REL}\"\n\t)\nendfunction ()\n\n\n\n\n# Add a new global target to generate initial coverage reports for all targets.\n# This target will be used to generate the global initial info file, which is\n# used to gather even empty report data.\nif (NOT TARGET lcov-capture-init)\n\tadd_custom_target(lcov-capture-init)\n\tset(LCOV_CAPTURE_INIT_FILES \"\" CACHE INTERNAL \"\")\nendif (NOT TARGET lcov-capture-init)\n\n\n# This function will add initial capture of coverage data for target <TNAME>,\n# which is needed to get also data for objects, which were not loaded at\n# execution time. It will call geninfo for every source file of <TNAME> once and\n# store the info file in the same directory.\nfunction (lcov_capture_initial_tgt TNAME)\n\t# We don't have to check, if the target has support for coverage, thus this\n\t# will be checked by add_coverage_target in Findcoverage.cmake. Instead we\n\t# have to determine which gcov binary to use.\n\tget_target_property(TSOURCES ${TNAME} SOURCES)\n\tset(SOURCES \"\")\n\tset(TCOMPILER \"\")\n\tforeach (FILE ${TSOURCES})\n\t\tcodecov_path_of_source(${FILE} FILE)\n\t\tif (NOT \"${FILE}\" STREQUAL \"\")\n\t\t\tcodecov_lang_of_source(${FILE} LANG)\n\t\t\tif (NOT \"${LANG}\" STREQUAL \"\")\n\t\t\t\tlist(APPEND SOURCES \"${FILE}\")\n\t\t\t\tset(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})\n\t\t\tendif ()\n\t\tendif ()\n\tendforeach ()\n\n\t# If no gcov binary was found, coverage data can't be evaluated.\n\tif (NOT GCOV_${TCOMPILER}_BIN)\n\t\tmessage(WARNING \"No coverage evaluation binary found for ${TCOMPILER}.\")\n\t\treturn()\n\tendif ()\n\n\tset(GCOV_BIN \"${GCOV_${TCOMPILER}_BIN}\")\n\tset(GCOV_ENV \"${GCOV_${TCOMPILER}_ENV}\")\n\n\n\tset(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)\n\tset(GENINFO_FILES \"\")\n\tforeach(FILE ${SOURCES})\n\t\t# generate empty coverage files\n\t\tset(OUTFILE \"${TDIR}/${FILE}.info.init\")\n\t\tlist(APPEND GENINFO_FILES ${OUTFILE})\n\n\t\tadd_custom_command(OUTPUT ${OUTFILE} COMMAND ${GCOV_ENV} ${GENINFO_BIN}\n\t\t\t\t--quiet --base-directory ${PROJECT_SOURCE_DIR} --initial\n\t\t\t\t--gcov-tool ${GCOV_BIN} --output-filename ${OUTFILE}\n\t\t\t\t${GENINFO_EXTERN_FLAG} ${TDIR}/${FILE}.gcno\n\t\t\tDEPENDS ${TNAME}\n\t\t\tCOMMENT \"Capturing initial coverage data for ${FILE}\"\n\t\t)\n\tendforeach()\n\n\t# Concatenate all files generated by geninfo to a single file per target.\n\tset(OUTFILE \"${LCOV_DATA_PATH_INIT}/${TNAME}.info\")\n\tset(LCOV_EXTRA_FLAGS \"--initial\")\n\tlcov_merge_files(\"${OUTFILE}\" ${GENINFO_FILES})\n\tadd_custom_target(${TNAME}-capture-init ALL DEPENDS ${OUTFILE})\n\n\t# add geninfo file generation to global lcov-geninfo target\n\tadd_dependencies(lcov-capture-init ${TNAME}-capture-init)\n\tset(LCOV_CAPTURE_INIT_FILES \"${LCOV_CAPTURE_INIT_FILES}\"\n\t\t\"${OUTFILE}\" CACHE INTERNAL \"\"\n\t)\nendfunction (lcov_capture_initial_tgt)\n\n\n# This function will generate the global info file for all targets. It has to be\n# called after all other CMake functions in the root CMakeLists.txt file, to get\n# a full list of all targets that generate coverage data.\nfunction (lcov_capture_initial)\n\t# Skip this function (and do not create the following targets), if there are\n\t# no input files.\n\tif (\"${LCOV_CAPTURE_INIT_FILES}\" STREQUAL \"\")\n\t\treturn()\n\tendif ()\n\n\t# Add a new target to merge the files of all targets.\n\tset(OUTFILE \"${LCOV_DATA_PATH_INIT}/all_targets.info\")\n\tlcov_merge_files(\"${OUTFILE}\" ${LCOV_CAPTURE_INIT_FILES})\n\tadd_custom_target(lcov-geninfo-init ALL\tDEPENDS ${OUTFILE}\n\t\tlcov-capture-init\n\t)\nendfunction (lcov_capture_initial)\n\n\n\n\n# Add a new global target to generate coverage reports for all targets. This\n# target will be used to generate the global info file.\nif (NOT TARGET lcov-capture)\n\tadd_custom_target(lcov-capture)\n\tset(LCOV_CAPTURE_FILES \"\" CACHE INTERNAL \"\")\nendif (NOT TARGET lcov-capture)\n\n\n# This function will add capture of coverage data for target <TNAME>, which is\n# needed to get also data for objects, which were not loaded at execution time.\n# It will call geninfo for every source file of <TNAME> once and store the info\n# file in the same directory.\nfunction (lcov_capture_tgt TNAME)\n\t# We don't have to check, if the target has support for coverage, thus this\n\t# will be checked by add_coverage_target in Findcoverage.cmake. Instead we\n\t# have to determine which gcov binary to use.\n\tget_target_property(TSOURCES ${TNAME} SOURCES)\n\tset(SOURCES \"\")\n\tset(TCOMPILER \"\")\n\tforeach (FILE ${TSOURCES})\n\t\tcodecov_path_of_source(${FILE} FILE)\n\t\tif (NOT \"${FILE}\" STREQUAL \"\")\n\t\t\tcodecov_lang_of_source(${FILE} LANG)\n\t\t\tif (NOT \"${LANG}\" STREQUAL \"\")\n\t\t\t\tlist(APPEND SOURCES \"${FILE}\")\n\t\t\t\tset(TCOMPILER ${CMAKE_${LANG}_COMPILER_ID})\n\t\t\tendif ()\n\t\tendif ()\n\tendforeach ()\n\n\t# If no gcov binary was found, coverage data can't be evaluated.\n\tif (NOT GCOV_${TCOMPILER}_BIN)\n\t\tmessage(WARNING \"No coverage evaluation binary found for ${TCOMPILER}.\")\n\t\treturn()\n\tendif ()\n\n\tset(GCOV_BIN \"${GCOV_${TCOMPILER}_BIN}\")\n\tset(GCOV_ENV \"${GCOV_${TCOMPILER}_ENV}\")\n\n\n\tset(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)\n\tset(GENINFO_FILES \"\")\n\tforeach(FILE ${SOURCES})\n\t\t# Generate coverage files. If no .gcda file was generated during\n\t\t# execution, the empty coverage file will be used instead.\n\t\tset(OUTFILE \"${TDIR}/${FILE}.info\")\n\t\tlist(APPEND GENINFO_FILES ${OUTFILE})\n\n\t\tadd_custom_command(OUTPUT ${OUTFILE}\n\t\t\tCOMMAND test -f \"${TDIR}/${FILE}.gcda\"\n\t\t\t\t&& ${GCOV_ENV} ${GENINFO_BIN} --quiet --base-directory\n\t\t\t\t\t${PROJECT_SOURCE_DIR} --gcov-tool ${GCOV_BIN}\n\t\t\t\t\t--output-filename ${OUTFILE} ${GENINFO_EXTERN_FLAG}\n\t\t\t\t\t${TDIR}/${FILE}.gcda\n\t\t\t\t|| cp ${OUTFILE}.init ${OUTFILE}\n\t\t\tDEPENDS ${TNAME} ${TNAME}-capture-init\n\t\t\tCOMMENT \"Capturing coverage data for ${FILE}\"\n\t\t)\n\tendforeach()\n\n\t# Concatenate all files generated by geninfo to a single file per target.\n\tset(OUTFILE \"${LCOV_DATA_PATH_CAPTURE}/${TNAME}.info\")\n\tlcov_merge_files(\"${OUTFILE}\" ${GENINFO_FILES})\n\tadd_custom_target(${TNAME}-geninfo DEPENDS ${OUTFILE})\n\n\t# add geninfo file generation to global lcov-capture target\n\tadd_dependencies(lcov-capture ${TNAME}-geninfo)\n\tset(LCOV_CAPTURE_FILES \"${LCOV_CAPTURE_FILES}\" \"${OUTFILE}\" CACHE INTERNAL\n\t\t\"\"\n\t)\n\n\t# Add target for generating html output for this target only.\n\tfile(MAKE_DIRECTORY ${LCOV_HTML_PATH}/${TNAME})\n\tadd_custom_target(${TNAME}-genhtml\n\t\tCOMMAND ${GENHTML_BIN} --quiet --sort --prefix ${PROJECT_SOURCE_DIR}\n\t\t\t--baseline-file ${LCOV_DATA_PATH_INIT}/${TNAME}.info\n\t\t\t--output-directory ${LCOV_HTML_PATH}/${TNAME}\n\t\t\t--title \"${CMAKE_PROJECT_NAME} - target ${TNAME}\"\n\t\t\t${GENHTML_CPPFILT_FLAG} ${OUTFILE}\n\t\tDEPENDS ${TNAME}-geninfo ${TNAME}-capture-init\n\t)\nendfunction (lcov_capture_tgt)\n\n\n# This function will generate the global info file for all targets. It has to be\n# called after all other CMake functions in the root CMakeLists.txt file, to get\n# a full list of all targets that generate coverage data.\nfunction (lcov_capture)\n\t# Skip this function (and do not create the following targets), if there are\n\t# no input files.\n\tif (\"${LCOV_CAPTURE_FILES}\" STREQUAL \"\")\n\t\treturn()\n\tendif ()\n\n\t# Add a new target to merge the files of all targets.\n\tset(OUTFILE \"${LCOV_DATA_PATH_CAPTURE}/all_targets.info\")\n\tlcov_merge_files(\"${OUTFILE}\" ${LCOV_CAPTURE_FILES})\n\tadd_custom_target(lcov-geninfo DEPENDS ${OUTFILE} lcov-capture)\n\n\t# Add a new global target for all lcov targets. This target could be used to\n\t# generate the lcov html output for the whole project instead of calling\n\t# <TARGET>-geninfo and <TARGET>-genhtml for each target. It will also be\n\t# used to generate a html site for all project data together instead of one\n\t# for each target.\n\tif (NOT TARGET lcov)\n\t\tfile(MAKE_DIRECTORY ${LCOV_HTML_PATH}/all_targets)\n\t\tadd_custom_target(lcov\n\t\t\tCOMMAND ${GENHTML_BIN} --quiet --sort\n\t\t\t\t--baseline-file ${LCOV_DATA_PATH_INIT}/all_targets.info\n\t\t\t\t--output-directory ${LCOV_HTML_PATH}/all_targets\n\t\t\t\t--title \"${CMAKE_PROJECT_NAME}\" --prefix \"${PROJECT_SOURCE_DIR}\"\n\t\t\t\t${GENHTML_CPPFILT_FLAG} ${OUTFILE}\n\t\t\tDEPENDS lcov-geninfo-init lcov-geninfo\n\t\t)\n\tendif ()\nendfunction (lcov_capture)\n\n\n\n\n# Add a new global target to generate the lcov html report for the whole project\n# instead of calling <TARGET>-genhtml for each target (to create an own report\n# for each target). Instead of the lcov target it does not require geninfo for\n# all targets, so you have to call <TARGET>-geninfo to generate the info files\n# the targets you'd like to have in your report or lcov-geninfo for generating\n# info files for all targets before calling lcov-genhtml.\nfile(MAKE_DIRECTORY ${LCOV_HTML_PATH}/selected_targets)\nif (NOT TARGET lcov-genhtml)\n\tadd_custom_target(lcov-genhtml\n\t\tCOMMAND ${GENHTML_BIN}\n\t\t\t--quiet\n\t\t\t--output-directory ${LCOV_HTML_PATH}/selected_targets\n\t\t\t--title \\\"${CMAKE_PROJECT_NAME} - targets  `find\n\t\t\t\t${LCOV_DATA_PATH_CAPTURE} -name \\\"*.info\\\" ! -name\n\t\t\t\t\\\"all_targets.info\\\" -exec basename {} .info \\\\\\;`\\\"\n\t\t\t--prefix ${PROJECT_SOURCE_DIR}\n\t\t\t--sort\n\t\t\t${GENHTML_CPPFILT_FLAG}\n\t\t\t`find ${LCOV_DATA_PATH_CAPTURE} -name \\\"*.info\\\" ! -name\n\t\t\t\t\\\"all_targets.info\\\"`\n\t)\nendif (NOT TARGET lcov-genhtml)\n"
  },
  {
    "path": "CMake/Findcodecov.cmake",
    "content": "# This file is part of CMake-codecov.\n#\n# Copyright (c)\n#   2015-2017 RWTH Aachen University, Federal Republic of Germany\n#\n# See the LICENSE file in the package base directory for details\n#\n# Written by Alexander Haase, alexander.haase@rwth-aachen.de\n#\n\n\n# Add an option to choose, if coverage should be enabled or not. If enabled\n# marked targets will be build with coverage support and appropriate targets\n# will be added. If disabled coverage will be ignored for *ALL* targets.\noption(ENABLE_COVERAGE \"Enable coverage build.\" OFF)\n\nset(COVERAGE_FLAG_CANDIDATES\n\t# gcc and clang\n\t\"-O0 -g -fprofile-arcs -ftest-coverage\"\n\n\t# gcc and clang fallback\n\t\"-O0 -g --coverage\"\n)\n\n\n# Add coverage support for target ${TNAME} and register target for coverage\n# evaluation. If coverage is disabled or not supported, this function will\n# simply do nothing.\n#\n# Note: This function is only a wrapper to define this function always, even if\n#   coverage is not supported by the compiler or disabled. This function must\n#   be defined here, because the module will be exited, if there is no coverage\n#   support by the compiler or it is disabled by the user.\nfunction (add_coverage TNAME)\n\t# only add coverage for target, if coverage is support and enabled.\n\tif (ENABLE_COVERAGE)\n\t\tforeach (TNAME ${ARGV})\n\t\t\tadd_coverage_target(${TNAME})\n\t\tendforeach ()\n\tendif ()\nendfunction (add_coverage)\n\n\n# Add global target to gather coverage information after all targets have been\n# added. Other evaluation functions could be added here, after checks for the\n# specific module have been passed.\n#\n# Note: This function is only a wrapper to define this function always, even if\n#   coverage is not supported by the compiler or disabled. This function must\n#   be defined here, because the module will be exited, if there is no coverage\n#   support by the compiler or it is disabled by the user.\nfunction (coverage_evaluate)\n\t# add lcov evaluation\n\tif (LCOV_FOUND)\n\t\tlcov_capture_initial()\n\t\tlcov_capture()\n\tendif (LCOV_FOUND)\nendfunction ()\n\n\n# Exit this module, if coverage is disabled. add_coverage is defined before this\n# return, so this module can be exited now safely without breaking any build-\n# scripts.\nif (NOT ENABLE_COVERAGE)\n\treturn()\nendif ()\n\n\n\n\n# Find the reuired flags foreach language.\nset(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})\nset(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY})\n\nget_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)\nforeach (LANG ${ENABLED_LANGUAGES})\n\t# Coverage flags are not dependend on language, but the used compiler. So\n\t# instead of searching flags foreach language, search flags foreach compiler\n\t# used.\n\tset(COMPILER ${CMAKE_${LANG}_COMPILER_ID})\n\tif (NOT COVERAGE_${COMPILER}_FLAGS)\n\t\tforeach (FLAG ${COVERAGE_FLAG_CANDIDATES})\n\t\t\tif(NOT CMAKE_REQUIRED_QUIET)\n\t\t\t\tmessage(STATUS \"Try ${COMPILER} code coverage flag = [${FLAG}]\")\n\t\t\tendif()\n\n\t\t\tset(CMAKE_REQUIRED_FLAGS \"${FLAG}\")\n\t\t\tunset(COVERAGE_FLAG_DETECTED CACHE)\n\n\t\t\tif (${LANG} STREQUAL \"C\")\n\t\t\t\tinclude(CheckCCompilerFlag)\n\t\t\t\tcheck_c_compiler_flag(\"${FLAG}\" COVERAGE_FLAG_DETECTED)\n\n\t\t\telseif (${LANG} STREQUAL \"CXX\")\n\t\t\t\tinclude(CheckCXXCompilerFlag)\n\t\t\t\tcheck_cxx_compiler_flag(\"${FLAG}\" COVERAGE_FLAG_DETECTED)\n\n\t\t\telseif (${LANG} STREQUAL \"Fortran\")\n\t\t\t\t# CheckFortranCompilerFlag was introduced in CMake 3.x. To be\n\t\t\t\t# compatible with older Cmake versions, we will check if this\n\t\t\t\t# module is present before we use it. Otherwise we will define\n\t\t\t\t# Fortran coverage support as not available.\n\t\t\t\tinclude(CheckFortranCompilerFlag OPTIONAL\n\t\t\t\t\tRESULT_VARIABLE INCLUDED)\n\t\t\t\tif (INCLUDED)\n\t\t\t\t\tcheck_fortran_compiler_flag(\"${FLAG}\"\n\t\t\t\t\t\tCOVERAGE_FLAG_DETECTED)\n\t\t\t\telseif (NOT CMAKE_REQUIRED_QUIET)\n\t\t\t\t\tmessage(\"-- Performing Test COVERAGE_FLAG_DETECTED\")\n\t\t\t\t\tmessage(\"-- Performing Test COVERAGE_FLAG_DETECTED - Failed\"\n\t\t\t\t\t\t\" (Check not supported)\")\n\t\t\t\tendif ()\n\t\t\tendif()\n\n\t\t\tif (COVERAGE_FLAG_DETECTED)\n\t\t\t\tset(COVERAGE_${COMPILER}_FLAGS \"${FLAG}\"\n\t\t\t\t\tCACHE STRING \"${COMPILER} flags for code coverage.\")\n\t\t\t\tmark_as_advanced(COVERAGE_${COMPILER}_FLAGS)\n\t\t\t\tbreak()\n\t\t\telse ()\n\t\t\t\tmessage(WARNING \"Code coverage is not available for ${COMPILER}\"\n\t\t\t\t        \" compiler. Targets using this compiler will be \"\n\t\t\t\t        \"compiled without it.\")\n\t\t\tendif ()\n\t\tendforeach ()\n\tendif ()\nendforeach ()\n\nset(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})\n\n\n\n\n# Helper function to get the language of a source file.\nfunction (codecov_lang_of_source FILE RETURN_VAR)\n\tget_filename_component(FILE_EXT \"${FILE}\" EXT)\n\tstring(TOLOWER \"${FILE_EXT}\" FILE_EXT)\n\tstring(SUBSTRING \"${FILE_EXT}\" 1 -1 FILE_EXT)\n\n\tget_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)\n\tforeach (LANG ${ENABLED_LANGUAGES})\n\t\tlist(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS \"${FILE_EXT}\" TEMP)\n\t\tif (NOT ${TEMP} EQUAL -1)\n\t\t\tset(${RETURN_VAR} \"${LANG}\" PARENT_SCOPE)\n\t\t\treturn()\n\t\tendif ()\n\tendforeach()\n\n\tset(${RETURN_VAR} \"\" PARENT_SCOPE)\nendfunction ()\n\n\n# Helper function to get the relative path of the source file destination path.\n# This path is needed by FindGcov and FindLcov cmake files to locate the\n# captured data.\nfunction (codecov_path_of_source FILE RETURN_VAR)\n\tstring(REGEX MATCH \"TARGET_OBJECTS:([^ >]+)\" _source ${FILE})\n\n\t# If expression was found, SOURCEFILE is a generator-expression for an\n\t# object library. Currently we found no way to call this function automatic\n\t# for the referenced target, so it must be called in the directoryso of the\n\t# object library definition.\n\tif (NOT \"${_source}\" STREQUAL \"\")\n\t\tset(${RETURN_VAR} \"\" PARENT_SCOPE)\n\t\treturn()\n\tendif ()\n\n\n\tstring(REPLACE \"${CMAKE_CURRENT_BINARY_DIR}/\" \"\" FILE \"${FILE}\")\n\tif(IS_ABSOLUTE ${FILE})\n\t\tfile(RELATIVE_PATH FILE ${CMAKE_CURRENT_SOURCE_DIR} ${FILE})\n\tendif()\n\n\t# get the right path for file\n\tstring(REPLACE \"..\" \"__\" PATH \"${FILE}\")\n\n\tset(${RETURN_VAR} \"${PATH}\" PARENT_SCOPE)\nendfunction()\n\n\n\n\n# Add coverage support for target ${TNAME} and register target for coverage\n# evaluation.\nfunction(add_coverage_target TNAME)\n\t# Check if all sources for target use the same compiler. If a target uses\n\t# e.g. C and Fortran mixed and uses different compilers (e.g. clang and\n\t# gfortran) this can trigger huge problems, because different compilers may\n\t# use different implementations for code coverage.\n\tget_target_property(TSOURCES ${TNAME} SOURCES)\n\tset(TARGET_COMPILER \"\")\n\tset(ADDITIONAL_FILES \"\")\n\tforeach (FILE ${TSOURCES})\n\t\t# If expression was found, FILE is a generator-expression for an object\n\t\t# library. Object libraries will be ignored.\n\t\tstring(REGEX MATCH \"TARGET_OBJECTS:([^ >]+)\" _file ${FILE})\n\t\tif (\"${_file}\" STREQUAL \"\")\n\t\t\tcodecov_lang_of_source(${FILE} LANG)\n\t\t\tif (LANG)\n\t\t\t\tlist(APPEND TARGET_COMPILER ${CMAKE_${LANG}_COMPILER_ID})\n\n\t\t\t\tlist(APPEND ADDITIONAL_FILES \"${FILE}.gcno\")\n\t\t\t\tlist(APPEND ADDITIONAL_FILES \"${FILE}.gcda\")\n\t\t\tendif ()\n\t\tendif ()\n\tendforeach ()\n\n\tlist(REMOVE_DUPLICATES TARGET_COMPILER)\n\tlist(LENGTH TARGET_COMPILER NUM_COMPILERS)\n\n\tif (NUM_COMPILERS GREATER 1)\n\t\tmessage(WARNING \"Can't use code coverage for target ${TNAME}, because \"\n\t\t        \"it will be compiled by incompatible compilers. Target will be \"\n\t\t        \"compiled without code coverage.\")\n\t\treturn()\n\n\telseif (NUM_COMPILERS EQUAL 0)\n\t\tmessage(WARNING \"Can't use code coverage for target ${TNAME}, because \"\n\t\t        \"it uses an unknown compiler. Target will be compiled without \"\n\t\t        \"code coverage.\")\n\t\treturn()\n\n\telseif (NOT DEFINED \"COVERAGE_${TARGET_COMPILER}_FLAGS\")\n\t\t# A warning has been printed before, so just return if flags for this\n\t\t# compiler aren't available.\n\t\treturn()\n\tendif()\n\n\n\t# enable coverage for target\n\tset_property(TARGET ${TNAME} APPEND_STRING\n\t\tPROPERTY COMPILE_FLAGS \" ${COVERAGE_${TARGET_COMPILER}_FLAGS}\")\n\tset_property(TARGET ${TNAME} APPEND_STRING\n\t\tPROPERTY LINK_FLAGS \" ${COVERAGE_${TARGET_COMPILER}_FLAGS}\")\n\n\n\t# Add gcov files generated by compiler to clean target.\n\tset(CLEAN_FILES \"\")\n\tforeach (FILE ${ADDITIONAL_FILES})\n\t\tcodecov_path_of_source(${FILE} FILE)\n\t\tlist(APPEND CLEAN_FILES \"CMakeFiles/${TNAME}.dir/${FILE}\")\n\tendforeach()\n\n\tset_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES\n\t\t\"${CLEAN_FILES}\")\n\n\n\tadd_gcov_target(${TNAME})\n\tadd_lcov_target(${TNAME})\nendfunction(add_coverage_target)\n\n\n\n\n# Include modules for parsing the collected data and output it in a readable\n# format (like gcov and lcov).\nfind_package(Gcov)\nfind_package(Lcov)\n"
  },
  {
    "path": "CMake/llvm-cov-wrapper",
    "content": "#!/bin/sh\n\n# This file is part of CMake-codecov.\n#\n# Copyright (c)\n#   2015-2017 RWTH Aachen University, Federal Republic of Germany\n#\n# See the LICENSE file in the package base directory for details\n#\n# Written by Alexander Haase, alexander.haase@rwth-aachen.de\n#\n\nif [ -z \"$LLVM_COV_BIN\" ]\nthen\n\techo \"LLVM_COV_BIN not set!\" >& 2\n\texit 1\nfi\n\n\n# Get LLVM version to find out.\nLLVM_VERSION=$($LLVM_COV_BIN -version | grep -i \"LLVM version\" \\\n\t| sed \"s/^\\([A-Za-z ]*\\)\\([0-9]\\).\\([0-9]\\).*$/\\2.\\3/g\")\n\nif [ \"$1\" = \"-v\" ]\nthen\n\techo \"llvm-cov-wrapper $LLVM_VERSION\"\n\texit 0\nfi\n\n\nif [ -n \"$LLVM_VERSION\" ]\nthen\n\tMAJOR=$(echo $LLVM_VERSION | cut -d'.' -f1)\n\tMINOR=$(echo $LLVM_VERSION | cut -d'.' -f2)\n\n\tif [ $MAJOR -eq 3 ] && [ $MINOR -le 4 ]\n\tthen\n\t\tif [ -f \"$1\" ]\n\t\tthen\n\t\t\tfilename=$(basename \"$1\")\n\t\t\textension=\"${filename##*.}\"\n\n\t\t\tcase \"$extension\" in\n\t\t\t\t\"gcno\") exec $LLVM_COV_BIN --gcno=\"$1\" ;;\n\t\t\t\t\"gcda\") exec $LLVM_COV_BIN --gcda=\"$1\" ;;\n\t\t\tesac\n\t\tfi\n\tfi\n\n\tif [ $MAJOR -eq 3 ] && [ $MINOR -le 5 ]\n\tthen\n\t\texec $LLVM_COV_BIN $@\n\tfi\nfi\n\nexec $LLVM_COV_BIN gcov $@\n"
  },
  {
    "path": "CMakeLists.txt",
    "content": "cmake_minimum_required(VERSION 3.8.2)\nproject(Clara)\n\nset(SOURCE_FILES src/main.cpp src/ClaraTests.cpp include/clara.hpp)\ninclude_directories( include third_party )\nadd_executable(ClaraTests ${SOURCE_FILES})\n\nif(USE_CPP14)\n    set_property(TARGET ClaraTests PROPERTY CXX_STANDARD 14)\n    message(STATUS \"Enabled C++14\")\nelseif(USE_CPP17)\n    set_property(TARGET ClaraTests PROPERTY CXX_STANDARD 17)\n    message(STATUS \"Enabled C++17\")\nelse(USE_CPP11)\n    set_property(TARGET ClaraTests PROPERTY CXX_STANDARD 11)\n    message(STATUS \"Enabled C++11\")\nendif()\n\nset_property(TARGET ClaraTests PROPERTY CXX_STANDARD_REQUIRED ON)\nset_property(TARGET ClaraTests PROPERTY CXX_EXTENSIONS OFF)\n\n\nif( CMAKE_CXX_COMPILER_ID MATCHES \"Clang|AppleClang|GNU\" )\n    target_compile_options( ClaraTests PRIVATE -Wall -Wextra -pedantic -Werror )\nendif()\nif( CMAKE_CXX_COMPILER_ID MATCHES \"MSVC\" )\n\ttarget_compile_options( ClaraTests PRIVATE /W4 /WX )\nendif()\n\nif (ENABLE_COVERAGE)\n    list(APPEND CMAKE_MODULE_PATH \"${CMAKE_CURRENT_LIST_DIR}/CMake\")\n    find_package(codecov)\n    add_coverage(ClaraTests)\n    list(APPEND LCOV_REMOVE_PATTERNS \"/usr/\")\n    coverage_evaluate()\nendif()\n\ninclude(CTest)\nadd_test(NAME RunTests COMMAND $<TARGET_FILE:ClaraTests>)\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.\n\n## Our Standards\n\nExamples of behavior that contributes to creating a positive environment include:\n\n* Using welcoming and inclusive language\n* Being respectful of differing viewpoints and experiences\n* Gracefully accepting constructive criticism\n* Focusing on what is best for the community\n* Showing empathy towards other community members\n\nExamples of unacceptable behavior by participants include:\n\n* The use of sexualized language or imagery and unwelcome sexual attention or advances\n* Trolling, insulting/derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or electronic address, without explicit permission\n* Other conduct which could reasonably be considered inappropriate in a professional setting\n\n## Our Responsibilities\n\nProject maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.\n\nProject maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.\n\n## Scope\n\nThis Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at clara@philnash.me. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.\n\nProject maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]\n\n[homepage]: http://contributor-covenant.org\n[version]: http://contributor-covenant.org/version/1/4/\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "Boost Software License - Version 1.0 - August 17th, 2003\n\nPermission is hereby granted, free of charge, to any person or organization\nobtaining a copy of the software and accompanying documentation covered by\nthis license (the \"Software\") to use, reproduce, display, distribute,\nexecute, and transmit the Software, and to prepare derivative works of the\nSoftware, and to permit third-parties to whom the Software is furnished to\ndo so, all subject to the following:\n\nThe copyright notices in the Software and this entire statement, including\nthe above license grant, this restriction and the following disclaimer,\nmust be included in all copies of the Software, in whole or in part, and\nall derivative works of the Software, unless such copies or derivative\nworks are solely in the form of machine-executable object code generated by\na source language processor.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT\nSHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE\nFOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# Clara v1.1.5\n[![Build Status](https://travis-ci.org/catchorg/Clara.svg?branch=master)](https://travis-ci.org/catchorg/Clara)\n[![Build status](https://ci.appveyor.com/api/projects/status/github/catchorg/Clara?brach=master&svg=true)](https://ci.appveyor.com/project/catchorg/clara)\n[![codecov](https://codecov.io/gh/catchorg/Clara/branch/master/graph/badge.svg)](https://codecov.io/gh/catchorg/Clara)\n\n# !! This repository is unmaintained. Go [here](https://github.com/bfgroup/Lyra) for a fork that is somewhat maintained. !!\n\n-----------------------------\n\n\nA simple to use, composable, command line parser for C++ 11 and beyond.\n\nClara is a single-header library.\n\nTo use, just `#include \"clara.hpp\"`\n\nA parser for a single option can be created like this:\n\n```c++\nint width = 0;\n// ...\nusing namespace clara;\nauto cli\n    = Opt( width, \"width\" )\n        [\"-w\"][\"--width\"]\n        (\"How wide should it be?\");\n```\n\nYou can use this parser directly like this:\n\n```c++\nauto result = cli.parse( Args( argc, argv ) );\nif( !result ) {\n    std::cerr << \"Error in command line: \" << result.errorMessage() << std::endl;\n    exit(1);\n}\n\n// Everything was ok, width will have a value if supplied on command line\n```\n\nNote that exceptions are not used for error handling.\n\nYou can combine parsers by composing with `|`, like this:\n\n```c++\nint width = 0;\nstd::string name;\nbool doIt = false;\nstd::string command;\nauto cli\n    = Opt( width, \"width\" )\n        [\"-w\"][\"--width\"]\n        (\"How wide should it be?\")\n    | Opt( name, \"name\" )\n        [\"-n\"][\"--name\"]\n        (\"By what name should I be known\")\n    | Opt( doIt )\n        [\"-d\"][\"--doit\"]\n        (\"Do the thing\" )\n    | Arg( command, \"command\" )\n        (\"which command to run\");\n```\n\n`Opt`s specify options that start with a short dash (`-`) or long dash (`--`).\nOn Windows forward slashes are also accepted (and automatically interpretted as a short dash).\nOptions can be argument taking (such as `-w 42`), in which case the `Opt` takes a second argument - a hint,\nor they are pure flags (such as `-d`), in which case the `Opt` has only one argument - which must be a boolean.\nThe option names are provided in one or more sets of square brackets, and a description string can\nbe provided in parentheses. The first argument to an `Opt` is any variable, local, global member, of any type\nthat can be converted from a string using `std::ostream`.\n\n`Arg`s specify arguments that are not tied to options, and so have no square bracket names. They otherwise work just like `Opt`s.\n\nA, console optimised, usage string can be obtained by inserting the parser into a stream.\nThe usage string is built from the information supplied and is formatted for the console width.\n\nAs a convenience, the standard help options (`-h`, `--help` and `-?`) can be specified using the `Help` parser,\nwhich just takes a boolean to bind to.\n\nFor more usage please see the unit tests or look at how it is used in the Catch code-base (catch-lib.net).\nFuller documentation will be coming soon.\n\nSome of the key features:\n\n- A single header file with no external dependencies (except the std library).\n- Define your interface once to get parsing, type conversions and usage strings with no redundancy.\n- Composable. Each `Opt` or `Arg` is an independent parser. Combine these to produce a composite parser - this can be done in stages across multiple function calls - or even projects.\n- Bind parsers directly to variables that will receive the results of the parse - no intermediate dictionaries to worry about.\n- Or can also bind parsers to lambdas for more custom handling.\n- Deduces types from bound variables or lambdas and performs type conversions (via `ostream <<`), with error handling, behind the scenes.\n- Bind parsers to vectors for args that can have multiple values.\n- Uses Result types for error propagation, rather than exceptions (doesn't yet build with exceptions disabled, but that will be coming later)\n- Models POSIX standards for short and long opt behaviour.\n\n## Roadmap\n\nTo see which direction Clara is going in, please see [the roadmap](Roadmap.md)\n\n## Old version\n\nIf you used the earlier, v0.x, version of Clara please note that this is a complete rewrite which assumes C++11 and has\na different interface (composability was a big step forward). Conversion between v0.x and v1.x is a fairly simple and mechanical task, but is a bit of manual\nwork - so don't take this version until you're ready (and, of course, able to use C++11).\n\nI hope you'll find the new interface an improvement - and this will be built on to offer new features moving forwards.\nI don't expect to maintain v0.x any further, but it remains on a branch.\n"
  },
  {
    "path": "Roadmap.md",
    "content": "# Roadmap\n\n## June 2019 Update\n\nPreviously this roadmap said, \"I'm not quite ready to throw development fully open to the community effort\". The intention had been to clarify the direction in the codebase in some key areas, as many of the PRs were taking it in different directions.\n\nUnfortunuately the time intended for working on this has not appeared and this project has languished in neglect as a result. I should have acknowledged that sooner, but as of now I (@philsquared), am opening this up fully to the community (anyone who is still interested). That means, of course, that maintainers such as @horenmar, will be able to merge PRs as they see fit (as well as make any other changes). It also means that we'd be keen to hear from anyone that wants to take the lead in maintaining and evolving the library.\n\nPersonally, I still hope to contribute further to the project, but am no longer in a position I can commit to leading it.\n\nHere are the items I had on the original roadmap, for reference. It is not a hard requirement to follow them:\n\n- Add more documentation (includes [#49](https://github.com/catchorg/Clara/issues/49))\n- Finish work on \"required\" parsers [#39](https://github.com/catchorg/Clara/issues/39), [#16](https://github.com/catchorg/Clara/issues/16) & [PR #28](https://github.com/catchorg/Clara/pull/28)\n- Finish work on removing exceptions completely (or making them \"optional\")\n- (compiler conditional) Support for `std::optional` and maybe other optional types (e.g. boost) [#4](https://github.com/catchorg/Clara/issues/4) & [PR #45](https://github.com/catchorg/Clara/pull/45) - this is mostly, if not entirely, implemented. Should be checked, and #4 closed if so.\n- Arg\\[0] support on Windows [#29](https://github.com/catchorg/Clara/issues/29)\n- config files and environment variables\n- \"hidden\" options [#29](https://github.com/catchorg/Clara/issues/29)\n- Capture general text for help output [#48]((https://github.com/catchorg/Clara/issues/48)\n- subcommands [#31](https://github.com/catchorg/Clara/issues/31) (I actually have a design mostly done for this) - but see also [PR #32](https://github.com/catchorg/Clara/pull/32)\n\n---\n\n"
  },
  {
    "path": "appveyor.yml",
    "content": "version: \"{build}\"\n\nbranches:\n  except:\n    - /dev-travis.+/\n\nos:\n  - Visual Studio 2017\n  - Visual Studio 2015\n\nenvironment:\n    matrix:\n        - additional_flags: \"/permissive- /std:c++latest\"\n        - additional_flags: \"\"\n\nmatrix:\n    exclude:\n        - os: Visual Studio 2015\n          additional_flags: \"/permissive- /std:c++latest\"\n\ninit:\n  - git config --global core.autocrlf input\n\ninstall:\n  - ps: if (($env:CONFIGURATION) -eq \"Debug\" ) { python -m pip --disable-pip-version-check install codecov }\n  - ps: if (($env:CONFIGURATION) -eq \"Debug\" ) { .\\misc\\installOpenCppCoverage.ps1 }\n\n# Win32 and x64 are CMake-compatible solution platform names.\n# This allows us to pass %PLATFORM% to CMake -A.\nplatform:\n  - Win32\n  - x64\n\n# build Configurations, i.e. Debug, Release, etc.\nconfiguration:\n  - Debug\n  - Release\n\n#Cmake will autodetect the compiler, but we set the arch\nbefore_build:\n  - set CXXFLAGS=%additional_flags%\n  # Indirection because appveyor doesn't handle multiline batch scripts properly\n  # https://stackoverflow.com/questions/37627248/how-to-split-a-command-over-multiple-lines-in-appveyor-yml/37647169#37647169\n  # https://help.appveyor.com/discussions/questions/3888-multi-line-cmd-or-powershell-warning-ignore\n  - cmd: .\\misc\\appveyorBuildConfigurationScript.bat\n\n  \n# build with MSBuild\nbuild:\n  project: Build\\Clara.sln              # path to Visual Studio solution or project\n  parallel: true                        # enable MSBuild parallel builds\n  verbosity: normal                     # MSBuild verbosity level {quiet|minimal|normal|detailed}\n\ntest_script:\n  - set CTEST_OUTPUT_ON_FAILURE=1\n  - cmd: .\\misc\\appveyorTestRunScript.bat\n"
  },
  {
    "path": "codecov.yml",
    "content": "codecov:\n  branch: master\n\ncoverage:\n  ignore:\n    - \"src/*\"\n    - \"third_party/catch.hpp\"\n"
  },
  {
    "path": "docs/release-notes.md",
    "content": "<a id=\"top\"></a>\n\n# 1.1.3\n\n## Improvements\n* `Args` now take arguments as `int argc, char const * const * argv`.\n  * This allows the use of string literals for arguments\n\n\n# 1.1.2\n* Fix usage of `dynamic_cast` preventing Clara being used with `-fno-rtti`\n\n\n# Older versions (1.1.1 and earlier)\n\nNo release notes have been kept (Maybe some of it will be backfilled later)\n"
  },
  {
    "path": "include/clara.hpp",
    "content": "// Copyright 2017 Two Blue Cubes Ltd. All rights reserved.\n//\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n//\n// See https://github.com/philsquared/Clara for more details\n\n// Clara v1.1.5\n\n#ifndef CLARA_HPP_INCLUDED\n#define CLARA_HPP_INCLUDED\n\n#ifndef CLARA_CONFIG_CONSOLE_WIDTH\n#define CLARA_CONFIG_CONSOLE_WIDTH 80\n#endif\n\n#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CLARA_CONFIG_CONSOLE_WIDTH\n#endif\n\n#ifndef CLARA_CONFIG_OPTIONAL_TYPE\n#   ifdef __has_include\n#       if __has_include(<optional>) && __cplusplus >= 201703L\n#           include <optional>\n#           define CLARA_CONFIG_OPTIONAL_TYPE std::optional\n#       endif\n#   endif\n#endif\n\n#include \"clara_textflow.hpp\"\n\n#include <cctype>\n#include <vector>\n#include <memory>\n#include <sstream>\n#include <cassert>\n#include <set>\n#include <algorithm>\n\n#if !defined(CLARA_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )\n#define CLARA_PLATFORM_WINDOWS\n#endif\n\nnamespace clara {\nnamespace detail {\n\n    // Traits for extracting arg and return type of lambdas (for single argument lambdas)\n    template<typename L>\n    struct UnaryLambdaTraits : UnaryLambdaTraits<decltype( &L::operator() )> {};\n\n    template<typename ClassT, typename ReturnT, typename... Args>\n    struct UnaryLambdaTraits<ReturnT( ClassT::* )( Args... ) const> {\n        static const bool isValid = false;\n    };\n\n    template<typename ClassT, typename ReturnT, typename ArgT>\n    struct UnaryLambdaTraits<ReturnT( ClassT::* )( ArgT ) const> {\n        static const bool isValid = true;\n        using ArgType = typename std::remove_const<typename std::remove_reference<ArgT>::type>::type;\n        using ReturnType = ReturnT;\n    };\n\n    class TokenStream;\n\n    // Transport for raw args (copied from main args, or supplied via init list for testing)\n    class Args {\n        friend TokenStream;\n        std::string m_exeName;\n        std::vector<std::string> m_args;\n\n    public:\n        Args( int argc, char const* const* argv )\n            : m_exeName(argv[0]),\n              m_args(argv + 1, argv + argc) {}\n\n        Args( std::initializer_list<std::string> args )\n        :   m_exeName( *args.begin() ),\n            m_args( args.begin()+1, args.end() )\n        {}\n\n        auto exeName() const -> std::string {\n            return m_exeName;\n        }\n    };\n\n    // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string\n    // may encode an option + its argument if the : or = form is used\n    enum class TokenType {\n        Option, Argument\n    };\n    struct Token {\n        TokenType type;\n        std::string token;\n    };\n\n    inline auto isOptPrefix( char c ) -> bool {\n        return c == '-'\n#ifdef CLARA_PLATFORM_WINDOWS\n            || c == '/'\n#endif\n        ;\n    }\n\n    // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled\n    class TokenStream {\n        using Iterator = std::vector<std::string>::const_iterator;\n        Iterator it;\n        Iterator itEnd;\n        std::vector<Token> m_tokenBuffer;\n\n        void loadBuffer() {\n            m_tokenBuffer.resize( 0 );\n\n            // Skip any empty strings\n            while( it != itEnd && it->empty() )\n                ++it;\n\n            if( it != itEnd ) {\n                auto const &next = *it;\n                if( isOptPrefix( next[0] ) ) {\n                    auto delimiterPos = next.find_first_of( \" :=\" );\n                    if( delimiterPos != std::string::npos ) {\n                        m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } );\n                        m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } );\n                    } else {\n                        if( next[1] != '-' && next.size() > 2 ) {\n                            std::string opt = \"- \";\n                            for( size_t i = 1; i < next.size(); ++i ) {\n                                opt[1] = next[i];\n                                m_tokenBuffer.push_back( { TokenType::Option, opt } );\n                            }\n                        } else {\n                            m_tokenBuffer.push_back( { TokenType::Option, next } );\n                        }\n                    }\n                } else {\n                    m_tokenBuffer.push_back( { TokenType::Argument, next } );\n                }\n            }\n        }\n\n    public:\n        explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {}\n\n        TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) {\n            loadBuffer();\n        }\n\n        explicit operator bool() const {\n            return !m_tokenBuffer.empty() || it != itEnd;\n        }\n\n        auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); }\n\n        auto operator*() const -> Token {\n            assert( !m_tokenBuffer.empty() );\n            return m_tokenBuffer.front();\n        }\n\n        auto operator->() const -> Token const * {\n            assert( !m_tokenBuffer.empty() );\n            return &m_tokenBuffer.front();\n        }\n\n        auto operator++() -> TokenStream & {\n            if( m_tokenBuffer.size() >= 2 ) {\n                m_tokenBuffer.erase( m_tokenBuffer.begin() );\n            } else {\n                if( it != itEnd )\n                    ++it;\n                loadBuffer();\n            }\n            return *this;\n        }\n    };\n\n\n    class ResultBase {\n    public:\n        enum Type {\n            Ok, LogicError, RuntimeError\n        };\n\n    protected:\n        ResultBase( Type type ) : m_type( type ) {}\n        virtual ~ResultBase() = default;\n\n        virtual void enforceOk() const = 0;\n\n        Type m_type;\n    };\n\n    template<typename T>\n    class ResultValueBase : public ResultBase {\n    public:\n        auto value() const -> T const & {\n            enforceOk();\n            return m_value;\n        }\n\n    protected:\n        ResultValueBase( Type type ) : ResultBase( type ) {}\n\n        ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) {\n            if( m_type == ResultBase::Ok )\n                new( &m_value ) T( other.m_value );\n        }\n\n        ResultValueBase( Type, T const &value ) : ResultBase( Ok ) {\n            new( &m_value ) T( value );\n        }\n\n        auto operator=( ResultValueBase const &other ) -> ResultValueBase & {\n            if( m_type == ResultBase::Ok )\n                m_value.~T();\n            ResultBase::operator=(other);\n            if( m_type == ResultBase::Ok )\n                new( &m_value ) T( other.m_value );\n            return *this;\n        }\n\n        ~ResultValueBase() override {\n            if( m_type == Ok )\n                m_value.~T();\n        }\n\n        union {\n            T m_value;\n        };\n    };\n\n    template<>\n    class ResultValueBase<void> : public ResultBase {\n    protected:\n        using ResultBase::ResultBase;\n    };\n\n    template<typename T = void>\n    class BasicResult : public ResultValueBase<T> {\n    public:\n        template<typename U>\n        explicit BasicResult( BasicResult<U> const &other )\n        :   ResultValueBase<T>( other.type() ),\n            m_errorMessage( other.errorMessage() )\n        {\n            assert( type() != ResultBase::Ok );\n        }\n\n        template<typename U>\n        static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; }\n        static auto ok() -> BasicResult { return { ResultBase::Ok }; }\n        static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; }\n        static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; }\n\n        explicit operator bool() const { return m_type == ResultBase::Ok; }\n        auto type() const -> ResultBase::Type { return m_type; }\n        auto errorMessage() const -> std::string { return m_errorMessage; }\n\n    protected:\n        void enforceOk() const override {\n\n            // Errors shouldn't reach this point, but if they do\n            // the actual error message will be in m_errorMessage\n            assert( m_type != ResultBase::LogicError );\n            assert( m_type != ResultBase::RuntimeError );\n            if( m_type != ResultBase::Ok )\n                std::abort();\n        }\n\n        std::string m_errorMessage; // Only populated if resultType is an error\n\n        BasicResult( ResultBase::Type type, std::string const &message )\n        :   ResultValueBase<T>(type),\n            m_errorMessage(message)\n        {\n            assert( m_type != ResultBase::Ok );\n        }\n\n        using ResultValueBase<T>::ResultValueBase;\n        using ResultBase::m_type;\n    };\n\n    enum class ParseResultType {\n        Matched, NoMatch, ShortCircuitAll, ShortCircuitSame\n    };\n\n    class ParseState {\n    public:\n\n        ParseState( ParseResultType type, TokenStream const &remainingTokens )\n        : m_type(type),\n          m_remainingTokens( remainingTokens )\n        {}\n\n        auto type() const -> ParseResultType { return m_type; }\n        auto remainingTokens() const -> TokenStream { return m_remainingTokens; }\n\n    private:\n        ParseResultType m_type;\n        TokenStream m_remainingTokens;\n    };\n\n    using Result = BasicResult<void>;\n    using ParserResult = BasicResult<ParseResultType>;\n    using InternalParseResult = BasicResult<ParseState>;\n\n    struct HelpColumns {\n        std::string left;\n        std::string right;\n    };\n\n    template<typename T>\n    inline auto convertInto( std::string const &source, T& target ) -> ParserResult {\n        std::stringstream ss;\n        ss << source;\n        ss >> target;\n        if( ss.fail() )\n            return ParserResult::runtimeError( \"Unable to convert '\" + source + \"' to destination type\" );\n        else\n            return ParserResult::ok( ParseResultType::Matched );\n    }\n    inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult {\n        target = source;\n        return ParserResult::ok( ParseResultType::Matched );\n    }\n    inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {\n        std::string srcLC = source;\n        std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( std::tolower(c) ); } );\n        if (srcLC == \"y\" || srcLC == \"1\" || srcLC == \"true\" || srcLC == \"yes\" || srcLC == \"on\")\n            target = true;\n        else if (srcLC == \"n\" || srcLC == \"0\" || srcLC == \"false\" || srcLC == \"no\" || srcLC == \"off\")\n            target = false;\n        else\n            return ParserResult::runtimeError( \"Expected a boolean value but did not recognise: '\" + source + \"'\" );\n        return ParserResult::ok( ParseResultType::Matched );\n    }\n#ifdef CLARA_CONFIG_OPTIONAL_TYPE\n    template<typename T>\n    inline auto convertInto( std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE<T>& target ) -> ParserResult {\n        T temp;\n        auto result = convertInto( source, temp );\n        if( result )\n            target = std::move(temp);\n        return result;\n    }\n#endif // CLARA_CONFIG_OPTIONAL_TYPE\n\n    struct NonCopyable {\n        NonCopyable() = default;\n        NonCopyable( NonCopyable const & ) = delete;\n        NonCopyable( NonCopyable && ) = delete;\n        NonCopyable &operator=( NonCopyable const & ) = delete;\n        NonCopyable &operator=( NonCopyable && ) = delete;\n    };\n\n    struct BoundRef : NonCopyable {\n        virtual ~BoundRef() = default;\n        virtual auto isContainer() const -> bool { return false; }\n        virtual auto isFlag() const -> bool { return false; }\n    };\n    struct BoundValueRefBase : BoundRef {\n        virtual auto setValue( std::string const &arg ) -> ParserResult = 0;\n    };\n    struct BoundFlagRefBase : BoundRef {\n        virtual auto setFlag( bool flag ) -> ParserResult = 0;\n        virtual auto isFlag() const -> bool { return true; }\n    };\n\n    template<typename T>\n    struct BoundValueRef : BoundValueRefBase {\n        T &m_ref;\n\n        explicit BoundValueRef( T &ref ) : m_ref( ref ) {}\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            return convertInto( arg, m_ref );\n        }\n    };\n\n    template<typename T>\n    struct BoundValueRef<std::vector<T>> : BoundValueRefBase {\n        std::vector<T> &m_ref;\n\n        explicit BoundValueRef( std::vector<T> &ref ) : m_ref( ref ) {}\n\n        auto isContainer() const -> bool override { return true; }\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            T temp;\n            auto result = convertInto( arg, temp );\n            if( result )\n                m_ref.push_back( temp );\n            return result;\n        }\n    };\n\n    struct BoundFlagRef : BoundFlagRefBase {\n        bool &m_ref;\n\n        explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {}\n\n        auto setFlag( bool flag ) -> ParserResult override {\n            m_ref = flag;\n            return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    template<typename ReturnType>\n    struct LambdaInvoker {\n        static_assert( std::is_same<ReturnType, ParserResult>::value, \"Lambda must return void or clara::ParserResult\" );\n\n        template<typename L, typename ArgType>\n        static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {\n            return lambda( arg );\n        }\n    };\n\n    template<>\n    struct LambdaInvoker<void> {\n        template<typename L, typename ArgType>\n        static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {\n            lambda( arg );\n            return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    template<typename ArgType, typename L>\n    inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult {\n        ArgType temp{};\n        auto result = convertInto( arg, temp );\n        return !result\n           ? result\n           : LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( lambda, temp );\n    }\n\n\n    template<typename L>\n    struct BoundLambda : BoundValueRefBase {\n        L m_lambda;\n\n        static_assert( UnaryLambdaTraits<L>::isValid, \"Supplied lambda must take exactly one argument\" );\n        explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {}\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            return invokeLambda<typename UnaryLambdaTraits<L>::ArgType>( m_lambda, arg );\n        }\n    };\n\n    template<typename L>\n    struct BoundFlagLambda : BoundFlagRefBase {\n        L m_lambda;\n\n        static_assert( UnaryLambdaTraits<L>::isValid, \"Supplied lambda must take exactly one argument\" );\n        static_assert( std::is_same<typename UnaryLambdaTraits<L>::ArgType, bool>::value, \"flags must be boolean\" );\n\n        explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {}\n\n        auto setFlag( bool flag ) -> ParserResult override {\n            return LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( m_lambda, flag );\n        }\n    };\n\n    enum class Optionality { Optional, Required };\n\n    struct Parser;\n\n    class ParserBase {\n    public:\n        virtual ~ParserBase() = default;\n        virtual auto validate() const -> Result { return Result::ok(); }\n        virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult  = 0;\n        virtual auto cardinality() const -> size_t { return 1; }\n\n        auto parse( Args const &args ) const -> InternalParseResult {\n            return parse( args.exeName(), TokenStream( args ) );\n        }\n    };\n\n    template<typename DerivedT>\n    class ComposableParserImpl : public ParserBase {\n    public:\n        template<typename T>\n        auto operator|( T const &other ) const -> Parser;\n\n\t\ttemplate<typename T>\n        auto operator+( T const &other ) const -> Parser;\n    };\n\n    // Common code and state for Args and Opts\n    template<typename DerivedT>\n    class ParserRefImpl : public ComposableParserImpl<DerivedT> {\n    protected:\n        Optionality m_optionality = Optionality::Optional;\n        std::shared_ptr<BoundRef> m_ref;\n        std::string m_hint;\n        std::string m_description;\n\n        explicit ParserRefImpl( std::shared_ptr<BoundRef> const &ref ) : m_ref( ref ) {}\n\n    public:\n        template<typename T>\n        ParserRefImpl( T &ref, std::string const &hint )\n        :   m_ref( std::make_shared<BoundValueRef<T>>( ref ) ),\n            m_hint( hint )\n        {}\n\n        template<typename LambdaT>\n        ParserRefImpl( LambdaT const &ref, std::string const &hint )\n        :   m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),\n            m_hint(hint)\n        {}\n\n        auto operator()( std::string const &description ) -> DerivedT & {\n            m_description = description;\n            return static_cast<DerivedT &>( *this );\n        }\n\n        auto optional() -> DerivedT & {\n            m_optionality = Optionality::Optional;\n            return static_cast<DerivedT &>( *this );\n        };\n\n        auto required() -> DerivedT & {\n            m_optionality = Optionality::Required;\n            return static_cast<DerivedT &>( *this );\n        };\n\n        auto isOptional() const -> bool {\n            return m_optionality == Optionality::Optional;\n        }\n\n        auto cardinality() const -> size_t override {\n            if( m_ref->isContainer() )\n                return 0;\n            else\n                return 1;\n        }\n\n        auto hint() const -> std::string { return m_hint; }\n    };\n\n    class ExeName : public ComposableParserImpl<ExeName> {\n        std::shared_ptr<std::string> m_name;\n        std::shared_ptr<BoundValueRefBase> m_ref;\n\n        template<typename LambdaT>\n        static auto makeRef(LambdaT const &lambda) -> std::shared_ptr<BoundValueRefBase> {\n            return std::make_shared<BoundLambda<LambdaT>>( lambda) ;\n        }\n\n    public:\n        ExeName() : m_name( std::make_shared<std::string>( \"<executable>\" ) ) {}\n\n        explicit ExeName( std::string &ref ) : ExeName() {\n            m_ref = std::make_shared<BoundValueRef<std::string>>( ref );\n        }\n\n        template<typename LambdaT>\n        explicit ExeName( LambdaT const& lambda ) : ExeName() {\n            m_ref = std::make_shared<BoundLambda<LambdaT>>( lambda );\n        }\n\n        // The exe name is not parsed out of the normal tokens, but is handled specially\n        auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {\n            return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );\n        }\n\n        auto name() const -> std::string { return *m_name; }\n        auto set( std::string const& newName ) -> ParserResult {\n\n            auto lastSlash = newName.find_last_of( \"\\\\/\" );\n            auto filename = ( lastSlash == std::string::npos )\n                    ? newName\n                    : newName.substr( lastSlash+1 );\n\n            *m_name = filename;\n            if( m_ref )\n                return m_ref->setValue( filename );\n            else\n                return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    class Arg : public ParserRefImpl<Arg> {\n    public:\n        using ParserRefImpl::ParserRefImpl;\n\n        auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override {\n            auto validationResult = validate();\n            if( !validationResult )\n                return InternalParseResult( validationResult );\n\n            auto remainingTokens = tokens;\n            auto const &token = *remainingTokens;\n            if( token.type != TokenType::Argument )\n                return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );\n\n            assert( !m_ref->isFlag() );\n            auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );\n\n            auto result = valueRef->setValue( remainingTokens->token );\n            if( !result )\n                return InternalParseResult( result );\n            else\n                return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );\n        }\n    };\n\n    inline auto normaliseOpt( std::string const &optName ) -> std::string {\n#ifdef CLARA_PLATFORM_WINDOWS\n        if( optName[0] == '/' )\n            return \"-\" + optName.substr( 1 );\n        else\n#endif\n            return optName;\n    }\n\n    class Opt : public ParserRefImpl<Opt> {\n    protected:\n        std::vector<std::string> m_optNames;\n\n    public:\n        template<typename LambdaT>\n        explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared<BoundFlagLambda<LambdaT>>( ref ) ) {}\n\n        explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared<BoundFlagRef>( ref ) ) {}\n\n        template<typename LambdaT>\n        Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}\n\n        template<typename T>\n        Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}\n\n        auto operator[]( std::string const &optName ) -> Opt & {\n            m_optNames.push_back( optName );\n            return *this;\n        }\n\n        auto getHelpColumns() const -> std::vector<HelpColumns> {\n            std::ostringstream oss;\n            bool first = true;\n            for( auto const &opt : m_optNames ) {\n                if (first)\n                    first = false;\n                else\n                    oss << \", \";\n                oss << opt;\n            }\n            if( !m_hint.empty() )\n                oss << \" <\" << m_hint << \">\";\n            return { { oss.str(), m_description } };\n        }\n\n        auto isMatch( std::string const &optToken ) const -> bool {\n            auto normalisedToken = normaliseOpt( optToken );\n            for( auto const &name : m_optNames ) {\n                if( normaliseOpt( name ) == normalisedToken )\n                    return true;\n            }\n            return false;\n        }\n\n        using ParserBase::parse;\n\n        auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {\n            auto validationResult = validate();\n            if( !validationResult )\n                return InternalParseResult( validationResult );\n\n            auto remainingTokens = tokens;\n            if( remainingTokens && remainingTokens->type == TokenType::Option ) {\n                auto const &token = *remainingTokens;\n                if( isMatch(token.token ) ) {\n                    if( m_ref->isFlag() ) {\n                        auto flagRef = static_cast<detail::BoundFlagRefBase*>( m_ref.get() );\n                        auto result = flagRef->setFlag( true );\n                        if( !result )\n                            return InternalParseResult( result );\n                        if( result.value() == ParseResultType::ShortCircuitAll )\n                            return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );\n                    } else {\n                        auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );\n                        ++remainingTokens;\n                        if( !remainingTokens )\n                            return InternalParseResult::runtimeError( \"Expected argument following \" + token.token );\n                        auto const &argToken = *remainingTokens;\n                        if( argToken.type != TokenType::Argument )\n                            return InternalParseResult::runtimeError( \"Expected argument following \" + token.token );\n                        auto result = valueRef->setValue( argToken.token );\n                        if( !result )\n                            return InternalParseResult( result );\n                        if( result.value() == ParseResultType::ShortCircuitAll )\n                            return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );\n                    }\n                    return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );\n                }\n            }\n            return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );\n        }\n\n        auto validate() const -> Result override {\n            if( m_optNames.empty() )\n                return Result::logicError( \"No options supplied to Opt\" );\n            for( auto const &name : m_optNames ) {\n                if( name.empty() )\n                    return Result::logicError( \"Option name cannot be empty\" );\n#ifdef CLARA_PLATFORM_WINDOWS\n                if( name[0] != '-' && name[0] != '/' )\n                    return Result::logicError( \"Option name must begin with '-' or '/'\" );\n#else\n                if( name[0] != '-' )\n                    return Result::logicError( \"Option name must begin with '-'\" );\n#endif\n            }\n            return ParserRefImpl::validate();\n        }\n    };\n\n    struct Help : Opt {\n        Help( bool &showHelpFlag )\n        :   Opt([&]( bool flag ) {\n                showHelpFlag = flag;\n                return ParserResult::ok( ParseResultType::ShortCircuitAll );\n            })\n        {\n            static_cast<Opt &>( *this )\n                    (\"display usage information\")\n                    [\"-?\"][\"-h\"][\"--help\"]\n                    .optional();\n        }\n    };\n\n\n    struct Parser : ParserBase {\n\n        mutable ExeName m_exeName;\n        std::vector<Opt> m_options;\n        std::vector<Arg> m_args;\n\n        auto operator|=( ExeName const &exeName ) -> Parser & {\n            m_exeName = exeName;\n            return *this;\n        }\n\n        auto operator|=( Arg const &arg ) -> Parser & {\n            m_args.push_back(arg);\n            return *this;\n        }\n\n        auto operator|=( Opt const &opt ) -> Parser & {\n            m_options.push_back(opt);\n            return *this;\n        }\n\n        auto operator|=( Parser const &other ) -> Parser & {\n            m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end());\n            m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end());\n            return *this;\n        }\n\n        template<typename T>\n        auto operator|( T const &other ) const -> Parser {\n            return Parser( *this ) |= other;\n        }\n\n        // Forward deprecated interface with '+' instead of '|'\n        template<typename T>\n        auto operator+=( T const &other ) -> Parser & { return operator|=( other ); }\n        template<typename T>\n        auto operator+( T const &other ) const -> Parser { return operator|( other ); }\n\n        auto getHelpColumns() const -> std::vector<HelpColumns> {\n            std::vector<HelpColumns> cols;\n            for (auto const &o : m_options) {\n                auto childCols = o.getHelpColumns();\n                cols.insert( cols.end(), childCols.begin(), childCols.end() );\n            }\n            return cols;\n        }\n\n        void writeToStream( std::ostream &os ) const {\n            if (!m_exeName.name().empty()) {\n                os << \"usage:\\n\" << \"  \" << m_exeName.name() << \" \";\n                bool required = true, first = true;\n                for( auto const &arg : m_args ) {\n                    if (first)\n                        first = false;\n                    else\n                        os << \" \";\n                    if( arg.isOptional() && required ) {\n                        os << \"[\";\n                        required = false;\n                    }\n                    os << \"<\" << arg.hint() << \">\";\n                    if( arg.cardinality() == 0 )\n                        os << \" ... \";\n                }\n                if( !required )\n                    os << \"]\";\n                if( !m_options.empty() )\n                    os << \" options\";\n                os << \"\\n\\nwhere options are:\" << std::endl;\n            }\n\n            auto rows = getHelpColumns();\n            size_t consoleWidth = CLARA_CONFIG_CONSOLE_WIDTH;\n            size_t optWidth = 0;\n            for( auto const &cols : rows )\n                optWidth = (std::max)(optWidth, cols.left.size() + 2);\n\n            optWidth = (std::min)(optWidth, consoleWidth/2);\n\n            for( auto const &cols : rows ) {\n                auto row =\n                        TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) +\n                        TextFlow::Spacer(4) +\n                        TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth );\n                os << row << std::endl;\n            }\n        }\n\n        friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& {\n            parser.writeToStream( os );\n            return os;\n        }\n\n        auto validate() const -> Result override {\n            for( auto const &opt : m_options ) {\n                auto result = opt.validate();\n                if( !result )\n                    return result;\n            }\n            for( auto const &arg : m_args ) {\n                auto result = arg.validate();\n                if( !result )\n                    return result;\n            }\n            return Result::ok();\n        }\n\n        using ParserBase::parse;\n\n        auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override {\n\n            struct ParserInfo {\n                ParserBase const* parser = nullptr;\n                size_t count = 0;\n            };\n            const size_t totalParsers = m_options.size() + m_args.size();\n            assert( totalParsers < 512 );\n            // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do\n            ParserInfo parseInfos[512];\n\n            {\n                size_t i = 0;\n                for (auto const &opt : m_options) parseInfos[i++].parser = &opt;\n                for (auto const &arg : m_args) parseInfos[i++].parser = &arg;\n            }\n\n            m_exeName.set( exeName );\n\n            auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );\n            while( result.value().remainingTokens() ) {\n                bool tokenParsed = false;\n\n                for( size_t i = 0; i < totalParsers; ++i ) {\n                    auto&  parseInfo = parseInfos[i];\n                    if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) {\n                        result = parseInfo.parser->parse(exeName, result.value().remainingTokens());\n                        if (!result)\n                            return result;\n                        if (result.value().type() != ParseResultType::NoMatch) {\n                            tokenParsed = true;\n                            ++parseInfo.count;\n                            break;\n                        }\n                    }\n                }\n\n                if( result.value().type() == ParseResultType::ShortCircuitAll )\n                    return result;\n                if( !tokenParsed )\n                    return InternalParseResult::runtimeError( \"Unrecognised token: \" + result.value().remainingTokens()->token );\n            }\n            // !TBD Check missing required options\n            return result;\n        }\n    };\n\n    template<typename DerivedT>\n    template<typename T>\n    auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {\n        return Parser() | static_cast<DerivedT const &>( *this ) | other;\n    }\n} // namespace detail\n\n\n// A Combined parser\nusing detail::Parser;\n\n// A parser for options\nusing detail::Opt;\n\n// A parser for arguments\nusing detail::Arg;\n\n// Wrapper for argc, argv from main()\nusing detail::Args;\n\n// Specifies the name of the executable\nusing detail::ExeName;\n\n// Convenience wrapper for option parser that specifies the help option\nusing detail::Help;\n\n// enum of result types from a parse\nusing detail::ParseResultType;\n\n// Result type for parser operation\nusing detail::ParserResult;\n\n\n} // namespace clara\n\n#endif // CLARA_HPP_INCLUDED\n"
  },
  {
    "path": "include/clara_textflow.hpp",
    "content": "// TextFlowCpp\n//\n// A single-header library for wrapping and laying out basic text, by Phil Nash\n//\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n//\n// This project is hosted at https://github.com/philsquared/textflowcpp\n\n#ifndef CLARA_TEXTFLOW_HPP_INCLUDED\n#define CLARA_TEXTFLOW_HPP_INCLUDED\n\n#include <cassert>\n#include <ostream>\n#include <sstream>\n#include <vector>\n\n#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80\n#endif\n\n\nnamespace clara { namespace TextFlow {\n\n    inline auto isWhitespace( char c ) -> bool {\n        static std::string chars = \" \\t\\n\\r\";\n        return chars.find( c ) != std::string::npos;\n    }\n    inline auto isBreakableBefore( char c ) -> bool {\n        static std::string chars = \"[({<|\";\n        return chars.find( c ) != std::string::npos;\n    }\n    inline auto isBreakableAfter( char c ) -> bool {\n        static std::string chars = \"])}>.,:;*+-=&/\\\\\";\n        return chars.find( c ) != std::string::npos;\n    }\n\n    class Columns;\n\n    class Column {\n        std::vector<std::string> m_strings;\n        size_t m_width = CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;\n        size_t m_indent = 0;\n        size_t m_initialIndent = std::string::npos;\n\n    public:\n        class iterator {\n            friend Column;\n\n            Column const& m_column;\n            size_t m_stringIndex = 0;\n            size_t m_pos = 0;\n\n            size_t m_len = 0;\n            size_t m_end = 0;\n            bool m_suffix = false;\n\n            iterator( Column const& column, size_t stringIndex )\n            :   m_column( column ),\n                m_stringIndex( stringIndex )\n            {}\n\n            auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }\n\n            auto isBoundary( size_t at ) const -> bool {\n                assert( at > 0 );\n                assert( at <= line().size() );\n\n                return at == line().size() ||\n                       ( isWhitespace( line()[at] ) && !isWhitespace( line()[at-1] ) ) ||\n                       isBreakableBefore( line()[at] ) ||\n                       isBreakableAfter( line()[at-1] );\n            }\n\n            void calcLength() {\n                assert( m_stringIndex < m_column.m_strings.size() );\n\n                m_suffix = false;\n                auto width = m_column.m_width-indent();\n                m_end = m_pos;\n                while( m_end < line().size() && line()[m_end] != '\\n' )\n                    ++m_end;\n\n                if( m_end < m_pos + width ) {\n                    m_len = m_end - m_pos;\n                }\n                else {\n                    size_t len = width;\n                    while (len > 0 && !isBoundary(m_pos + len))\n                        --len;\n                    while (len > 0 && isWhitespace( line()[m_pos + len - 1] ))\n                        --len;\n\n                    if (len > 0) {\n                        m_len = len;\n                    } else {\n                        m_suffix = true;\n                        m_len = width - 1;\n                    }\n                }\n            }\n\n            auto indent() const -> size_t {\n                auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;\n                return initial == std::string::npos ? m_column.m_indent : initial;\n            }\n\n            auto addIndentAndSuffix(std::string const &plain) const -> std::string {\n                return std::string( indent(), ' ' ) + (m_suffix ? plain + \"-\" : plain);\n            }\n\n        public:\n            using difference_type = std::ptrdiff_t;\n            using value_type = std::string;\n            using pointer = value_type*;\n            using reference = value_type&;\n            using iterator_category = std::forward_iterator_tag;\n\n            explicit iterator( Column const& column ) : m_column( column ) {\n                assert( m_column.m_width > m_column.m_indent );\n                assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );\n                calcLength();\n                if( m_len == 0 )\n                    m_stringIndex++; // Empty string\n            }\n\n            auto operator *() const -> std::string {\n                assert( m_stringIndex < m_column.m_strings.size() );\n                assert( m_pos <= m_end );\n                return addIndentAndSuffix(line().substr(m_pos, m_len));\n            }\n\n            auto operator ++() -> iterator& {\n                m_pos += m_len;\n                if( m_pos < line().size() && line()[m_pos] == '\\n' )\n                    m_pos += 1;\n                else\n                    while( m_pos < line().size() && isWhitespace( line()[m_pos] ) )\n                        ++m_pos;\n\n                if( m_pos == line().size() ) {\n                    m_pos = 0;\n                    ++m_stringIndex;\n                }\n                if( m_stringIndex < m_column.m_strings.size() )\n                    calcLength();\n                return *this;\n            }\n            auto operator ++(int) -> iterator {\n                iterator prev( *this );\n                operator++();\n                return prev;\n            }\n\n            auto operator ==( iterator const& other ) const -> bool {\n                return\n                    m_pos == other.m_pos &&\n                    m_stringIndex == other.m_stringIndex &&\n                    &m_column == &other.m_column;\n            }\n            auto operator !=( iterator const& other ) const -> bool {\n                return !operator==( other );\n            }\n        };\n        using const_iterator = iterator;\n\n        explicit Column( std::string const& text ) { m_strings.push_back( text ); }\n\n        auto width( size_t newWidth ) -> Column& {\n            assert( newWidth > 0 );\n            m_width = newWidth;\n            return *this;\n        }\n        auto indent( size_t newIndent ) -> Column& {\n            m_indent = newIndent;\n            return *this;\n        }\n        auto initialIndent( size_t newIndent ) -> Column& {\n            m_initialIndent = newIndent;\n            return *this;\n        }\n\n        auto width() const -> size_t { return m_width; }\n        auto begin() const -> iterator { return iterator( *this ); }\n        auto end() const -> iterator { return { *this, m_strings.size() }; }\n\n        inline friend std::ostream& operator << ( std::ostream& os, Column const& col ) {\n            bool first = true;\n            for( auto line : col ) {\n                if( first )\n                    first = false;\n                else\n                    os << \"\\n\";\n                os <<  line;\n            }\n            return os;\n        }\n\n        auto operator + ( Column const& other ) -> Columns;\n\n        auto toString() const -> std::string {\n            std::ostringstream oss;\n            oss << *this;\n            return oss.str();\n        }\n    };\n\n    class Spacer : public Column {\n\n    public:\n        explicit Spacer( size_t spaceWidth ) : Column( \"\" ) {\n            width( spaceWidth );\n        }\n    };\n\n    class Columns {\n        std::vector<Column> m_columns;\n\n    public:\n\n        class iterator {\n            friend Columns;\n            struct EndTag {};\n\n            std::vector<Column> const& m_columns;\n            std::vector<Column::iterator> m_iterators;\n            size_t m_activeIterators;\n\n            iterator( Columns const& columns, EndTag )\n            :   m_columns( columns.m_columns ),\n                m_activeIterators( 0 )\n            {\n                m_iterators.reserve( m_columns.size() );\n\n                for( auto const& col : m_columns )\n                    m_iterators.push_back( col.end() );\n            }\n\n        public:\n            using difference_type = std::ptrdiff_t;\n            using value_type = std::string;\n            using pointer = value_type*;\n            using reference = value_type&;\n            using iterator_category = std::forward_iterator_tag;\n\n            explicit iterator( Columns const& columns )\n            :   m_columns( columns.m_columns ),\n                m_activeIterators( m_columns.size() )\n            {\n                m_iterators.reserve( m_columns.size() );\n\n                for( auto const& col : m_columns )\n                    m_iterators.push_back( col.begin() );\n            }\n\n            auto operator ==( iterator const& other ) const -> bool {\n                return m_iterators == other.m_iterators;\n            }\n            auto operator !=( iterator const& other ) const -> bool {\n                return m_iterators != other.m_iterators;\n            }\n            auto operator *() const -> std::string {\n                std::string row, padding;\n\n                for( size_t i = 0; i < m_columns.size(); ++i ) {\n                    auto width = m_columns[i].width();\n                    if( m_iterators[i] != m_columns[i].end() ) {\n                        std::string col = *m_iterators[i];\n                        row += padding + col;\n                        if( col.size() < width )\n                            padding = std::string( width - col.size(), ' ' );\n                        else\n                            padding = \"\";\n                    }\n                    else {\n                        padding += std::string( width, ' ' );\n                    }\n                }\n                return row;\n            }\n            auto operator ++() -> iterator& {\n                for( size_t i = 0; i < m_columns.size(); ++i ) {\n                    if (m_iterators[i] != m_columns[i].end())\n                        ++m_iterators[i];\n                }\n                return *this;\n            }\n            auto operator ++(int) -> iterator {\n                iterator prev( *this );\n                operator++();\n                return prev;\n            }\n        };\n        using const_iterator = iterator;\n\n        auto begin() const -> iterator { return iterator( *this ); }\n        auto end() const -> iterator { return { *this, iterator::EndTag() }; }\n\n        auto operator += ( Column const& col ) -> Columns& {\n            m_columns.push_back( col );\n            return *this;\n        }\n        auto operator + ( Column const& col ) -> Columns {\n            Columns combined = *this;\n            combined += col;\n            return combined;\n        }\n\n        inline friend std::ostream& operator << ( std::ostream& os, Columns const& cols ) {\n\n            bool first = true;\n            for( auto line : cols ) {\n                if( first )\n                    first = false;\n                else\n                    os << \"\\n\";\n                os << line;\n            }\n            return os;\n        }\n\n        auto toString() const -> std::string {\n            std::ostringstream oss;\n            oss << *this;\n            return oss.str();\n        }\n    };\n\n    inline auto Column::operator + ( Column const& other ) -> Columns {\n        Columns cols;\n        cols += *this;\n        cols += other;\n        return cols;\n    }\n}}\n\n#endif // CLARA_TEXTFLOW_HPP_INCLUDED\n"
  },
  {
    "path": "misc/CMakeLists.txt",
    "content": "cmake_minimum_required(VERSION 3.0)\n\nproject(ClaraCoverageHelper)\n\nadd_executable(CoverageHelper coverage-helper.cpp)\nset_property(TARGET CoverageHelper PROPERTY CXX_STANDARD 11)\nset_property(TARGET CoverageHelper PROPERTY CXX_STANDARD_REQUIRED ON)\nset_property(TARGET CoverageHelper PROPERTY CXX_EXTENSIONS OFF)\nif (MSVC)\n    target_compile_options( CoverageHelper PRIVATE /W4 /w44265 /w44061 /w44062 )\nendif()\n"
  },
  {
    "path": "misc/appveyorBuildConfigurationScript.bat",
    "content": "@REM  # In debug build, we want to prebuild memcheck redirecter\n@REM  # before running the tests\nif \"%CONFIGURATION%\"==\"Debug\" (\n  cmake -Hmisc -Bbuild-misc -A%PLATFORM%\n  cmake --build build-misc\n  cmake -H. -BBuild -A%PLATFORM% -DMEMORYCHECK_COMMAND=build-misc\\Debug\\CoverageHelper.exe -DMEMORYCHECK_COMMAND_OPTIONS=--sep-- -DMEMORYCHECK_TYPE=Valgrind\n)\nif \"%CONFIGURATION%\"==\"Release\" (\n  cmake -H. -BBuild -A%PLATFORM%\n)\n"
  },
  {
    "path": "misc/appveyorMergeCoverageScript.py",
    "content": "#!/usr/bin/env python2\n\nimport glob\nimport subprocess\n\nif __name__ == '__main__':\n    cov_files = list(glob.glob('cov-report*.bin'))\n    base_cmd = ['OpenCppCoverage', '--quiet', '--export_type=cobertura:cobertura.xml'] + ['--input_coverage={}'.format(f) for f in cov_files]\n    subprocess.call(base_cmd)\n"
  },
  {
    "path": "misc/appveyorTestRunScript.bat",
    "content": "cd Build\nif \"%CONFIGURATION%\"==\"Debug\" (\n  ctest -j 2 -C %CONFIGURATION% -D ExperimentalMemCheck\n  python ..\\misc\\appveyorMergeCoverageScript.py\n  codecov --root .. --no-color --disable gcov -f cobertura.xml -t %CODECOV_TOKEN%\n)\nif \"%CONFIGURATION%\"==\"Release\" (\n  ctest -j 2 -C %CONFIGURATION%\n)\n"
  },
  {
    "path": "misc/coverage-helper.cpp",
    "content": "#include <algorithm>\n#include <array>\n#include <cassert>\n#include <cctype>\n#include <fstream>\n#include <iostream>\n#include <memory>\n#include <numeric>\n#include <regex>\n#include <string>\n#include <vector>\n\n\nvoid create_empty_file(std::string const& path) {\n    std::ofstream ofs(path);\n    ofs << '\\n';\n}\n\nconst std::string separator = \"--sep--\";\nconst std::string logfile_prefix = \"--log-file=\";\nconst std::string project_name = \"Clara\";\n\nstd::string to_lower(std::string in) {\n    for (auto& c : in) {\n        c = std::tolower(c);\n    }\n    return in;\n}\n\nbool starts_with(std::string const& str, std::string const& pref) {\n    return str.find(pref) == 0;\n}\n\nint parse_log_file_arg(std::string const& arg) {\n    assert(starts_with(arg, logfile_prefix) && \"Attempting to parse incorrect arg!\");\n    auto fname = arg.substr(logfile_prefix.size());\n    create_empty_file(fname);\n    std::regex regex(\"MemoryChecker\\\\.(\\\\d+)\\\\.log\", std::regex::icase);\n    std::smatch match;\n    if (std::regex_search(fname, match, regex)) {\n        return std::stoi(match[1]);\n    } else {\n        throw std::domain_error(\"Couldn't find desired expression in string: \" + fname);\n    }\n}\n\nstd::string project_path(std::string path) {\n    auto start = path.find(project_name);\n    if (start == std::string::npos) {\n        start = path.find(to_lower(project_name));\n    }\n    if (start == std::string::npos) {\n        throw std::domain_error(\"Couldn't find project's base path\");\n    }\n    auto end = path.find_first_of(\"\\\\/\", start);\n    return path.substr(0, end);\n}\n\nstd::string windowsify_path(std::string path) {\n    for (auto& c : path) {\n        if (c == '/') {\n            c = '\\\\';\n        }\n    }\n    return path;\n}\n\nvoid exec_cmd(std::string const& cmd, int log_num, std::string const& path) {\n    std::array<char, 128> buffer;\n#if defined(_WIN32)\n    auto real_cmd = \"OpenCppCoverage --export_type binary:cov-report\" + std::to_string(log_num)\n        + \".bin --quiet \" + \"--sources \" + path + \" --cover_children -- \" + cmd;\n    std::cout << \"=== Marker ===: Cmd: \" << real_cmd << '\\n';\n    std::shared_ptr<FILE> pipe(_popen(real_cmd.c_str(), \"r\"), _pclose);\n#else // Just for testing, in the real world we will always work under WIN32\n    (void)log_num; (void)path;\n    std::shared_ptr<FILE> pipe(popen(cmd.c_str(), \"r\"), pclose);\n#endif\n\n    if (!pipe) {\n        throw std::runtime_error(\"popen() failed!\");\n    }\n    while (!feof(pipe.get())) {\n        if (fgets(buffer.data(), 128, pipe.get()) != nullptr) {\n            std::cout << buffer.data();\n        }\n    }\n}\n\n// argv should be:\n// [0]: our path\n// [1]: \"--log-file=<path>\"\n// [2]: \"--sep--\"\n// [3]+: the actual command\n\nint main(int argc, char** argv) {\n    std::vector<std::string> args(argv, argv + argc);\n    auto sep = std::find(begin(args), end(args), separator);\n    assert(sep - begin(args) == 2 && \"Structure differs from expected!\");\n\n    auto num = parse_log_file_arg(args[1]);\n\n    auto cmdline = std::accumulate(++sep, end(args), std::string{}, [] (const std::string& lhs, const std::string& rhs) {\n        return lhs + ' ' + rhs;\n    });\n\n    exec_cmd(cmdline, num, windowsify_path(project_path(args[0])));\n}\n"
  },
  {
    "path": "misc/installOpenCppCoverage.ps1",
    "content": "# Downloads are done from the oficial github release page links\n$downloadUrl = \"https://github.com/OpenCppCoverage/OpenCppCoverage/releases/download/release-0.9.6.1/OpenCppCoverageSetup-x64-0.9.6.1.exe\"\n$installerPath = [System.IO.Path]::Combine($Env:USERPROFILE, \"Downloads\", \"OpenCppCoverageSetup.exe\")\n\nif(-Not (Test-Path $installerPath)) {\n    Write-Host -ForegroundColor White (\"Downloading OpenCppCoverage from: \" + $downloadUrl)\n    Start-FileDownload $downloadUrl -FileName $installerPath\n}\n\nWrite-Host -ForegroundColor White \"About to install OpenCppCoverage...\"\n\n$installProcess = (Start-Process $installerPath -ArgumentList '/VERYSILENT' -PassThru -Wait)\nif($installProcess.ExitCode -ne 0) {\n    throw [System.String]::Format(\"Failed to install OpenCppCoverage, ExitCode: {0}.\", $installProcess.ExitCode)\n}\n\n# Assume standard, boring, installation path of \".../Program Files/OpenCppCoverage\"\n$installPath = [System.IO.Path]::Combine(${Env:ProgramFiles}, \"OpenCppCoverage\")\n$env:Path=\"$env:Path;$installPath\"\n"
  },
  {
    "path": "scripts/embed.py",
    "content": "import re\n\npreprocessorRe = re.compile( r'\\s*#.*' )\n\nfdefineRe = re.compile( r'\\s*#\\s*define\\s*(\\S*)\\s*\\(' ) # #defines that take arguments\ndefineRe = re.compile( r'\\s*#\\s*define\\s*(\\S*)\\s+(\\S*)' ) # all #defines\nundefRe = re.compile( r'\\s*#\\s*undef\\s*(\\S*)' ) # all #undefs\n\nifdefCommonRe = re.compile( r'\\s*#\\s*if' ) # all #ifdefs\nifdefRe = re.compile( r'\\s*#\\s*ifdef\\s*(\\S*)' )\nifndefRe = re.compile( r'\\s*#\\s*ifndef\\s*(\\S*)' )\nendifRe = re.compile( r'\\s*#\\s*endif\\s*//\\s*(.*)' )\nelseRe = re.compile( r'\\s*#\\s*else' )\nifRe = re.compile( r'\\s*#\\s*if\\s+(.*)' )\n\nnsRe = re.compile( r'(\\s*\\s*namespace\\s+)(.+)(\\s*{?)' )\nnsCloseRe = re.compile( r'(\\s*})(\\s*\\/\\/\\s*namespace\\s+)(.+)(\\s*{?)' )\n\n\nclass LineMapper:\n    def __init__( self, idMap, outerNamespace ):\n        self.idMap = idMap\n        self.outerNamespace = outerNamespace\n\n    def replaceId( self, lineNo, id ):\n        if not id in self.idMap:\n            raise ValueError( \"Unrecognised macro identifier: '{0}' on line: {1}\".format( id, lineNo ) )\n        subst = self.idMap[id]\n        if subst == \"\":\n            return id\n        else:\n            return subst\n\n    # TBD:\n    #  #if, #ifdef, comments after #else\n    def mapLine( self, lineNo, line ):\n        m = ifndefRe.match( line )\n        if m:\n            return \"#ifndef \" + self.replaceId( lineNo, m.group(1)) + \"\\n\"\n        m = defineRe.match( line )\n        if m:\n            return \"#define \" + self.replaceId( lineNo, m.group(1)) + \"\\n\"\n        m = endifRe.match( line )\n        if m:\n            return \"#endif // \" + self.replaceId( lineNo, m.group(1)) + \"\\n\"\n        m = nsRe.match( line )\n        if m:\n            return \"{0}{1} {{ namespace {2}{3}\".format( m.group(1), self.outerNamespace, m.group(2), m.group(3))\n        m = nsCloseRe.match( line )\n        if m:\n            return \"{0}}}{1}{2}::{3}{4}\".format( m.group(1), m.group(2), self.outerNamespace, m.group(3), m.group(4))\n        return line\n\n    def mapFile(self, filenameIn, filenameOut ):\n        print( \"Embedding:\\n  {0}\\nas:\\n  {1}\".format( filenameIn, filenameOut ) )\n        with open( filenameIn, 'r' ) as f, open( filenameOut, 'w' ) as outf:\n            lineNo = 1\n            for line in f:\n                outf.write( self.mapLine( lineNo, line ) )\n                lineNo = lineNo + 1\n        print( \"Written {0} lines\".format( lineNo ) )"
  },
  {
    "path": "scripts/embedTextFlow.py",
    "content": "#!/usr/bin/env python3\n\n# Execute this script any time you import a new copy of textflow into the third_party area\nimport os\nimport sys\nimport embed\n\nrootPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))\n\nfilename = os.path.join( rootPath, \"third_party\", \"TextFlow.hpp\" )\noutfilename = os.path.join( rootPath, \"include\", \"clara_textflow.hpp\" )\n\n\n# Mapping of pre-processor identifiers\nidMap = {\n   \"TEXTFLOW_HPP_INCLUDED\": \"CLARA_TEXTFLOW_HPP_INCLUDED\",\n    \"TEXTFLOW_CONFIG_CONSOLE_WIDTH\": \"CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\"\n    }\n\n# outer namespace to add\nouterNamespace = \"clara\"\n\nmapper = embed.LineMapper( idMap, outerNamespace )\nmapper.mapFile( filename, outfilename )"
  },
  {
    "path": "scripts/release.py",
    "content": "#!/usr/bin/env python\n\nfrom __future__ import print_function\nimport os\nimport sys\nimport re\n\nrootPath = os.path.dirname(os.path.realpath(os.path.dirname(sys.argv[0])))\nclaraPath = os.path.join( rootPath, \"include/clara.hpp\" )\nreadmePath = os.path.join( rootPath, \"README.md\" )\n\nversionParser = re.compile( r'\\s*\\/\\/\\s*Clara\\s+v([0-9]+)\\.([0-9]+)(\\.([0-9]+)(\\-(.*)\\.([0-9]*))?)?' )\nreadmeParser = re.compile( r'\\s*#\\s*Clara\\s+v(.*)' )\n\nwarnings = 0\n\ndef precheck():\n    global warnings\n    f = open( claraPath, 'r' )\n    lineNo = 0\n    for line in f:\n        lineNo = lineNo+1\n        if \"dynamic\" in line:\n            warnings = warnings + 1\n            print( \"** Warning: use of dynamic_cast on line {0}!\".format(lineNo) )\n    f.close()\n\nclass Version:\n    def __init__(self):\n        f = open( claraPath, 'r' )\n        for line in f:\n            m = versionParser.match( line )\n            if m:\n                self.majorVersion = int(m.group(1))\n                self.minorVersion = int(m.group(2))\n                self.patchNumber = int(m.group(4))\n                if m.group(6) == None:\n                    self.branchName = \"\"\n                else:\n                    self.branchName = m.group(6)\n                if m.group(7) == None:\n                    self.buildNumber = 0\n                else:\n                    self.buildNumber = int(m.group(7))\n        f.close()\n\n    def nonDevelopRelease(self):\n        if self.branchName != \"\":\n            self.branchName = \"\"\n            self.buildNumber = 0\n    def developBuild(self):\n        if self.branchName == \"\":\n            self.branchName = \"develop\"\n            self.buildNumber = 0\n        else:\n            self.buildNumber = self.buildNumber+1\n\n    def incrementBuildNumber(self):\n        self.developBuild()\n        self.buildNumber = self.buildNumber+1\n\n    def incrementPatchNumber(self):\n        self.nonDevelopRelease()\n        self.patchNumber = self.patchNumber+1\n\n    def incrementMinorVersion(self):\n        self.nonDevelopRelease()\n        self.patchNumber = 0\n        self.minorVersion = self.minorVersion+1\n\n    def incrementMajorVersion(self):\n        self.nonDevelopRelease()\n        self.patchNumber = 0\n        self.minorVersion = 0\n        self.majorVersion = self.majorVersion+1\n\n    def getVersionString(self):\n        versionString = '{0}.{1}.{2}'.format( self.majorVersion, self.minorVersion, self.patchNumber )\n        if self.branchName != \"\":\n            versionString = versionString + '-{0}.{1}'.format( self.branchName, self.buildNumber )\n        return versionString\n\n    def updateHeader(self):\n        f = open( claraPath, 'r' )\n        lines = []\n        for line in f:\n            m = versionParser.match( line )\n            if m:\n                lines.append( '// Clara v{0}'.format( self.getVersionString() ) )\n            else:\n                lines.append( line.rstrip() )\n        f.close()\n        f = open( claraPath, 'w' )\n        for line in lines:\n            f.write( line + \"\\n\" )\n\n    def updateReadme(self):\n        f = open( readmePath, 'r' )\n        lines = []\n        changed = False\n        for line in f:\n            m = readmeParser.match( line )\n            if m:\n                lines.append( '# Clara v{0}'.format( self.getVersionString() ) )\n                changed = True\n            else:\n                lines.append( line.rstrip() )\n        f.close()\n        if changed:\n            f = open( readmePath, 'w' )\n            for line in lines:\n                f.write( line + \"\\n\" )\n        else:\n            print( \"*** Did not update README\" )\ndef usage():\n    print( \"\\n**** Run with patch|minor|major|dev|verify\\n\" )\n    return 1\n\nif len( sys.argv) == 1:\n    exit( usage() )\n\nprecheck()\n\nv = Version()\noldV = v.getVersionString()\n\ncmd = sys.argv[1].lower()\n\nif warnings > 0:\n    print( \"Found {0} issue(s)\".format(warnings))\n    exit(1)\n\nif cmd == \"verify\":\n    print( \"No issues found\")\n    exit(0)\nelif cmd == \"patch\":\n    v.incrementPatchNumber()\nelif cmd == \"minor\":\n    v.incrementMinorVersion()\nelif cmd == \"major\":\n    v.incrementMajorVersion()\nelif cmd == \"dev\":\n    v.developBuild()\nelse:\n    exit( usage() )\n\nv.updateHeader()\nv.updateReadme()\n\nprint( \"Updated clara.hpp and README from {0} to v{1}\".format( oldV, v.getVersionString() ) )\n"
  },
  {
    "path": "scripts/stitch.py",
    "content": "#!/usr/bin/env python\n\n# This is an initial cut of a general header stitching script.\n# It is currently hard-coded to work with Clara, but that is purely\n# a path thing. The next step is the genericise this further and\n# apply it to Catch. There will undoubtedly be issues to fix there.\n# After that there are further tweaks to make such as suppressing initial\n# comments in stitched headers and adding a single new header block to\n# the output file, suppressing conditional blocks where the identifiers\n# are known and moving all headers not in conditional blocks to the top\n# of the file\n\nimport os\nimport sys\nimport re\nimport datetime\nimport string\n\npreprocessorRe = re.compile( r'\\s*#.*' )\n\nincludesRe = re.compile( r'\\s*#\\s*include.*' ) # all #includes\nsysIncludesRe = re.compile( r'\\s*#\\s*include\\s*<(.*)>' ) # .e.g #include <vector>\nprjIncludesRe = re.compile( r'\\s*#\\s*include\\s*\"(.*)\"' ) # e.g. #include \"myheader.h\"\n\nfdefineRe = re.compile( r'\\s*#\\s*define\\s*(\\S*)\\s*\\(' ) # #defines that take arguments\ndefineRe = re.compile( r'\\s*#\\s*define\\s*(\\S*)\\s+(\\S*)' ) # all #defines\nundefRe = re.compile( r'\\s*#\\s*undef\\s*(\\S*)' ) # all #undefs\n\nifdefCommonRe = re.compile( r'\\s*#\\s*if' ) # all #ifdefs\nifdefRe = re.compile( r'\\s*#\\s*ifdef\\s*(\\S*)' )\nifndefRe = re.compile( r'\\s*#\\s*ifndef\\s*(\\S*)' )\nendifRe = re.compile( r'\\s*#\\s*endif(.*)' )\nelseRe = re.compile( r'\\s*#\\s*else' )\nifRe = re.compile( r'\\s*#\\s*if\\s+(.*)' )\n\nrootPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))\nsrcsPath = os.path.join( rootPath, 'src' )\nincludePath = os.path.join( rootPath, 'include' )\nsingleIncludePath = os.path.join( rootPath, 'single_include' )\nextIncludePath = os.path.join( includePath, \"external\" )\nthirdPartyPath = os.path.join( rootPath, 'third_party' )\nfirstHeaderPath = os.path.join( includePath, 'clara.hpp' )\noutPath = os.path.join( singleIncludePath, 'clara.hpp' )\n\no = open( outPath, 'w' )\n\nsystemHeaders = set([])\nprojectHeaders = set([])\ndefines = set([])\nLevelMax = 9999\nsuppressUntilLevel = LevelMax\nlevel = 0\n\nclass FileParser:\n    filename = \"\"\n\n    def __init__( self, filename ):\n        self.filename = filename\n\n    def findHeader( self, headerFile ):\n\n        # !TBD: make this array based\n\n        # First check next to current file\n        dir, _ = os.path.split( self.filename )\n        fullPath = os.path.join( dir, headerFile )\n        if os.path.isfile(fullPath):\n            return fullPath\n\n        # Next check include folder\n        fullPath = os.path.join( includePath, headerFile )\n        if os.path.isfile(fullPath):\n            return fullPath\n\n        # Then ext folder\n        fullPath = os.path.join( extIncludePath, headerFile )\n        if os.path.isfile(fullPath):\n            return fullPath\n\n        # Finally check ThirdParty folder\n        fullPath = os.path.join( thirdPartyPath, headerFile )\n        if os.path.isfile(fullPath):\n            return fullPath\n\n        raise FileNotFoundError( \"Cannot locate include file: '\" + filename + \"'\" )\n\n\n    def parse( self ):\n        with open( self.filename, 'r' ) as f:\n            for line in f:\n                if preprocessorRe.match( line ):\n                    self.handlePreprocessor( line )\n                else:\n                    self.handleNonPP( line )\n\n    def handleNonPP( self, line ):\n        if suppressUntilLevel > level:\n            self.writeLine( line )\n\n    def handlePreprocessor( self, line ):\n        if includesRe.match( line ):\n            if suppressUntilLevel > level:\n                self.handleInclude( line )\n        else:\n            self.handleNonIncludePP( line )\n\n    def handleInclude( self, line ):\n        global systemHeaders\n        global projectHeaders\n        m = sysIncludesRe.match( line )\n        if m:\n            headerFile = m.group(1)\n            if not headerFile in systemHeaders:\n                self.writeLine( \"#include <{0}>\".format( headerFile ) )\n                systemHeaders.add( headerFile )\n\n        m = prjIncludesRe.match( line )\n        if m:\n            headerFile = m.group(1)\n            if not headerFile in projectHeaders:            \n                self.writeLine( '\\n// ----------- #included from {0} -----------'.format( headerFile ) )\n                self.writeLine( \"\" )\n                projectHeaders.add( headerFile )\n\n                _, filename = os.path.split( self.filename )\n                headerPath = self.findHeader( headerFile )\n                p = FileParser( headerPath )\n                p.parse()\n                self.writeLine( '\\n// ----------- end of #include from {0} -----------'.format( headerFile ) )\n                self.writeLine( '// ........... back in {0}'.format( filename ) )\n                self.writeLine( \"\" )\n\n    def handleNonIncludePP( self, line ):\n        m = endifRe.match( line )\n        if m:\n            self.handleEndif( m.group(1) )\n        m = elseRe.match( line )\n        if m:\n            self.handleElse()\n\n        if ifdefCommonRe.match( line ):\n            self.handleIfdefCommon( line )\n\n        if suppressUntilLevel > level:\n            m = defineRe.match( line )\n            if m:\n                if fdefineRe.match( line ):\n                    self.writeLine( line )\n                else:\n                    self.handleDefine( m.group(1), m.group(2) )\n            m = undefRe.match( line )\n            if m:\n                self.handleUndef( m.group(1) )\n        \n    def handleDefine( self, define, value ):\n        self.writeLine( \"#define {0} {1}\".format( define, value ) )\n        defines.add( define )\n\n    def handleUndef( self, define ):\n        self.writeLine( \"#undef {0}\".format( define ) )\n        defines.remove( define )\n\n    def handleIfdefCommon( self, line ):\n        global level\n        level = level + 1\n        m = ifndefRe.match( line )\n        if m:\n            self.handleIfndef( m.group(1) )\n        else:\n            m = ifdefRe.match( line )\n            if m:\n                self.handleIfdef( m.group(1) )\n            else:\n                m = ifRe.match( line )\n                if m:\n                    self.handleIf( m.group(1) )\n                else:\n                    print \"****** error ***** \" + line\n\n    def handleEndif( self, trailing ):\n        global level\n        global suppressUntilLevel\n        self.writeLine( \"#endif{0}\".format( trailing ) )\n        level = level - 1\n        if level == suppressUntilLevel:\n            suppressUntilLevel = LevelMax\n\n    def handleElse( self ):\n        global suppressUntilLevel\n        self.writeLine( \"#else\" )\n        if level == suppressUntilLevel+1:\n            suppressUntilLevel = LevelMax\n\n    def handleIfndef( self, define ):\n        self.writeLine( \"#ifndef {0}\".format( define ) )\n        if define not in defines:\n            suppressUntilLevel = level\n    \n    def handleIfdef( self, define ):\n        self.writeLine( \"#ifdef {0}\".format( define ) )\n        if define in defines:\n            suppressUntilLevel = level\n\n    def handleIf( self, trailing ):\n        global level\n        global suppressUntilLevel\n        self.writeLine( \"#if {0}\".format( trailing ) )\n        level = level + 1\n#        if level == suppressUntilLevel:\n#            suppressUntilLevel = LevelMax\n\n\n    def writeLine( self, line ):\n        o.write( line.rstrip() + \"\\n\" )\n\nprint( \"from: \" + firstHeaderPath )\nprint( \"to: \" + outPath )\np = FileParser( firstHeaderPath )\np.parse()\n\no.close()\n\nprint \"-------------\"\nprint level\n#for h in systemHeaders:\n#    print \"#include <\" + h + \">\"\n#print\n#\n#for h in projectHeaders:\n#    print '#include \"' + h + '\"'\n#print\n#for d in defines:\n#    print d\n#print\n"
  },
  {
    "path": "single_include/clara.hpp",
    "content": "// Copyright 2017 Two Blue Cubes Ltd. All rights reserved.\n//\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n//\n// See https://github.com/philsquared/Clara for more details\n\n// Clara v1.1.5\n\n#ifndef CLARA_HPP_INCLUDED\n#define CLARA_HPP_INCLUDED\n\n#ifndef CLARA_CONFIG_CONSOLE_WIDTH\n#define CLARA_CONFIG_CONSOLE_WIDTH 80\n#endif\n\n#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CLARA_CONFIG_CONSOLE_WIDTH\n#endif\n\n#ifndef CLARA_CONFIG_OPTIONAL_TYPE\n#ifdef __has_include\n#if __has_include(<optional>) && __cplusplus >= 201703L\n#include <optional>\n#define CLARA_CONFIG_OPTIONAL_TYPE std::optional\n#endif\n#endif\n#endif\n\n\n// ----------- #included from clara_textflow.hpp -----------\n\n// TextFlowCpp\n//\n// A single-header library for wrapping and laying out basic text, by Phil Nash\n//\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n//\n// This project is hosted at https://github.com/philsquared/textflowcpp\n\n#ifndef CLARA_TEXTFLOW_HPP_INCLUDED\n#define CLARA_TEXTFLOW_HPP_INCLUDED\n\n#include <cassert>\n#include <ostream>\n#include <sstream>\n#include <vector>\n\n#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80\n#endif\n\n\nnamespace clara { namespace TextFlow {\n\n    inline auto isWhitespace( char c ) -> bool {\n        static std::string chars = \" \\t\\n\\r\";\n        return chars.find( c ) != std::string::npos;\n    }\n    inline auto isBreakableBefore( char c ) -> bool {\n        static std::string chars = \"[({<|\";\n        return chars.find( c ) != std::string::npos;\n    }\n    inline auto isBreakableAfter( char c ) -> bool {\n        static std::string chars = \"])}>.,:;*+-=&/\\\\\";\n        return chars.find( c ) != std::string::npos;\n    }\n\n    class Columns;\n\n    class Column {\n        std::vector<std::string> m_strings;\n        size_t m_width = CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;\n        size_t m_indent = 0;\n        size_t m_initialIndent = std::string::npos;\n\n    public:\n        class iterator {\n            friend Column;\n\n            Column const& m_column;\n            size_t m_stringIndex = 0;\n            size_t m_pos = 0;\n\n            size_t m_len = 0;\n            size_t m_end = 0;\n            bool m_suffix = false;\n\n            iterator( Column const& column, size_t stringIndex )\n            :   m_column( column ),\n                m_stringIndex( stringIndex )\n            {}\n\n            auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }\n\n            auto isBoundary( size_t at ) const -> bool {\n                assert( at > 0 );\n                assert( at <= line().size() );\n\n                return at == line().size() ||\n                       ( isWhitespace( line()[at] ) && !isWhitespace( line()[at-1] ) ) ||\n                       isBreakableBefore( line()[at] ) ||\n                       isBreakableAfter( line()[at-1] );\n            }\n\n            void calcLength() {\n                assert( m_stringIndex < m_column.m_strings.size() );\n\n                m_suffix = false;\n                auto width = m_column.m_width-indent();\n                m_end = m_pos;\n                while( m_end < line().size() && line()[m_end] != '\\n' )\n                    ++m_end;\n\n                if( m_end < m_pos + width ) {\n                    m_len = m_end - m_pos;\n                }\n                else {\n                    size_t len = width;\n                    while (len > 0 && !isBoundary(m_pos + len))\n                        --len;\n                    while (len > 0 && isWhitespace( line()[m_pos + len - 1] ))\n                        --len;\n\n                    if (len > 0) {\n                        m_len = len;\n                    } else {\n                        m_suffix = true;\n                        m_len = width - 1;\n                    }\n                }\n            }\n\n            auto indent() const -> size_t {\n                auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;\n                return initial == std::string::npos ? m_column.m_indent : initial;\n            }\n\n            auto addIndentAndSuffix(std::string const &plain) const -> std::string {\n                return std::string( indent(), ' ' ) + (m_suffix ? plain + \"-\" : plain);\n            }\n\n        public:\n            using difference_type = std::ptrdiff_t;\n            using value_type = std::string;\n            using pointer = value_type*;\n            using reference = value_type&;\n            using iterator_category = std::forward_iterator_tag;\n\n            explicit iterator( Column const& column ) : m_column( column ) {\n                assert( m_column.m_width > m_column.m_indent );\n                assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );\n                calcLength();\n                if( m_len == 0 )\n                    m_stringIndex++; // Empty string\n            }\n\n            auto operator *() const -> std::string {\n                assert( m_stringIndex < m_column.m_strings.size() );\n                assert( m_pos <= m_end );\n                return addIndentAndSuffix(line().substr(m_pos, m_len));\n            }\n\n            auto operator ++() -> iterator& {\n                m_pos += m_len;\n                if( m_pos < line().size() && line()[m_pos] == '\\n' )\n                    m_pos += 1;\n                else\n                    while( m_pos < line().size() && isWhitespace( line()[m_pos] ) )\n                        ++m_pos;\n\n                if( m_pos == line().size() ) {\n                    m_pos = 0;\n                    ++m_stringIndex;\n                }\n                if( m_stringIndex < m_column.m_strings.size() )\n                    calcLength();\n                return *this;\n            }\n            auto operator ++(int) -> iterator {\n                iterator prev( *this );\n                operator++();\n                return prev;\n            }\n\n            auto operator ==( iterator const& other ) const -> bool {\n                return\n                    m_pos == other.m_pos &&\n                    m_stringIndex == other.m_stringIndex &&\n                    &m_column == &other.m_column;\n            }\n            auto operator !=( iterator const& other ) const -> bool {\n                return !operator==( other );\n            }\n        };\n        using const_iterator = iterator;\n\n        explicit Column( std::string const& text ) { m_strings.push_back( text ); }\n\n        auto width( size_t newWidth ) -> Column& {\n            assert( newWidth > 0 );\n            m_width = newWidth;\n            return *this;\n        }\n        auto indent( size_t newIndent ) -> Column& {\n            m_indent = newIndent;\n            return *this;\n        }\n        auto initialIndent( size_t newIndent ) -> Column& {\n            m_initialIndent = newIndent;\n            return *this;\n        }\n\n        auto width() const -> size_t { return m_width; }\n        auto begin() const -> iterator { return iterator( *this ); }\n        auto end() const -> iterator { return { *this, m_strings.size() }; }\n\n        inline friend std::ostream& operator << ( std::ostream& os, Column const& col ) {\n            bool first = true;\n            for( auto line : col ) {\n                if( first )\n                    first = false;\n                else\n                    os << \"\\n\";\n                os <<  line;\n            }\n            return os;\n        }\n\n        auto operator + ( Column const& other ) -> Columns;\n\n        auto toString() const -> std::string {\n            std::ostringstream oss;\n            oss << *this;\n            return oss.str();\n        }\n    };\n\n    class Spacer : public Column {\n\n    public:\n        explicit Spacer( size_t spaceWidth ) : Column( \"\" ) {\n            width( spaceWidth );\n        }\n    };\n\n    class Columns {\n        std::vector<Column> m_columns;\n\n    public:\n\n        class iterator {\n            friend Columns;\n            struct EndTag {};\n\n            std::vector<Column> const& m_columns;\n            std::vector<Column::iterator> m_iterators;\n            size_t m_activeIterators;\n\n            iterator( Columns const& columns, EndTag )\n            :   m_columns( columns.m_columns ),\n                m_activeIterators( 0 )\n            {\n                m_iterators.reserve( m_columns.size() );\n\n                for( auto const& col : m_columns )\n                    m_iterators.push_back( col.end() );\n            }\n\n        public:\n            using difference_type = std::ptrdiff_t;\n            using value_type = std::string;\n            using pointer = value_type*;\n            using reference = value_type&;\n            using iterator_category = std::forward_iterator_tag;\n\n            explicit iterator( Columns const& columns )\n            :   m_columns( columns.m_columns ),\n                m_activeIterators( m_columns.size() )\n            {\n                m_iterators.reserve( m_columns.size() );\n\n                for( auto const& col : m_columns )\n                    m_iterators.push_back( col.begin() );\n            }\n\n            auto operator ==( iterator const& other ) const -> bool {\n                return m_iterators == other.m_iterators;\n            }\n            auto operator !=( iterator const& other ) const -> bool {\n                return m_iterators != other.m_iterators;\n            }\n            auto operator *() const -> std::string {\n                std::string row, padding;\n\n                for( size_t i = 0; i < m_columns.size(); ++i ) {\n                    auto width = m_columns[i].width();\n                    if( m_iterators[i] != m_columns[i].end() ) {\n                        std::string col = *m_iterators[i];\n                        row += padding + col;\n                        if( col.size() < width )\n                            padding = std::string( width - col.size(), ' ' );\n                        else\n                            padding = \"\";\n                    }\n                    else {\n                        padding += std::string( width, ' ' );\n                    }\n                }\n                return row;\n            }\n            auto operator ++() -> iterator& {\n                for( size_t i = 0; i < m_columns.size(); ++i ) {\n                    if (m_iterators[i] != m_columns[i].end())\n                        ++m_iterators[i];\n                }\n                return *this;\n            }\n            auto operator ++(int) -> iterator {\n                iterator prev( *this );\n                operator++();\n                return prev;\n            }\n        };\n        using const_iterator = iterator;\n\n        auto begin() const -> iterator { return iterator( *this ); }\n        auto end() const -> iterator { return { *this, iterator::EndTag() }; }\n\n        auto operator += ( Column const& col ) -> Columns& {\n            m_columns.push_back( col );\n            return *this;\n        }\n        auto operator + ( Column const& col ) -> Columns {\n            Columns combined = *this;\n            combined += col;\n            return combined;\n        }\n\n        inline friend std::ostream& operator << ( std::ostream& os, Columns const& cols ) {\n\n            bool first = true;\n            for( auto line : cols ) {\n                if( first )\n                    first = false;\n                else\n                    os << \"\\n\";\n                os << line;\n            }\n            return os;\n        }\n\n        auto toString() const -> std::string {\n            std::ostringstream oss;\n            oss << *this;\n            return oss.str();\n        }\n    };\n\n    inline auto Column::operator + ( Column const& other ) -> Columns {\n        Columns cols;\n        cols += *this;\n        cols += other;\n        return cols;\n    }\n}}\n\n#endif // CLARA_TEXTFLOW_HPP_INCLUDED\n\n// ----------- end of #include from clara_textflow.hpp -----------\n// ........... back in clara.hpp\n\n\n#include <memory>\n#include <set>\n#include <algorithm>\n\n#if !defined(CLARA_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )\n#define CLARA_PLATFORM_WINDOWS\n#endif\n\nnamespace clara {\nnamespace detail {\n\n    // Traits for extracting arg and return type of lambdas (for single argument lambdas)\n    template<typename L>\n    struct UnaryLambdaTraits : UnaryLambdaTraits<decltype( &L::operator() )> {};\n\n    template<typename ClassT, typename ReturnT, typename... Args>\n    struct UnaryLambdaTraits<ReturnT( ClassT::* )( Args... ) const> {\n        static const bool isValid = false;\n    };\n\n    template<typename ClassT, typename ReturnT, typename ArgT>\n    struct UnaryLambdaTraits<ReturnT( ClassT::* )( ArgT ) const> {\n        static const bool isValid = true;\n        using ArgType = typename std::remove_const<typename std::remove_reference<ArgT>::type>::type;\n        using ReturnType = ReturnT;\n    };\n\n    class TokenStream;\n\n    // Transport for raw args (copied from main args, or supplied via init list for testing)\n    class Args {\n        friend TokenStream;\n        std::string m_exeName;\n        std::vector<std::string> m_args;\n\n    public:\n        Args( int argc, char const* const* argv )\n            : m_exeName(argv[0]),\n              m_args(argv + 1, argv + argc) {}\n\n        Args( std::initializer_list<std::string> args )\n        :   m_exeName( *args.begin() ),\n            m_args( args.begin()+1, args.end() )\n        {}\n\n        auto exeName() const -> std::string {\n            return m_exeName;\n        }\n    };\n\n    // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string\n    // may encode an option + its argument if the : or = form is used\n    enum class TokenType {\n        Option, Argument\n    };\n    struct Token {\n        TokenType type;\n        std::string token;\n    };\n\n    inline auto isOptPrefix( char c ) -> bool {\n        return c == '-'\n#ifdef CLARA_PLATFORM_WINDOWS\n            || c == '/'\n#endif\n        ;\n    }\n\n    // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled\n    class TokenStream {\n        using Iterator = std::vector<std::string>::const_iterator;\n        Iterator it;\n        Iterator itEnd;\n        std::vector<Token> m_tokenBuffer;\n\n        void loadBuffer() {\n            m_tokenBuffer.resize( 0 );\n\n            // Skip any empty strings\n            while( it != itEnd && it->empty() )\n                ++it;\n\n            if( it != itEnd ) {\n                auto const &next = *it;\n                if( isOptPrefix( next[0] ) ) {\n                    auto delimiterPos = next.find_first_of( \" :=\" );\n                    if( delimiterPos != std::string::npos ) {\n                        m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } );\n                        m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } );\n                    } else {\n                        if( next[1] != '-' && next.size() > 2 ) {\n                            std::string opt = \"- \";\n                            for( size_t i = 1; i < next.size(); ++i ) {\n                                opt[1] = next[i];\n                                m_tokenBuffer.push_back( { TokenType::Option, opt } );\n                            }\n                        } else {\n                            m_tokenBuffer.push_back( { TokenType::Option, next } );\n                        }\n                    }\n                } else {\n                    m_tokenBuffer.push_back( { TokenType::Argument, next } );\n                }\n            }\n        }\n\n    public:\n        explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {}\n\n        TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) {\n            loadBuffer();\n        }\n\n        explicit operator bool() const {\n            return !m_tokenBuffer.empty() || it != itEnd;\n        }\n\n        auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); }\n\n        auto operator*() const -> Token {\n            assert( !m_tokenBuffer.empty() );\n            return m_tokenBuffer.front();\n        }\n\n        auto operator->() const -> Token const * {\n            assert( !m_tokenBuffer.empty() );\n            return &m_tokenBuffer.front();\n        }\n\n        auto operator++() -> TokenStream & {\n            if( m_tokenBuffer.size() >= 2 ) {\n                m_tokenBuffer.erase( m_tokenBuffer.begin() );\n            } else {\n                if( it != itEnd )\n                    ++it;\n                loadBuffer();\n            }\n            return *this;\n        }\n    };\n\n\n    class ResultBase {\n    public:\n        enum Type {\n            Ok, LogicError, RuntimeError\n        };\n\n    protected:\n        ResultBase( Type type ) : m_type( type ) {}\n        virtual ~ResultBase() = default;\n\n        virtual void enforceOk() const = 0;\n\n        Type m_type;\n    };\n\n    template<typename T>\n    class ResultValueBase : public ResultBase {\n    public:\n        auto value() const -> T const & {\n            enforceOk();\n            return m_value;\n        }\n\n    protected:\n        ResultValueBase( Type type ) : ResultBase( type ) {}\n\n        ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) {\n            if( m_type == ResultBase::Ok )\n                new( &m_value ) T( other.m_value );\n        }\n\n        ResultValueBase( Type, T const &value ) : ResultBase( Ok ) {\n            new( &m_value ) T( value );\n        }\n\n        auto operator=( ResultValueBase const &other ) -> ResultValueBase & {\n            if( m_type == ResultBase::Ok )\n                m_value.~T();\n            ResultBase::operator=(other);\n            if( m_type == ResultBase::Ok )\n                new( &m_value ) T( other.m_value );\n            return *this;\n        }\n\n        ~ResultValueBase() override {\n            if( m_type == Ok )\n                m_value.~T();\n        }\n\n        union {\n            T m_value;\n        };\n    };\n\n    template<>\n    class ResultValueBase<void> : public ResultBase {\n    protected:\n        using ResultBase::ResultBase;\n    };\n\n    template<typename T = void>\n    class BasicResult : public ResultValueBase<T> {\n    public:\n        template<typename U>\n        explicit BasicResult( BasicResult<U> const &other )\n        :   ResultValueBase<T>( other.type() ),\n            m_errorMessage( other.errorMessage() )\n        {\n            assert( type() != ResultBase::Ok );\n        }\n\n        template<typename U>\n        static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; }\n        static auto ok() -> BasicResult { return { ResultBase::Ok }; }\n        static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; }\n        static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; }\n\n        explicit operator bool() const { return m_type == ResultBase::Ok; }\n        auto type() const -> ResultBase::Type { return m_type; }\n        auto errorMessage() const -> std::string { return m_errorMessage; }\n\n    protected:\n        void enforceOk() const override {\n\n            // Errors shouldn't reach this point, but if they do\n            // the actual error message will be in m_errorMessage\n            assert( m_type != ResultBase::LogicError );\n            assert( m_type != ResultBase::RuntimeError );\n            if( m_type != ResultBase::Ok )\n                std::abort();\n        }\n\n        std::string m_errorMessage; // Only populated if resultType is an error\n\n        BasicResult( ResultBase::Type type, std::string const &message )\n        :   ResultValueBase<T>(type),\n            m_errorMessage(message)\n        {\n            assert( m_type != ResultBase::Ok );\n        }\n\n        using ResultValueBase<T>::ResultValueBase;\n        using ResultBase::m_type;\n    };\n\n    enum class ParseResultType {\n        Matched, NoMatch, ShortCircuitAll, ShortCircuitSame\n    };\n\n    class ParseState {\n    public:\n\n        ParseState( ParseResultType type, TokenStream const &remainingTokens )\n        : m_type(type),\n          m_remainingTokens( remainingTokens )\n        {}\n\n        auto type() const -> ParseResultType { return m_type; }\n        auto remainingTokens() const -> TokenStream { return m_remainingTokens; }\n\n    private:\n        ParseResultType m_type;\n        TokenStream m_remainingTokens;\n    };\n\n    using Result = BasicResult<void>;\n    using ParserResult = BasicResult<ParseResultType>;\n    using InternalParseResult = BasicResult<ParseState>;\n\n    struct HelpColumns {\n        std::string left;\n        std::string right;\n    };\n\n    template<typename T>\n    inline auto convertInto( std::string const &source, T& target ) -> ParserResult {\n        std::stringstream ss;\n        ss << source;\n        ss >> target;\n        if( ss.fail() )\n            return ParserResult::runtimeError( \"Unable to convert '\" + source + \"' to destination type\" );\n        else\n            return ParserResult::ok( ParseResultType::Matched );\n    }\n    inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult {\n        target = source;\n        return ParserResult::ok( ParseResultType::Matched );\n    }\n    inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {\n        std::string srcLC = source;\n        std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( ::tolower(c) ); } );\n        if (srcLC == \"y\" || srcLC == \"1\" || srcLC == \"true\" || srcLC == \"yes\" || srcLC == \"on\")\n            target = true;\n        else if (srcLC == \"n\" || srcLC == \"0\" || srcLC == \"false\" || srcLC == \"no\" || srcLC == \"off\")\n            target = false;\n        else\n            return ParserResult::runtimeError( \"Expected a boolean value but did not recognise: '\" + source + \"'\" );\n        return ParserResult::ok( ParseResultType::Matched );\n    }\n#ifdef CLARA_CONFIG_OPTIONAL_TYPE\n    template<typename T>\n    inline auto convertInto( std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE<T>& target ) -> ParserResult {\n        T temp;\n        auto result = convertInto( source, temp );\n        if( result )\n            target = std::move(temp);\n        return result;\n    }\n#endif // CLARA_CONFIG_OPTIONAL_TYPE\n\n    struct NonCopyable {\n        NonCopyable() = default;\n        NonCopyable( NonCopyable const & ) = delete;\n        NonCopyable( NonCopyable && ) = delete;\n        NonCopyable &operator=( NonCopyable const & ) = delete;\n        NonCopyable &operator=( NonCopyable && ) = delete;\n    };\n\n    struct BoundRef : NonCopyable {\n        virtual ~BoundRef() = default;\n        virtual auto isContainer() const -> bool { return false; }\n        virtual auto isFlag() const -> bool { return false; }\n    };\n    struct BoundValueRefBase : BoundRef {\n        virtual auto setValue( std::string const &arg ) -> ParserResult = 0;\n    };\n    struct BoundFlagRefBase : BoundRef {\n        virtual auto setFlag( bool flag ) -> ParserResult = 0;\n        virtual auto isFlag() const -> bool { return true; }\n    };\n\n    template<typename T>\n    struct BoundValueRef : BoundValueRefBase {\n        T &m_ref;\n\n        explicit BoundValueRef( T &ref ) : m_ref( ref ) {}\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            return convertInto( arg, m_ref );\n        }\n    };\n\n    template<typename T>\n    struct BoundValueRef<std::vector<T>> : BoundValueRefBase {\n        std::vector<T> &m_ref;\n\n        explicit BoundValueRef( std::vector<T> &ref ) : m_ref( ref ) {}\n\n        auto isContainer() const -> bool override { return true; }\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            T temp;\n            auto result = convertInto( arg, temp );\n            if( result )\n                m_ref.push_back( temp );\n            return result;\n        }\n    };\n\n    struct BoundFlagRef : BoundFlagRefBase {\n        bool &m_ref;\n\n        explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {}\n\n        auto setFlag( bool flag ) -> ParserResult override {\n            m_ref = flag;\n            return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    template<typename ReturnType>\n    struct LambdaInvoker {\n        static_assert( std::is_same<ReturnType, ParserResult>::value, \"Lambda must return void or clara::ParserResult\" );\n\n        template<typename L, typename ArgType>\n        static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {\n            return lambda( arg );\n        }\n    };\n\n    template<>\n    struct LambdaInvoker<void> {\n        template<typename L, typename ArgType>\n        static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {\n            lambda( arg );\n            return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    template<typename ArgType, typename L>\n    inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult {\n        ArgType temp{};\n        auto result = convertInto( arg, temp );\n        return !result\n           ? result\n           : LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( lambda, temp );\n    }\n\n\n    template<typename L>\n    struct BoundLambda : BoundValueRefBase {\n        L m_lambda;\n\n        static_assert( UnaryLambdaTraits<L>::isValid, \"Supplied lambda must take exactly one argument\" );\n        explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {}\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            return invokeLambda<typename UnaryLambdaTraits<L>::ArgType>( m_lambda, arg );\n        }\n    };\n\n    template<typename L>\n    struct BoundFlagLambda : BoundFlagRefBase {\n        L m_lambda;\n\n        static_assert( UnaryLambdaTraits<L>::isValid, \"Supplied lambda must take exactly one argument\" );\n        static_assert( std::is_same<typename UnaryLambdaTraits<L>::ArgType, bool>::value, \"flags must be boolean\" );\n\n        explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {}\n\n        auto setFlag( bool flag ) -> ParserResult override {\n            return LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( m_lambda, flag );\n        }\n    };\n\n    enum class Optionality { Optional, Required };\n\n    struct Parser;\n\n    class ParserBase {\n    public:\n        virtual ~ParserBase() = default;\n        virtual auto validate() const -> Result { return Result::ok(); }\n        virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult  = 0;\n        virtual auto cardinality() const -> size_t { return 1; }\n\n        auto parse( Args const &args ) const -> InternalParseResult {\n            return parse( args.exeName(), TokenStream( args ) );\n        }\n    };\n\n    template<typename DerivedT>\n    class ComposableParserImpl : public ParserBase {\n    public:\n        template<typename T>\n        auto operator|( T const &other ) const -> Parser;\n\n\t\ttemplate<typename T>\n        auto operator+( T const &other ) const -> Parser;\n    };\n\n    // Common code and state for Args and Opts\n    template<typename DerivedT>\n    class ParserRefImpl : public ComposableParserImpl<DerivedT> {\n    protected:\n        Optionality m_optionality = Optionality::Optional;\n        std::shared_ptr<BoundRef> m_ref;\n        std::string m_hint;\n        std::string m_description;\n\n        explicit ParserRefImpl( std::shared_ptr<BoundRef> const &ref ) : m_ref( ref ) {}\n\n    public:\n        template<typename T>\n        ParserRefImpl( T &ref, std::string const &hint )\n        :   m_ref( std::make_shared<BoundValueRef<T>>( ref ) ),\n            m_hint( hint )\n        {}\n\n        template<typename LambdaT>\n        ParserRefImpl( LambdaT const &ref, std::string const &hint )\n        :   m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),\n            m_hint(hint)\n        {}\n\n        auto operator()( std::string const &description ) -> DerivedT & {\n            m_description = description;\n            return static_cast<DerivedT &>( *this );\n        }\n\n        auto optional() -> DerivedT & {\n            m_optionality = Optionality::Optional;\n            return static_cast<DerivedT &>( *this );\n        };\n\n        auto required() -> DerivedT & {\n            m_optionality = Optionality::Required;\n            return static_cast<DerivedT &>( *this );\n        };\n\n        auto isOptional() const -> bool {\n            return m_optionality == Optionality::Optional;\n        }\n\n        auto cardinality() const -> size_t override {\n            if( m_ref->isContainer() )\n                return 0;\n            else\n                return 1;\n        }\n\n        auto hint() const -> std::string { return m_hint; }\n    };\n\n    class ExeName : public ComposableParserImpl<ExeName> {\n        std::shared_ptr<std::string> m_name;\n        std::shared_ptr<BoundValueRefBase> m_ref;\n\n        template<typename LambdaT>\n        static auto makeRef(LambdaT const &lambda) -> std::shared_ptr<BoundValueRefBase> {\n            return std::make_shared<BoundLambda<LambdaT>>( lambda) ;\n        }\n\n    public:\n        ExeName() : m_name( std::make_shared<std::string>( \"<executable>\" ) ) {}\n\n        explicit ExeName( std::string &ref ) : ExeName() {\n            m_ref = std::make_shared<BoundValueRef<std::string>>( ref );\n        }\n\n        template<typename LambdaT>\n        explicit ExeName( LambdaT const& lambda ) : ExeName() {\n            m_ref = std::make_shared<BoundLambda<LambdaT>>( lambda );\n        }\n\n        // The exe name is not parsed out of the normal tokens, but is handled specially\n        auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {\n            return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );\n        }\n\n        auto name() const -> std::string { return *m_name; }\n        auto set( std::string const& newName ) -> ParserResult {\n\n            auto lastSlash = newName.find_last_of( \"\\\\/\" );\n            auto filename = ( lastSlash == std::string::npos )\n                    ? newName\n                    : newName.substr( lastSlash+1 );\n\n            *m_name = filename;\n            if( m_ref )\n                return m_ref->setValue( filename );\n            else\n                return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    class Arg : public ParserRefImpl<Arg> {\n    public:\n        using ParserRefImpl::ParserRefImpl;\n\n        auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override {\n            auto validationResult = validate();\n            if( !validationResult )\n                return InternalParseResult( validationResult );\n\n            auto remainingTokens = tokens;\n            auto const &token = *remainingTokens;\n            if( token.type != TokenType::Argument )\n                return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );\n\n            assert( !m_ref->isFlag() );\n            auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );\n\n            auto result = valueRef->setValue( remainingTokens->token );\n            if( !result )\n                return InternalParseResult( result );\n            else\n                return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );\n        }\n    };\n\n    inline auto normaliseOpt( std::string const &optName ) -> std::string {\n#ifdef CLARA_PLATFORM_WINDOWS\n        if( optName[0] == '/' )\n            return \"-\" + optName.substr( 1 );\n        else\n#endif\n            return optName;\n    }\n\n    class Opt : public ParserRefImpl<Opt> {\n    protected:\n        std::vector<std::string> m_optNames;\n\n    public:\n        template<typename LambdaT>\n        explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared<BoundFlagLambda<LambdaT>>( ref ) ) {}\n\n        explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared<BoundFlagRef>( ref ) ) {}\n\n        template<typename LambdaT>\n        Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}\n\n        template<typename T>\n        Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}\n\n        auto operator[]( std::string const &optName ) -> Opt & {\n            m_optNames.push_back( optName );\n            return *this;\n        }\n\n        auto getHelpColumns() const -> std::vector<HelpColumns> {\n            std::ostringstream oss;\n            bool first = true;\n            for( auto const &opt : m_optNames ) {\n                if (first)\n                    first = false;\n                else\n                    oss << \", \";\n                oss << opt;\n            }\n            if( !m_hint.empty() )\n                oss << \" <\" << m_hint << \">\";\n            return { { oss.str(), m_description } };\n        }\n\n        auto isMatch( std::string const &optToken ) const -> bool {\n            auto normalisedToken = normaliseOpt( optToken );\n            for( auto const &name : m_optNames ) {\n                if( normaliseOpt( name ) == normalisedToken )\n                    return true;\n            }\n            return false;\n        }\n\n        using ParserBase::parse;\n\n        auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {\n            auto validationResult = validate();\n            if( !validationResult )\n                return InternalParseResult( validationResult );\n\n            auto remainingTokens = tokens;\n            if( remainingTokens && remainingTokens->type == TokenType::Option ) {\n                auto const &token = *remainingTokens;\n                if( isMatch(token.token ) ) {\n                    if( m_ref->isFlag() ) {\n                        auto flagRef = static_cast<detail::BoundFlagRefBase*>( m_ref.get() );\n                        auto result = flagRef->setFlag( true );\n                        if( !result )\n                            return InternalParseResult( result );\n                        if( result.value() == ParseResultType::ShortCircuitAll )\n                            return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );\n                    } else {\n                        auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );\n                        ++remainingTokens;\n                        if( !remainingTokens )\n                            return InternalParseResult::runtimeError( \"Expected argument following \" + token.token );\n                        auto const &argToken = *remainingTokens;\n                        if( argToken.type != TokenType::Argument )\n                            return InternalParseResult::runtimeError( \"Expected argument following \" + token.token );\n                        auto result = valueRef->setValue( argToken.token );\n                        if( !result )\n                            return InternalParseResult( result );\n                        if( result.value() == ParseResultType::ShortCircuitAll )\n                            return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );\n                    }\n                    return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );\n                }\n            }\n            return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );\n        }\n\n        auto validate() const -> Result override {\n            if( m_optNames.empty() )\n                return Result::logicError( \"No options supplied to Opt\" );\n            for( auto const &name : m_optNames ) {\n                if( name.empty() )\n                    return Result::logicError( \"Option name cannot be empty\" );\n#ifdef CLARA_PLATFORM_WINDOWS\n                if( name[0] != '-' && name[0] != '/' )\n                    return Result::logicError( \"Option name must begin with '-' or '/'\" );\n#else\n                if( name[0] != '-' )\n                    return Result::logicError( \"Option name must begin with '-'\" );\n#endif\n            }\n            return ParserRefImpl::validate();\n        }\n    };\n\n    struct Help : Opt {\n        Help( bool &showHelpFlag )\n        :   Opt([&]( bool flag ) {\n                showHelpFlag = flag;\n                return ParserResult::ok( ParseResultType::ShortCircuitAll );\n            })\n        {\n            static_cast<Opt &>( *this )\n                    (\"display usage information\")\n                    [\"-?\"][\"-h\"][\"--help\"]\n                    .optional();\n        }\n    };\n\n\n    struct Parser : ParserBase {\n\n        mutable ExeName m_exeName;\n        std::vector<Opt> m_options;\n        std::vector<Arg> m_args;\n\n        auto operator|=( ExeName const &exeName ) -> Parser & {\n            m_exeName = exeName;\n            return *this;\n        }\n\n        auto operator|=( Arg const &arg ) -> Parser & {\n            m_args.push_back(arg);\n            return *this;\n        }\n\n        auto operator|=( Opt const &opt ) -> Parser & {\n            m_options.push_back(opt);\n            return *this;\n        }\n\n        auto operator|=( Parser const &other ) -> Parser & {\n            m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end());\n            m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end());\n            return *this;\n        }\n\n        template<typename T>\n        auto operator|( T const &other ) const -> Parser {\n            return Parser( *this ) |= other;\n        }\n\n        // Forward deprecated interface with '+' instead of '|'\n        template<typename T>\n        auto operator+=( T const &other ) -> Parser & { return operator|=( other ); }\n        template<typename T>\n        auto operator+( T const &other ) const -> Parser { return operator|( other ); }\n\n        auto getHelpColumns() const -> std::vector<HelpColumns> {\n            std::vector<HelpColumns> cols;\n            for (auto const &o : m_options) {\n                auto childCols = o.getHelpColumns();\n                cols.insert( cols.end(), childCols.begin(), childCols.end() );\n            }\n            return cols;\n        }\n\n        void writeToStream( std::ostream &os ) const {\n            if (!m_exeName.name().empty()) {\n                os << \"usage:\\n\" << \"  \" << m_exeName.name() << \" \";\n                bool required = true, first = true;\n                for( auto const &arg : m_args ) {\n                    if (first)\n                        first = false;\n                    else\n                        os << \" \";\n                    if( arg.isOptional() && required ) {\n                        os << \"[\";\n                        required = false;\n                    }\n                    os << \"<\" << arg.hint() << \">\";\n                    if( arg.cardinality() == 0 )\n                        os << \" ... \";\n                }\n                if( !required )\n                    os << \"]\";\n                if( !m_options.empty() )\n                    os << \" options\";\n                os << \"\\n\\nwhere options are:\" << std::endl;\n            }\n\n            auto rows = getHelpColumns();\n            size_t consoleWidth = CLARA_CONFIG_CONSOLE_WIDTH;\n            size_t optWidth = 0;\n            for( auto const &cols : rows )\n                optWidth = (std::max)(optWidth, cols.left.size() + 2);\n\n            optWidth = (std::min)(optWidth, consoleWidth/2);\n\n            for( auto const &cols : rows ) {\n                auto row =\n                        TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) +\n                        TextFlow::Spacer(4) +\n                        TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth );\n                os << row << std::endl;\n            }\n        }\n\n        friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& {\n            parser.writeToStream( os );\n            return os;\n        }\n\n        auto validate() const -> Result override {\n            for( auto const &opt : m_options ) {\n                auto result = opt.validate();\n                if( !result )\n                    return result;\n            }\n            for( auto const &arg : m_args ) {\n                auto result = arg.validate();\n                if( !result )\n                    return result;\n            }\n            return Result::ok();\n        }\n\n        using ParserBase::parse;\n\n        auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override {\n\n            struct ParserInfo {\n                ParserBase const* parser = nullptr;\n                size_t count = 0;\n            };\n            const size_t totalParsers = m_options.size() + m_args.size();\n            assert( totalParsers < 512 );\n            // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do\n            ParserInfo parseInfos[512];\n\n            {\n                size_t i = 0;\n                for (auto const &opt : m_options) parseInfos[i++].parser = &opt;\n                for (auto const &arg : m_args) parseInfos[i++].parser = &arg;\n            }\n\n            m_exeName.set( exeName );\n\n            auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );\n            while( result.value().remainingTokens() ) {\n                bool tokenParsed = false;\n\n                for( size_t i = 0; i < totalParsers; ++i ) {\n                    auto&  parseInfo = parseInfos[i];\n                    if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) {\n                        result = parseInfo.parser->parse(exeName, result.value().remainingTokens());\n                        if (!result)\n                            return result;\n                        if (result.value().type() != ParseResultType::NoMatch) {\n                            tokenParsed = true;\n                            ++parseInfo.count;\n                            break;\n                        }\n                    }\n                }\n\n                if( result.value().type() == ParseResultType::ShortCircuitAll )\n                    return result;\n                if( !tokenParsed )\n                    return InternalParseResult::runtimeError( \"Unrecognised token: \" + result.value().remainingTokens()->token );\n            }\n            // !TBD Check missing required options\n            return result;\n        }\n    };\n\n    template<typename DerivedT>\n    template<typename T>\n    auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {\n        return Parser() | static_cast<DerivedT const &>( *this ) | other;\n    }\n} // namespace detail\n\n\n// A Combined parser\nusing detail::Parser;\n\n// A parser for options\nusing detail::Opt;\n\n// A parser for arguments\nusing detail::Arg;\n\n// Wrapper for argc, argv from main()\nusing detail::Args;\n\n// Specifies the name of the executable\nusing detail::ExeName;\n\n// Convenience wrapper for option parser that specifies the help option\nusing detail::Help;\n\n// enum of result types from a parse\nusing detail::ParseResultType;\n\n// Result type for parser operation\nusing detail::ParserResult;\n\n\n} // namespace clara\n\n#endif // CLARA_HPP_INCLUDED\n"
  },
  {
    "path": "src/ClaraTests.cpp",
    "content": "#include \"clara.hpp\"\n\n#include \"catch.hpp\"\n\n#include <iostream>\n\nusing namespace clara;\n\nnamespace Catch {\ntemplate<>\nstruct StringMaker<clara::detail::InternalParseResult> {\n    static std::string convert( clara::detail::InternalParseResult const& result ) {\n        switch( result.type() ) {\n            case clara::detail::ResultBase::Ok:\n                return \"Ok\";\n            case clara::detail::ResultBase::LogicError:\n                return \"LogicError '\" + result.errorMessage() + \"'\";\n            case clara::detail::ResultBase::RuntimeError:\n                return \"RuntimeError: '\" + result.errorMessage() + \"'\";\n            default:\n                return \"Unknow type: \" + std::to_string( static_cast<int>( result.type() ) );\n        }\n    }\n};\n}\n\nstd::string toString( Opt const& opt ) {\n    std::ostringstream oss;\n    oss << (Parser() | opt);\n    return oss.str();\n}\nstd::string toString( Parser const& p ) {\n    std::ostringstream oss;\n    oss << p;\n    return oss.str();\n}\n\n// !TBD\n// for Catch:\n// error on unrecognised?\n\n// Beyond Catch:\n// exceptions or not\n// error on unmet requireds\n// enum mapping\n// sets of values (in addition to vectors)\n// arg literals\n// --help for option names/ args/ arg literals\n// other dependencies/ hierarchical parsers\n// Exclusive() parser for choices\n\nTEST_CASE( \"single parsers\" ) {\n\n    std::string name;\n    auto p = Opt(name, \"name\")\n        [\"-n\"][\"--name\"]\n        (\"the name to use\");\n\n    REQUIRE( name == \"\" );\n\n    SECTION( \"-n\" ) {\n        p.parse( Args{ \"TestApp\", \"-n\", \"Vader\" } );\n        REQUIRE( name == \"Vader\");\n    }\n    SECTION( \"--name\" ) {\n        p.parse( Args{ \"TestApp\", \"--name\", \"Vader\" } );\n        REQUIRE( name == \"Vader\");\n    }\n    SECTION( \"-n:\" ) {\n        p.parse( Args{ \"TestApp\", \"-n:Vader\" } );\n        REQUIRE( name == \"Vader\");\n    }\n    SECTION( \"-n=\" ) {\n        p.parse( Args{ \"TestApp\", \"-n=Vader\" } );\n        REQUIRE( name == \"Vader\");\n    }\n    SECTION( \"no args\" ) {\n        p.parse( Args{ \"TestApp\" } );\n        REQUIRE( name == \"\");\n    }\n    SECTION( \"different args\" ) {\n        p.parse( Args{ \"TestApp\", \"-f\" } );\n        REQUIRE( name == \"\");\n    }\n}\n\nstruct Config {\n    int m_rngSeed;\n    std::string m_name;\n    std::vector<std::string> m_tests;\n    bool m_flag = false;\n    double m_value = 0;\n};\n\nTEST_CASE( \"Combined parser\" ) {\n    Config config;\n\n    bool showHelp = false;\n    auto parser\n            = Help( showHelp )\n            | Opt( config.m_rngSeed, \"time|value\" )\n                [\"--rng-seed\"][\"-r\"]\n                (\"set a specific seed for random numbers\" )\n                .required()\n            | Opt( config.m_name, \"name\" )\n                [\"-n\"][\"--name\"]\n                ( \"the name to use\" )\n            | Opt( config.m_flag )\n                [\"-f\"][\"--flag\"]\n                ( \"a flag to set\" )\n            | Opt( [&]( double value ){ config.m_value = value; }, \"number\" )\n                [\"-d\"][\"--double\"]\n                ( \"just some number\" )\n            | Arg( config.m_tests, \"test name|tags|pattern\" )\n                ( \"which test or tests to use\" );\n\n    SECTION( \"usage\" ) {\n        REQUIRE(toString(parser) ==\n                    \"usage:\\n\"\n                    \"  <executable> [<test name|tags|pattern> ... ] options\\n\"\n                    \"\\n\"\n                    \"where options are:\\n\"\n                    \"  -?, -h, --help                 display usage information\\n\"\n                    \"  --rng-seed, -r <time|value>    set a specific seed for random numbers\\n\"\n                    \"  -n, --name <name>              the name to use\\n\"\n                    \"  -f, --flag                     a flag to set\\n\"\n                    \"  -d, --double <number>          just some number\\n\"\n        );\n    }\n    SECTION( \"some args\" ) {\n        auto result = parser.parse( Args{ \"TestApp\", \"-n\", \"Bill\", \"-d:123.45\", \"-f\", \"test1\", \"test2\" } );\n        CHECK( result );\n        CHECK( result.value().type() == ParseResultType::Matched );\n\n        REQUIRE( config.m_name == \"Bill\" );\n        REQUIRE( config.m_value == 123.45 );\n        REQUIRE( config.m_tests == std::vector<std::string> { \"test1\", \"test2\" } );\n        CHECK( showHelp == false );\n    }\n    SECTION( \"help\" ) {\n        auto result = parser.parse( Args{ \"TestApp\", \"-?\", \"-n:NotSet\" } );\n        CHECK( result );\n        CHECK( result.value().type() == ParseResultType::ShortCircuitAll );\n        CHECK( config.m_name == \"\" ); // We should never have processed -n:NotSet\n        CHECK( showHelp == true );\n    }\n}\n\nstruct TestOpt {\n    std::string processName;\n    std::string fileName;\n    int number = 0;\n    int index = 0;\n    bool flag = false;\n    std::string firstPos;\n    std::string secondPos;\n    std::vector<std::string> unpositional;\n\n    auto makeCli() -> Parser {\n        return ExeName( processName )\n          | Opt( fileName, \"filename\" )\n              [\"-o\"][\"--output\"]\n              ( \"specifies output file\" )\n          | Opt( number, \"an integral value\" )\n              [\"-n\"]\n          | Opt( [&]( int i ) {\n                    if (i < 0 || i > 10)\n                        return ParserResult::runtimeError(\"index must be between 0 and 10\");\n                    else {\n                        index = i;\n                        return ParserResult::ok( ParseResultType::Matched );\n                    }\n                }, \"index\" )\n              [\"-i\"]\n              ( \"An index, which is an integer between 0 and 10, inclusive\" )\n          | Opt( flag )\n              [\"-f\"]\n              ( \"A flag\" )\n          | Arg( firstPos, \"first arg\" )\n              ( \"First position\" )\n          | Arg( secondPos, \"second arg\" )\n              ( \"Second position\" );\n    }\n};\n\nstruct TestOpt2 {\n    std::string description;\n};\n\nTEST_CASE( \"cmdline\" ) {\n\n    TestOpt config;\n    auto cli = config.makeCli();\n\n    SECTION( \"exe name\" ) {\n        auto result = cli.parse( { \"TestApp\", \"-o\", \"filename.ext\" } );\n        CHECK( result );\n        CHECK( config.processName == \"TestApp\" );\n    }\n    SECTION( \"args\" ) {\n        auto result = cli.parse( { \"TestApp\", \"-o\", \"filename.ext\" } );\n        CHECK( result );\n        CHECK( config.fileName == \"filename.ext\" );\n    }\n    SECTION( \"arg separated by colon\" ) {\n        auto result = cli.parse( { \"TestApp\", \"-o:filename.ext\" } );\n        CHECK( result );\n        CHECK( config.fileName == \"filename.ext\" );\n    }\n    SECTION( \"arg separated by =\" ) {\n        auto result = cli.parse( { \"TestApp\", \"-o=filename.ext\" } );\n        CHECK( result );\n        CHECK( config.fileName == \"filename.ext\" );\n    }\n    SECTION( \"long opt\" ) {\n        auto result = cli.parse( { \"TestApp\", \"--output\", \"%stdout\" } );\n        CHECK( result );\n        CHECK( config.fileName == \"%stdout\" );\n    }\n    SECTION( \"a number\" ) {\n        auto result = cli.parse( { \"TestApp\", \"-n\", \"42\" } );\n        CHECK( result );\n        CHECK( config.number == 42 );\n    }\n    SECTION( \"not a number\" ) {\n        auto result = cli.parse( { \"TestApp\", \"-n\", \"forty-two\" } );\n        CHECK( !result );\n        CHECK( result.errorMessage() == \"Unable to convert 'forty-two' to destination type\" );\n\n        CHECK( config.number == 0 );\n    }\n\n    SECTION( \"methods\" ) {\n\n        SECTION( \"in range\" ) {\n            auto result = cli.parse( { \"TestApp\", \"-i\", \"3\" } );\n            CHECK( result );\n\n            REQUIRE( config.index == 3 );\n        }\n        SECTION( \"out of range\" ) {\n            auto result = cli.parse( { \"TestApp\", \"-i\", \"42\" } );\n            CHECK( !result );\n            CHECK( result.errorMessage() == \"index must be between 0 and 10\" );\n        }\n    }\n\n    SECTION( \"flags\" ) {\n\n        SECTION(\"set\") {\n            auto result = cli.parse({ \"TestApp\", \"-f\" });\n            CHECK( result );\n\n            REQUIRE(config.flag);\n        }\n        SECTION(\"not set\") {\n            auto result = cli.parse({ \"TestApp\" });\n            CHECK( result );\n            CHECK( result.value().type() == ParseResultType::NoMatch);\n\n            REQUIRE(config.flag == false);\n        }\n\n        SECTION( \"arg before flag\" )\n        {\n            auto result = cli.parse({ \"TestApp\", \"-f\", \"something\" });\n            REQUIRE( result );\n            REQUIRE( config.flag );\n            REQUIRE( config.firstPos == \"something\" );\n        }\n\n        SECTION(\"following flag\")\n        {\n            auto result = cli.parse({ \"TestApp\", \"something\", \"-f\" });\n            REQUIRE( result );\n            REQUIRE( config.flag );\n            REQUIRE( config.firstPos == \"something\" );\n        }\n\n        SECTION(\"no flag\")\n        {\n            auto result = cli.parse({ \"TestApp\", \"something\" });\n            REQUIRE( result );\n            REQUIRE( config.flag == false );\n            REQUIRE( config.firstPos == \"something\" );\n        }\n    }\n\n#ifdef CLARA_PLATFORM_WINDOWS\n    SECTION( \"forward slash\" ) {\n        auto result = cli.parse( { \"TestApp\", \"/f\" } );\n        CHECK(result);\n\n        REQUIRE( config.flag );\n    }\n#endif\n\n    SECTION( \"args\" ) {\n\n        auto result = cli.parse( { \"TestApp\", \"-f\", \"1st\", \"-o\", \"filename\", \"2nd\" } );\n        CHECK( result );\n\n        REQUIRE( config.firstPos == \"1st\" );\n        REQUIRE( config.secondPos == \"2nd\" );\n    }\n}\n\nTEST_CASE( \"flag parser\" ) {\n\n    bool flag = false;\n    auto p = Opt( flag, \"true|false\" )\n            [\"-f\"]\n            (\"A flag\");\n\n    SECTION( \"set flag with true\" ) {\n        auto result = p.parse( {\"TestApp\", \"-f\", \"true\"} );\n        REQUIRE( result );\n        REQUIRE( flag );\n    }\n    SECTION( \"set flag with yes\" ) {\n        auto result = p.parse( {\"TestApp\", \"-f\", \"yes\"} );\n        REQUIRE( result );\n        REQUIRE( flag );\n    }\n    SECTION( \"set flag with y\" ) {\n        auto result = p.parse( {\"TestApp\", \"-f\", \"y\"} );\n        REQUIRE( result );\n        REQUIRE( flag );\n    }\n    SECTION( \"set flag with 1\" ) {\n        auto result = p.parse( {\"TestApp\", \"-f\", \"1\"} );\n        REQUIRE( result );\n        REQUIRE( flag );\n    }\n    SECTION( \"set flag with on\" ) {\n        auto result = p.parse( {\"TestApp\", \"-f\", \"on\"} );\n        REQUIRE( result );\n        REQUIRE( flag );\n    }\n    SECTION( \"set flag with tRUe\" ) {\n        auto result = p.parse( {\"TestApp\", \"-f\", \"tRUe\"} );\n        REQUIRE( result );\n        REQUIRE( flag );\n    }\n\n    SECTION( \"unset flag with false\" ) {\n        flag = true;\n        auto result = p.parse( {\"TestApp\", \"-f\", \"false\"} );\n        REQUIRE( result) ;\n        REQUIRE( flag == false );\n    }\n    SECTION( \"invalid inputs\" ) {\n        using namespace Catch::Matchers;\n        auto result = p.parse( {\"TestApp\", \"-f\", \"what\"} );\n        REQUIRE( !result ) ;\n        REQUIRE_THAT( result.errorMessage(), Contains( \"Expected a boolean value\" ) );\n\n        result = p.parse( {\"TestApp\", \"-f\"} );\n        REQUIRE( !result ) ;\n        REQUIRE_THAT( result.errorMessage(), Contains( \"Expected argument following -f\" ) );\n    }\n}\n\nTEST_CASE( \"usage\", \"[.]\" ) {\n\n    TestOpt config;\n    auto cli = config.makeCli();\n    std::cout << cli << std::endl;\n}\n\nTEST_CASE( \"Invalid parsers\" )\n{\n    using namespace Catch::Matchers;\n\n    TestOpt config;\n\n    SECTION( \"no options\" )\n    {\n        auto cli = Opt( config.number, \"number\" );\n        auto result = cli.parse( { \"TestApp\", \"-o\", \"filename\" } );\n        CHECK( !result );\n        CHECK( result.errorMessage() == \"No options supplied to Opt\" );\n    }\n    SECTION( \"no option name\" )\n    {\n        auto cli = Opt( config.number, \"number\" )[\"\"];\n        auto result = cli.parse( { \"TestApp\", \"-o\", \"filename\" } );\n        CHECK( !result );\n        CHECK( result.errorMessage() == \"Option name cannot be empty\" );\n    }\n    SECTION( \"invalid option name\" )\n    {\n        auto cli = Opt( config.number, \"number\" )[\"invalid\"];\n        auto result = cli.parse( { \"TestApp\", \"-o\", \"filename\" } );\n        CHECK( !result );\n        CHECK_THAT( result.errorMessage(), StartsWith( \"Option name must begin with '-'\" ) );\n    }\n}\n\nTEST_CASE( \"Multiple flags\" ) {\n    bool a = false, b = false, c = false;\n    auto cli = Opt( a )[\"-a\"] | Opt( b )[\"-b\"] | Opt( c )[\"-c\"];\n\n    SECTION( \"separately\" ) {\n        auto result = cli.parse({ \"TestApp\", \"-a\", \"-b\", \"-c\" });\n        CHECK(result);\n        CHECK(a);\n        CHECK(b);\n        CHECK(c);\n    }\n    SECTION( \"combined\" ) {\n        auto result = cli.parse({ \"TestApp\", \"-abc\" });\n        CHECK(result);\n        CHECK(a);\n        CHECK(b);\n        CHECK(c);\n    }\n}\n\nTEST_CASE( \"Unrecognised opts\" ) {\n    using namespace Catch::Matchers;\n\n    bool a = false;\n    Parser cli = Parser() | Opt( a )[\"-a\"];\n\n    auto result = cli.parse( { \"TestApp\", \"-b\" } );\n    CHECK( !result );\n    CHECK_THAT( result.errorMessage(), Contains( \"Unrecognised token\") && Contains( \"-b\" ) );\n}\n\nTEST_CASE( \"char* args\" ) {\n\n    std::string value;\n    Parser cli = Parser() | Arg( value, \"value\" );\n\n    SECTION( \"char*\" ) {\n        char* args[] = { (char*)\"TestApp\", (char*)\"hello\" };\n\n        auto result = cli.parse( Args( 2, args ) );\n        REQUIRE( result );\n        REQUIRE( value == \"hello\" );\n    }\n    SECTION( \"char*\" ) {\n        const char* args[] = { \"TestApp\", \"hello\" };\n\n        auto result = cli.parse( Args( 2, args ) );\n        REQUIRE( result );\n        REQUIRE( value == \"hello\" );\n    }\n}\n\nTEST_CASE( \"different widths\" ) {\n\n    std::string s;\n\n    auto shortOpt\n        = Opt( s, \"short\" )\n           [\"-s\"][\"--short\"]\n           ( \"not much\" );\n    auto longHint\n        = Opt( s, \"A very very long hint that should force the whole line to wrap awkwardly. I hope no-one ever writes anything like thus - but there's always *someone*\" )\n           [\"-x\"]\n           (\"short description\");\n\n    auto longDesc\n        = Opt( s, \"hint\")\n            [\"-y\"]\n            ( \"In this one it's the description field that is really really long. We should be split over several lines, but complete the description before starting to show the next option\" );\n\n    auto longOptName\n            = Opt( s, \"hint\")\n            [\"--this-one-just-has-an-overly-long-option-name-that-should-push-the-left-hand-column-out\"]\n            ( \"short desc\" );\n\n    auto longEverything\n        = Opt( s, \"this is really over the top, but it has to be tested. In this case we have a very long hint (far longer than anyone should ever even think of using), which should be enough to wrap just on its own...\")\n            [\"--and-a-ridiculously-long-long-option-name-that-would-be-silly-to-write-but-hey-if-it-can-handle-this-it-can-handle-anything-right\"]\n            ( \"*and* a stupid long description, which seems a bit redundant give all the other verbosity. But some people just love to write. And read. You have to be prepared to do a lot of both for this to be useful.\");\n\n    SECTION( \"long hint\" )\n        REQUIRE_NOTHROW( toString( longHint ) == \"?\" );\n\n    SECTION( \"long desc\" )\n        REQUIRE_NOTHROW( toString( longDesc ) );\n\n    SECTION( \"long opt name\" )\n        REQUIRE_NOTHROW( toString( longOptName ) == \"?\" );\n\n    SECTION( \"long everything\" )\n        REQUIRE_NOTHROW( toString( longEverything ) == \"?\" );\n}\n\nTEST_CASE( \"newlines in description\" ) {\n\n    SECTION( \"single, long description\" ) {\n        int i;\n        auto opt = Opt(i, \"i\")[\"-i\"](\n                \"This string should be long enough to force a wrap in the first instance. But what we really want to test is where if we put an explicit newline in the string, say, here\\nthat it is formatted correctly\");\n\n        REQUIRE(toString(opt) ==\n                \"usage:\\n\"\n                        \"  <executable>  options\\n\"\n                        \"\\n\"\n                        \"where options are:\\n\"\n                        \"  -i <i>    This string should be long enough to force a wrap in the first\\n\"\n                        \"            instance. But what we really want to test is where if we put an\\n\"\n                        \"            explicit newline in the string, say, here\\n\"\n                        \"            that it is formatted correctly\\n\");\n    }\n    SECTION( \"multiple entries\" ) {\n        int a,b,c;\n        auto p\n            = Opt(a, \"a\")\n                [\"-a\"][\"--longishOption\"]\n                (\"A description with:\\nA new line right in the middle\")\n            | Opt(b, \"b\")\n                [\"-b\"][\"--bb\"]\n                (\"This description also has\\nA new line\")\n              | Opt(c, \"c\")\n                [\"-c\"][\"--cc\"]\n                (\"Another\\nnewline. In fact this one has line-wraps, as well as mutiple\\nnewlines and\\n\\n- leading hyphens\");\n\n        REQUIRE(toString(p) ==\n                \"usage:\\n\"\n                        \"  <executable>  options\\n\"\n                        \"\\n\"\n                        \"where options are:\\n\"\n                        \"  -a, --longishOption <a>    A description with:\\n\"\n                        \"                             A new line right in the middle\\n\"\n                        \"  -b, --bb <b>               This description also has\\n\"\n                        \"                             A new line\\n\"\n                        \"  -c, --cc <c>               Another\\n\"\n                        \"                             newline. In fact this one has line-wraps, as\\n\"\n                        \"                             well as mutiple\\n\"\n                        \"                             newlines and\\n\"\n                        \"                             \\n\"\n                        \"                             - leading hyphens\\n\");\n\n\n\n    }\n}\n\n#if defined(CLARA_CONFIG_OPTIONAL_TYPE)\nTEST_CASE(\"Reading into std::optional\") {\n    CLARA_CONFIG_OPTIONAL_TYPE<std::string> name;\n    auto p = Opt(name, \"name\")\n        [\"-n\"][\"--name\"]\n        (\"the name to use\");\n    SECTION(\"Not set\") {\n        auto result = p.parse(Args{ \"TestApp\", \"-q\", \"Pixie\" });\n        REQUIRE( result );\n        REQUIRE_FALSE( name.has_value() );\n    }\n    SECTION(\"Provided\") {\n        auto result = p.parse(Args{ \"TestApp\", \"-n\", \"Pixie\" });\n        REQUIRE( result );\n        REQUIRE( name.has_value() );\n        REQUIRE( name.value() == \"Pixie\" );\n    }\n}\n#endif // CLARA_CONFIG_OPTIONAL_TYPE\n"
  },
  {
    "path": "src/main.cpp",
    "content": "#define CATCH_CONFIG_MAIN\n#include \"catch.hpp\"\n"
  },
  {
    "path": "third_party/TextFlow.hpp",
    "content": "// TextFlowCpp\n//\n// A single-header library for wrapping and laying out basic text, by Phil Nash\n//\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n//\n// This project is hosted at https://github.com/philsquared/textflowcpp\n\n#ifndef TEXTFLOW_HPP_INCLUDED\n#define TEXTFLOW_HPP_INCLUDED\n\n#include <cassert>\n#include <ostream>\n#include <sstream>\n#include <vector>\n\n#ifndef TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#define TEXTFLOW_CONFIG_CONSOLE_WIDTH 80\n#endif\n\n\nnamespace TextFlow {\n\n    inline auto isWhitespace( char c ) -> bool {\n        static std::string chars = \" \\t\\n\\r\";\n        return chars.find( c ) != std::string::npos;\n    }\n    inline auto isBreakableBefore( char c ) -> bool {\n        static std::string chars = \"[({<|\";\n        return chars.find( c ) != std::string::npos;\n    }\n    inline auto isBreakableAfter( char c ) -> bool {\n        static std::string chars = \"])}>.,:;*+-=&/\\\\\";\n        return chars.find( c ) != std::string::npos;\n    }\n\n    class Columns;\n\n    class Column {\n        std::vector<std::string> m_strings;\n        size_t m_width = TEXTFLOW_CONFIG_CONSOLE_WIDTH;\n        size_t m_indent = 0;\n        size_t m_initialIndent = std::string::npos;\n\n    public:\n        class iterator {\n            friend Column;\n\n            Column const& m_column;\n            size_t m_stringIndex = 0;\n            size_t m_pos = 0;\n\n            size_t m_len = 0;\n            size_t m_end = 0;\n            bool m_suffix = false;\n\n            iterator( Column const& column, size_t stringIndex )\n            :   m_column( column ),\n                m_stringIndex( stringIndex )\n            {}\n\n            auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }\n\n            auto isBoundary( size_t at ) const -> bool {\n                assert( at > 0 );\n                assert( at <= line().size() );\n\n                return at == line().size() ||\n                       ( isWhitespace( line()[at] ) && !isWhitespace( line()[at-1] ) ) ||\n                       isBreakableBefore( line()[at] ) ||\n                       isBreakableAfter( line()[at-1] );\n            }\n\n            void calcLength() {\n                assert( m_stringIndex < m_column.m_strings.size() );\n\n                m_suffix = false;\n                auto width = m_column.m_width-indent();\n                m_end = m_pos;\n                while( m_end < line().size() && line()[m_end] != '\\n' )\n                    ++m_end;\n\n                if( m_end < m_pos + width ) {\n                    m_len = m_end - m_pos;\n                }\n                else {\n                    size_t len = width;\n                    while (len > 0 && !isBoundary(m_pos + len))\n                        --len;\n                    while (len > 0 && isWhitespace( line()[m_pos + len - 1] ))\n                        --len;\n\n                    if (len > 0) {\n                        m_len = len;\n                    } else {\n                        m_suffix = true;\n                        m_len = width - 1;\n                    }\n                }\n            }\n\n            auto indent() const -> size_t {\n                auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;\n                return initial == std::string::npos ? m_column.m_indent : initial;\n            }\n\n            auto addIndentAndSuffix(std::string const &plain) const -> std::string {\n                return std::string( indent(), ' ' ) + (m_suffix ? plain + \"-\" : plain);\n            }\n\n        public:\n            using difference_type = std::ptrdiff_t;\n            using value_type = std::string;\n            using pointer = value_type*;\n            using reference = value_type&;\n            using iterator_category = std::forward_iterator_tag;\n\n            explicit iterator( Column const& column ) : m_column( column ) {\n                assert( m_column.m_width > m_column.m_indent );\n                assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );\n                calcLength();\n                if( m_len == 0 )\n                    m_stringIndex++; // Empty string\n            }\n\n            auto operator *() const -> std::string {\n                assert( m_stringIndex < m_column.m_strings.size() );\n                assert( m_pos <= m_end );\n                return addIndentAndSuffix(line().substr(m_pos, m_len));\n            }\n\n            auto operator ++() -> iterator& {\n                m_pos += m_len;\n                if( m_pos < line().size() && line()[m_pos] == '\\n' )\n                    m_pos += 1;\n                else\n                    while( m_pos < line().size() && isWhitespace( line()[m_pos] ) )\n                        ++m_pos;\n\n                if( m_pos == line().size() ) {\n                    m_pos = 0;\n                    ++m_stringIndex;\n                }\n                if( m_stringIndex < m_column.m_strings.size() )\n                    calcLength();\n                return *this;\n            }\n            auto operator ++(int) -> iterator {\n                iterator prev( *this );\n                operator++();\n                return prev;\n            }\n\n            auto operator ==( iterator const& other ) const -> bool {\n                return\n                    m_pos == other.m_pos &&\n                    m_stringIndex == other.m_stringIndex &&\n                    &m_column == &other.m_column;\n            }\n            auto operator !=( iterator const& other ) const -> bool {\n                return !operator==( other );\n            }\n        };\n        using const_iterator = iterator;\n\n        explicit Column( std::string const& text ) { m_strings.push_back( text ); }\n\n        auto width( size_t newWidth ) -> Column& {\n            assert( newWidth > 0 );\n            m_width = newWidth;\n            return *this;\n        }\n        auto indent( size_t newIndent ) -> Column& {\n            m_indent = newIndent;\n            return *this;\n        }\n        auto initialIndent( size_t newIndent ) -> Column& {\n            m_initialIndent = newIndent;\n            return *this;\n        }\n\n        auto width() const -> size_t { return m_width; }\n        auto begin() const -> iterator { return iterator( *this ); }\n        auto end() const -> iterator { return { *this, m_strings.size() }; }\n\n        inline friend std::ostream& operator << ( std::ostream& os, Column const& col ) {\n            bool first = true;\n            for( auto line : col ) {\n                if( first )\n                    first = false;\n                else\n                    os << \"\\n\";\n                os <<  line;\n            }\n            return os;\n        }\n\n        auto operator + ( Column const& other ) -> Columns;\n\n        auto toString() const -> std::string {\n            std::ostringstream oss;\n            oss << *this;\n            return oss.str();\n        }\n    };\n\n    class Spacer : public Column {\n\n    public:\n        explicit Spacer( size_t spaceWidth ) : Column( \"\" ) {\n            width( spaceWidth );\n        }\n    };\n\n    class Columns {\n        std::vector<Column> m_columns;\n\n    public:\n\n        class iterator {\n            friend Columns;\n            struct EndTag {};\n\n            std::vector<Column> const& m_columns;\n            std::vector<Column::iterator> m_iterators;\n            size_t m_activeIterators;\n\n            iterator( Columns const& columns, EndTag )\n            :   m_columns( columns.m_columns ),\n                m_activeIterators( 0 )\n            {\n                m_iterators.reserve( m_columns.size() );\n\n                for( auto const& col : m_columns )\n                    m_iterators.push_back( col.end() );\n            }\n\n        public:\n            using difference_type = std::ptrdiff_t;\n            using value_type = std::string;\n            using pointer = value_type*;\n            using reference = value_type&;\n            using iterator_category = std::forward_iterator_tag;\n\n            explicit iterator( Columns const& columns )\n            :   m_columns( columns.m_columns ),\n                m_activeIterators( m_columns.size() )\n            {\n                m_iterators.reserve( m_columns.size() );\n\n                for( auto const& col : m_columns )\n                    m_iterators.push_back( col.begin() );\n            }\n\n            auto operator ==( iterator const& other ) const -> bool {\n                return m_iterators == other.m_iterators;\n            }\n            auto operator !=( iterator const& other ) const -> bool {\n                return m_iterators != other.m_iterators;\n            }\n            auto operator *() const -> std::string {\n                std::string row, padding;\n\n                for( size_t i = 0; i < m_columns.size(); ++i ) {\n                    auto width = m_columns[i].width();\n                    if( m_iterators[i] != m_columns[i].end() ) {\n                        std::string col = *m_iterators[i];\n                        row += padding + col;\n                        if( col.size() < width )\n                            padding = std::string( width - col.size(), ' ' );\n                        else\n                            padding = \"\";\n                    }\n                    else {\n                        padding += std::string( width, ' ' );\n                    }\n                }\n                return row;\n            }\n            auto operator ++() -> iterator& {\n                for( size_t i = 0; i < m_columns.size(); ++i ) {\n                    if (m_iterators[i] != m_columns[i].end())\n                        ++m_iterators[i];\n                }\n                return *this;\n            }\n            auto operator ++(int) -> iterator {\n                iterator prev( *this );\n                operator++();\n                return prev;\n            }\n        };\n        using const_iterator = iterator;\n\n        auto begin() const -> iterator { return iterator( *this ); }\n        auto end() const -> iterator { return { *this, iterator::EndTag() }; }\n\n        auto operator += ( Column const& col ) -> Columns& {\n            m_columns.push_back( col );\n            return *this;\n        }\n        auto operator + ( Column const& col ) -> Columns {\n            Columns combined = *this;\n            combined += col;\n            return combined;\n        }\n\n        inline friend std::ostream& operator << ( std::ostream& os, Columns const& cols ) {\n\n            bool first = true;\n            for( auto line : cols ) {\n                if( first )\n                    first = false;\n                else\n                    os << \"\\n\";\n                os << line;\n            }\n            return os;\n        }\n\n        auto toString() const -> std::string {\n            std::ostringstream oss;\n            oss << *this;\n            return oss.str();\n        }\n    };\n\n    inline auto Column::operator + ( Column const& other ) -> Columns {\n        Columns cols;\n        cols += *this;\n        cols += other;\n        return cols;\n    }\n}\n\n#endif // TEXTFLOW_HPP_INCLUDED\n"
  },
  {
    "path": "third_party/catch.hpp",
    "content": "/*\n *  Catch v2.1.0\n *  Generated: 2018-01-10 13:51:15.378034\n *  ----------------------------------------------------------\n *  This file has been merged from multiple headers. Please don't edit it directly\n *  Copyright (c) 2018 Two Blue Cubes Ltd. All rights reserved.\n *\n *  Distributed under the Boost Software License, Version 1.0. (See accompanying\n *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n */\n#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n// start catch.hpp\n\n\n#ifdef __clang__\n#    pragma clang system_header\n#elif defined __GNUC__\n#    pragma GCC system_header\n#endif\n\n// start catch_suppress_warnings.h\n\n#ifdef __clang__\n#   ifdef __ICC // icpc defines the __clang__ macro\n#       pragma warning(push)\n#       pragma warning(disable: 161 1682)\n#   else // __ICC\n#       pragma clang diagnostic ignored \"-Wunused-variable\"\n#       pragma clang diagnostic push\n#       pragma clang diagnostic ignored \"-Wpadded\"\n#       pragma clang diagnostic ignored \"-Wswitch-enum\"\n#       pragma clang diagnostic ignored \"-Wcovered-switch-default\"\n#    endif\n#elif defined __GNUC__\n#    pragma GCC diagnostic ignored \"-Wunused-variable\"\n#    pragma GCC diagnostic ignored \"-Wparentheses\"\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wpadded\"\n#endif\n// end catch_suppress_warnings.h\n#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)\n#  define CATCH_IMPL\n#  define CATCH_CONFIG_ALL_PARTS\n#endif\n\n// In the impl file, we want to have access to all parts of the headers\n// Can also be used to sanely support PCHs\n#if defined(CATCH_CONFIG_ALL_PARTS)\n#  define CATCH_CONFIG_EXTERNAL_INTERFACES\n#  if defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#    undef CATCH_CONFIG_DISABLE_MATCHERS\n#  endif\n#  define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER\n#endif\n\n#if !defined(CATCH_CONFIG_IMPL_ONLY)\n// start catch_platform.h\n\n#ifdef __APPLE__\n# include <TargetConditionals.h>\n# if TARGET_OS_OSX == 1\n#  define CATCH_PLATFORM_MAC\n# elif TARGET_OS_IPHONE == 1\n#  define CATCH_PLATFORM_IPHONE\n# endif\n\n#elif defined(linux) || defined(__linux) || defined(__linux__)\n#  define CATCH_PLATFORM_LINUX\n\n#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER)\n#  define CATCH_PLATFORM_WINDOWS\n#endif\n\n// end catch_platform.h\n\n#ifdef CATCH_IMPL\n#  ifndef CLARA_CONFIG_MAIN\n#    define CLARA_CONFIG_MAIN_NOT_DEFINED\n#    define CLARA_CONFIG_MAIN\n#  endif\n#endif\n\n// start catch_user_interfaces.h\n\nnamespace Catch {\n    unsigned int rngSeed();\n}\n\n// end catch_user_interfaces.h\n// start catch_tag_alias_autoregistrar.h\n\n// start catch_common.h\n\n// start catch_compiler_capabilities.h\n\n// Detect a number of compiler features - by compiler\n// The following features are defined:\n//\n// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?\n// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?\n// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?\n// ****************\n// Note to maintainers: if new toggles are added please document them\n// in configuration.md, too\n// ****************\n\n// In general each macro has a _NO_<feature name> form\n// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature.\n// Many features, at point of detection, define an _INTERNAL_ macro, so they\n// can be combined, en-mass, with the _NO_ forms later.\n\n#ifdef __cplusplus\n\n#  if __cplusplus >= 201402L\n#    define CATCH_CPP14_OR_GREATER\n#  endif\n\n#endif\n\n#ifdef __clang__\n\n#       define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n            _Pragma( \"clang diagnostic push\" ) \\\n            _Pragma( \"clang diagnostic ignored \\\"-Wexit-time-destructors\\\"\" ) \\\n            _Pragma( \"clang diagnostic ignored \\\"-Wglobal-constructors\\\"\")\n#       define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \\\n            _Pragma( \"clang diagnostic pop\" )\n\n#       define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \\\n            _Pragma( \"clang diagnostic push\" ) \\\n            _Pragma( \"clang diagnostic ignored \\\"-Wparentheses\\\"\" )\n#       define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \\\n            _Pragma( \"clang diagnostic pop\" )\n\n#endif // __clang__\n\n////////////////////////////////////////////////////////////////////////////////\n// We know some environments not to support full POSIX signals\n#if defined(__CYGWIN__) || defined(__QNX__)\n\n#   if !defined(CATCH_CONFIG_POSIX_SIGNALS)\n#       define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS\n#   endif\n\n#endif\n\n#ifdef __OS400__\n#       define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS\n#       define CATCH_CONFIG_COLOUR_NONE\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// Cygwin\n#ifdef __CYGWIN__\n\n// Required for some versions of Cygwin to declare gettimeofday\n// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin\n#   define _BSD_SOURCE\n\n#endif // __CYGWIN__\n\n////////////////////////////////////////////////////////////////////////////////\n// Visual C++\n#ifdef _MSC_VER\n\n// Universal Windows platform does not support SEH\n// Or console colours (or console at all...)\n#  if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)\n#    define CATCH_CONFIG_COLOUR_NONE\n#  else\n#    define CATCH_INTERNAL_CONFIG_WINDOWS_SEH\n#  endif\n\n#endif // _MSC_VER\n\n////////////////////////////////////////////////////////////////////////////////\n\n// Use of __COUNTER__ is suppressed during code analysis in\n// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly\n// handled by it.\n// Otherwise all supported compilers support COUNTER macro,\n// but user still might want to turn it off\n#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L )\n    #define CATCH_INTERNAL_CONFIG_COUNTER\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)\n#   define CATCH_CONFIG_COUNTER\n#endif\n#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH)\n#   define CATCH_CONFIG_WINDOWS_SEH\n#endif\n// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.\n#if !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)\n#   define CATCH_CONFIG_POSIX_SIGNALS\n#endif\n\n#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS\n#   define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS\n#endif\n#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS\n#   define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\n#endif\n\n// end catch_compiler_capabilities.h\n#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line\n#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )\n#ifdef CATCH_CONFIG_COUNTER\n#  define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )\n#else\n#  define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )\n#endif\n\n#include <iosfwd>\n#include <string>\n#include <cstdint>\n\nnamespace Catch {\n\n    struct CaseSensitive { enum Choice {\n        Yes,\n        No\n    }; };\n\n    class NonCopyable {\n        NonCopyable( NonCopyable const& )              = delete;\n        NonCopyable( NonCopyable && )                  = delete;\n        NonCopyable& operator = ( NonCopyable const& ) = delete;\n        NonCopyable& operator = ( NonCopyable && )     = delete;\n\n    protected:\n        NonCopyable();\n        virtual ~NonCopyable();\n    };\n\n    struct SourceLineInfo {\n\n        SourceLineInfo() = delete;\n        SourceLineInfo( char const* _file, std::size_t _line ) noexcept\n        :   file( _file ),\n            line( _line )\n        {}\n\n        SourceLineInfo( SourceLineInfo const& other )        = default;\n        SourceLineInfo( SourceLineInfo && )                  = default;\n        SourceLineInfo& operator = ( SourceLineInfo const& ) = default;\n        SourceLineInfo& operator = ( SourceLineInfo && )     = default;\n\n        bool empty() const noexcept;\n        bool operator == ( SourceLineInfo const& other ) const noexcept;\n        bool operator < ( SourceLineInfo const& other ) const noexcept;\n\n        char const* file;\n        std::size_t line;\n    };\n\n    std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );\n\n    // Use this in variadic streaming macros to allow\n    //    >> +StreamEndStop\n    // as well as\n    //    >> stuff +StreamEndStop\n    struct StreamEndStop {\n        std::string operator+() const;\n    };\n    template<typename T>\n    T const& operator + ( T const& value, StreamEndStop ) {\n        return value;\n    }\n}\n\n#define CATCH_INTERNAL_LINEINFO \\\n    ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )\n\n// end catch_common.h\nnamespace Catch {\n\n    struct RegistrarForTagAliases {\n        RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo );\n    };\n\n} // end namespace Catch\n\n#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \\\n    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n    namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \\\n    CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\n\n// end catch_tag_alias_autoregistrar.h\n// start catch_test_registry.h\n\n// start catch_interfaces_testcase.h\n\n#include <vector>\n#include <memory>\n\nnamespace Catch {\n\n    class TestSpec;\n\n    struct ITestInvoker {\n        virtual void invoke () const = 0;\n        virtual ~ITestInvoker();\n    };\n\n    using ITestCasePtr = std::shared_ptr<ITestInvoker>;\n\n    class TestCase;\n    struct IConfig;\n\n    struct ITestCaseRegistry {\n        virtual ~ITestCaseRegistry();\n        virtual std::vector<TestCase> const& getAllTests() const = 0;\n        virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const = 0;\n    };\n\n    bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );\n    std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );\n    std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );\n\n}\n\n// end catch_interfaces_testcase.h\n// start catch_stringref.h\n\n#include <cstddef>\n#include <string>\n#include <iosfwd>\n\nnamespace Catch {\n\n    class StringData;\n\n    /// A non-owning string class (similar to the forthcoming std::string_view)\n    /// Note that, because a StringRef may be a substring of another string,\n    /// it may not be null terminated. c_str() must return a null terminated\n    /// string, however, and so the StringRef will internally take ownership\n    /// (taking a copy), if necessary. In theory this ownership is not externally\n    /// visible - but it does mean (substring) StringRefs should not be shared between\n    /// threads.\n    class StringRef {\n    public:\n        using size_type = std::size_t;\n\n    private:\n        friend struct StringRefTestAccess;\n\n        char const* m_start;\n        size_type m_size;\n\n        char* m_data = nullptr;\n\n        void takeOwnership();\n\n        static constexpr char const* const s_empty = \"\";\n\n    public: // construction/ assignment\n        StringRef() noexcept\n        :   StringRef( s_empty, 0 )\n        {}\n\n        StringRef( StringRef const& other ) noexcept\n        :   m_start( other.m_start ),\n            m_size( other.m_size )\n        {}\n\n        StringRef( StringRef&& other ) noexcept\n        :   m_start( other.m_start ),\n            m_size( other.m_size ),\n            m_data( other.m_data )\n        {\n            other.m_data = nullptr;\n        }\n\n        StringRef( char const* rawChars ) noexcept;\n\n        StringRef( char const* rawChars, size_type size ) noexcept\n        :   m_start( rawChars ),\n            m_size( size )\n        {}\n\n        StringRef( std::string const& stdString ) noexcept\n        :   m_start( stdString.c_str() ),\n            m_size( stdString.size() )\n        {}\n\n        ~StringRef() noexcept {\n            delete[] m_data;\n        }\n\n        auto operator = ( StringRef const &other ) noexcept -> StringRef& {\n            delete[] m_data;\n            m_data = nullptr;\n            m_start = other.m_start;\n            m_size = other.m_size;\n            return *this;\n        }\n\n        operator std::string() const;\n\n        void swap( StringRef& other ) noexcept;\n\n    public: // operators\n        auto operator == ( StringRef const& other ) const noexcept -> bool;\n        auto operator != ( StringRef const& other ) const noexcept -> bool;\n\n        auto operator[] ( size_type index ) const noexcept -> char;\n\n    public: // named queries\n        auto empty() const noexcept -> bool {\n            return m_size == 0;\n        }\n        auto size() const noexcept -> size_type {\n            return m_size;\n        }\n\n        auto numberOfCharacters() const noexcept -> size_type;\n        auto c_str() const -> char const*;\n\n    public: // substrings and searches\n        auto substr( size_type start, size_type size ) const noexcept -> StringRef;\n\n    private: // ownership queries - may not be consistent between calls\n        auto isOwned() const noexcept -> bool;\n        auto isSubstring() const noexcept -> bool;\n        auto data() const noexcept -> char const*;\n    };\n\n    auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string;\n    auto operator + ( StringRef const& lhs, char const* rhs ) -> std::string;\n    auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string;\n\n    auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&;\n\n    inline auto operator \"\" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {\n        return StringRef( rawChars, size );\n    }\n\n} // namespace Catch\n\n// end catch_stringref.h\nnamespace Catch {\n\ntemplate<typename C>\nclass TestInvokerAsMethod : public ITestInvoker {\n    void (C::*m_testAsMethod)();\npublic:\n    TestInvokerAsMethod( void (C::*testAsMethod)() ) noexcept : m_testAsMethod( testAsMethod ) {}\n\n    void invoke() const override {\n        C obj;\n        (obj.*m_testAsMethod)();\n    }\n};\n\nauto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker*;\n\ntemplate<typename C>\nauto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* {\n    return new(std::nothrow) TestInvokerAsMethod<C>( testAsMethod );\n}\n\nstruct NameAndTags {\n    NameAndTags( StringRef name_ = StringRef(), StringRef tags_ = StringRef() ) noexcept;\n    StringRef name;\n    StringRef tags;\n};\n\nstruct AutoReg : NonCopyable {\n    AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept;\n    ~AutoReg();\n};\n\n} // end namespace Catch\n\n#if defined(CATCH_CONFIG_DISABLE)\n    #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \\\n        static void TestName()\n    #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \\\n        namespace{                        \\\n            struct TestName : ClassName { \\\n                void test();              \\\n            };                            \\\n        }                                 \\\n        void TestName::test()\n\n#endif\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \\\n        static void TestName(); \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, \"\", Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \\\n        CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \\\n        static void TestName()\n    #define INTERNAL_CATCH_TESTCASE( ... ) \\\n        INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, \"&\" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \\\n        CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        namespace{ \\\n            struct TestName : ClassName{ \\\n                void test(); \\\n            }; \\\n            Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \\\n        } \\\n        CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \\\n        void TestName::test()\n    #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \\\n        INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, \"\", Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \\\n        CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\n\n// end catch_test_registry.h\n// start catch_capture.hpp\n\n// start catch_assertionhandler.h\n\n// start catch_assertioninfo.h\n\n// start catch_result_type.h\n\nnamespace Catch {\n\n    // ResultWas::OfType enum\n    struct ResultWas { enum OfType {\n        Unknown = -1,\n        Ok = 0,\n        Info = 1,\n        Warning = 2,\n\n        FailureBit = 0x10,\n\n        ExpressionFailed = FailureBit | 1,\n        ExplicitFailure = FailureBit | 2,\n\n        Exception = 0x100 | FailureBit,\n\n        ThrewException = Exception | 1,\n        DidntThrowException = Exception | 2,\n\n        FatalErrorCondition = 0x200 | FailureBit\n\n    }; };\n\n    bool isOk( ResultWas::OfType resultType );\n    bool isJustInfo( int flags );\n\n    // ResultDisposition::Flags enum\n    struct ResultDisposition { enum Flags {\n        Normal = 0x01,\n\n        ContinueOnFailure = 0x02,   // Failures fail test, but execution continues\n        FalseTest = 0x04,           // Prefix expression with !\n        SuppressFail = 0x08         // Failures are reported but do not fail the test\n    }; };\n\n    ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs );\n\n    bool shouldContinueOnFailure( int flags );\n    inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }\n    bool shouldSuppressFailure( int flags );\n\n} // end namespace Catch\n\n// end catch_result_type.h\nnamespace Catch {\n\n    struct AssertionInfo\n    {\n        StringRef macroName;\n        SourceLineInfo lineInfo;\n        StringRef capturedExpression;\n        ResultDisposition::Flags resultDisposition;\n\n        // We want to delete this constructor but a compiler bug in 4.8 means\n        // the struct is then treated as non-aggregate\n        //AssertionInfo() = delete;\n    };\n\n} // end namespace Catch\n\n// end catch_assertioninfo.h\n// start catch_decomposer.h\n\n// start catch_tostring.h\n\n#include <vector>\n#include <cstddef>\n#include <type_traits>\n#include <string>\n// start catch_stream.h\n\n#include <iosfwd>\n#include <cstddef>\n#include <ostream>\n\nnamespace Catch {\n\n    std::ostream& cout();\n    std::ostream& cerr();\n    std::ostream& clog();\n\n    class StringRef;\n\n    struct IStream {\n        virtual ~IStream();\n        virtual std::ostream& stream() const = 0;\n    };\n\n    auto makeStream( StringRef const &filename ) -> IStream const*;\n\n    class ReusableStringStream {\n        std::size_t m_index;\n        std::ostream* m_oss;\n    public:\n        ReusableStringStream();\n        ~ReusableStringStream();\n\n        auto str() const -> std::string;\n\n        template<typename T>\n        auto operator << ( T const& value ) -> ReusableStringStream& {\n            *m_oss << value;\n            return *this;\n        }\n        auto get() -> std::ostream& { return *m_oss; }\n\n        static void cleanup();\n    };\n}\n\n// end catch_stream.h\n\n#ifdef __OBJC__\n// start catch_objc_arc.hpp\n\n#import <Foundation/Foundation.h>\n\n#ifdef __has_feature\n#define CATCH_ARC_ENABLED __has_feature(objc_arc)\n#else\n#define CATCH_ARC_ENABLED 0\n#endif\n\nvoid arcSafeRelease( NSObject* obj );\nid performOptionalSelector( id obj, SEL sel );\n\n#if !CATCH_ARC_ENABLED\ninline void arcSafeRelease( NSObject* obj ) {\n    [obj release];\n}\ninline id performOptionalSelector( id obj, SEL sel ) {\n    if( [obj respondsToSelector: sel] )\n        return [obj performSelector: sel];\n    return nil;\n}\n#define CATCH_UNSAFE_UNRETAINED\n#define CATCH_ARC_STRONG\n#else\ninline void arcSafeRelease( NSObject* ){}\ninline id performOptionalSelector( id obj, SEL sel ) {\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Warc-performSelector-leaks\"\n#endif\n    if( [obj respondsToSelector: sel] )\n        return [obj performSelector: sel];\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n    return nil;\n}\n#define CATCH_UNSAFE_UNRETAINED __unsafe_unretained\n#define CATCH_ARC_STRONG __strong\n#endif\n\n// end catch_objc_arc.hpp\n#endif\n\n#ifdef _MSC_VER\n#pragma warning(push)\n#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless\n#endif\n\n// We need a dummy global operator<< so we can bring it into Catch namespace later\nstruct Catch_global_namespace_dummy {};\nstd::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);\n\nnamespace Catch {\n    // Bring in operator<< from global namespace into Catch namespace\n    using ::operator<<;\n\n    namespace Detail {\n\n        extern const std::string unprintableString;\n\n        std::string rawMemoryToString( const void *object, std::size_t size );\n\n        template<typename T>\n        std::string rawMemoryToString( const T& object ) {\n          return rawMemoryToString( &object, sizeof(object) );\n        }\n\n        template<typename T>\n        class IsStreamInsertable {\n            template<typename SS, typename TT>\n            static auto test(int)\n                -> decltype(std::declval<SS&>() << std::declval<TT>(), std::true_type());\n\n            template<typename, typename>\n            static auto test(...)->std::false_type;\n\n        public:\n            static const bool value = decltype(test<std::ostream, const T&>(0))::value;\n        };\n\n        template<typename E>\n        std::string convertUnknownEnumToString( E e );\n\n        template<typename T>\n        typename std::enable_if<!std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& ) {\n            return Detail::unprintableString;\n        };\n        template<typename T>\n        typename std::enable_if<std::is_enum<T>::value, std::string>::type convertUnstreamable( T const& value ) {\n            return convertUnknownEnumToString( value );\n        };\n\n    } // namespace Detail\n\n    // If we decide for C++14, change these to enable_if_ts\n    template <typename T, typename = void>\n    struct StringMaker {\n        template <typename Fake = T>\n        static\n        typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type\n            convert(const Fake& value) {\n                ReusableStringStream rss;\n                rss << value;\n                return rss.str();\n        }\n\n        template <typename Fake = T>\n        static\n        typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type\n            convert( const Fake& value ) {\n                return Detail::convertUnstreamable( value );\n        }\n    };\n\n    namespace Detail {\n\n        // This function dispatches all stringification requests inside of Catch.\n        // Should be preferably called fully qualified, like ::Catch::Detail::stringify\n        template <typename T>\n        std::string stringify(const T& e) {\n            return ::Catch::StringMaker<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::convert(e);\n        }\n\n        template<typename E>\n        std::string convertUnknownEnumToString( E e ) {\n            return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<E>::type>(e));\n        }\n\n    } // namespace Detail\n\n    // Some predefined specializations\n\n    template<>\n    struct StringMaker<std::string> {\n        static std::string convert(const std::string& str);\n    };\n    template<>\n    struct StringMaker<std::wstring> {\n        static std::string convert(const std::wstring& wstr);\n    };\n\n    template<>\n    struct StringMaker<char const *> {\n        static std::string convert(char const * str);\n    };\n    template<>\n    struct StringMaker<char *> {\n        static std::string convert(char * str);\n    };\n    template<>\n    struct StringMaker<wchar_t const *> {\n        static std::string convert(wchar_t const * str);\n    };\n    template<>\n    struct StringMaker<wchar_t *> {\n        static std::string convert(wchar_t * str);\n    };\n\n    template<typename T>\n    struct is_string_array : std::false_type {};\n\n    template<std::size_t N>\n    struct is_string_array<char[N]> : std::true_type {};\n\n    template<std::size_t N>\n    struct is_string_array<signed char[N]> : std::true_type {};\n\n        template<std::size_t N>\n    struct is_string_array<unsigned char[N]> : std::true_type {};\n\n    template<int SZ>\n    struct StringMaker<char[SZ]> {\n        static std::string convert(const char* str) {\n            return ::Catch::Detail::stringify(std::string{ str });\n        }\n    };\n    template<int SZ>\n    struct StringMaker<signed char[SZ]> {\n        static std::string convert(const char* str) {\n            return ::Catch::Detail::stringify(std::string{ str });\n        }\n    };\n    template<int SZ>\n    struct StringMaker<unsigned char[SZ]> {\n        static std::string convert(const char* str) {\n            return ::Catch::Detail::stringify(std::string{ str });\n        }\n    };\n\n    template<>\n    struct StringMaker<int> {\n        static std::string convert(int value);\n    };\n    template<>\n    struct StringMaker<long> {\n        static std::string convert(long value);\n    };\n    template<>\n    struct StringMaker<long long> {\n        static std::string convert(long long value);\n    };\n    template<>\n    struct StringMaker<unsigned int> {\n        static std::string convert(unsigned int value);\n    };\n    template<>\n    struct StringMaker<unsigned long> {\n        static std::string convert(unsigned long value);\n    };\n    template<>\n    struct StringMaker<unsigned long long> {\n        static std::string convert(unsigned long long value);\n    };\n\n    template<>\n    struct StringMaker<bool> {\n        static std::string convert(bool b);\n    };\n\n    template<>\n    struct StringMaker<char> {\n        static std::string convert(char c);\n    };\n    template<>\n    struct StringMaker<signed char> {\n        static std::string convert(signed char c);\n    };\n    template<>\n    struct StringMaker<unsigned char> {\n        static std::string convert(unsigned char c);\n    };\n\n    template<>\n    struct StringMaker<std::nullptr_t> {\n        static std::string convert(std::nullptr_t);\n    };\n\n    template<>\n    struct StringMaker<float> {\n        static std::string convert(float value);\n    };\n    template<>\n    struct StringMaker<double> {\n        static std::string convert(double value);\n    };\n\n    template <typename T>\n    struct StringMaker<T*> {\n        template <typename U>\n        static std::string convert(U* p) {\n            if (p) {\n                return ::Catch::Detail::rawMemoryToString(p);\n            } else {\n                return \"nullptr\";\n            }\n        }\n    };\n\n    template <typename R, typename C>\n    struct StringMaker<R C::*> {\n        static std::string convert(R C::* p) {\n            if (p) {\n                return ::Catch::Detail::rawMemoryToString(p);\n            } else {\n                return \"nullptr\";\n            }\n        }\n    };\n\n    namespace Detail {\n        template<typename InputIterator>\n        std::string rangeToString(InputIterator first, InputIterator last) {\n            ReusableStringStream rss;\n            rss << \"{ \";\n            if (first != last) {\n                rss << ::Catch::Detail::stringify(*first);\n                for (++first; first != last; ++first)\n                    rss << \", \" << ::Catch::Detail::stringify(*first);\n            }\n            rss << \" }\";\n            return rss.str();\n        }\n    }\n\n#ifdef __OBJC__\n    template<>\n    struct StringMaker<NSString*> {\n        static std::string convert(NSString * nsstring) {\n            if (!nsstring)\n                return \"nil\";\n            return std::string(\"@\") + [nsstring UTF8String];\n        }\n    };\n    template<>\n    struct StringMaker<NSObject*> {\n        static std::string convert(NSObject* nsObject) {\n            return ::Catch::Detail::stringify([nsObject description]);\n        }\n\n    };\n    namespace Detail {\n        inline std::string stringify( NSString* nsstring ) {\n            return StringMaker<NSString*>::convert( nsstring );\n        }\n\n    } // namespace Detail\n#endif // __OBJC__\n\n} // namespace Catch\n\n//////////////////////////////////////////////////////\n// Separate std-lib types stringification, so it can be selectively enabled\n// This means that we do not bring in\n\n#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS)\n#  define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER\n#  define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER\n#  define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER\n#endif\n\n// Separate std::pair specialization\n#if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER)\n#include <utility>\nnamespace Catch {\n    template<typename T1, typename T2>\n    struct StringMaker<std::pair<T1, T2> > {\n        static std::string convert(const std::pair<T1, T2>& pair) {\n            ReusableStringStream rss;\n            rss << \"{ \"\n                << ::Catch::Detail::stringify(pair.first)\n                << \", \"\n                << ::Catch::Detail::stringify(pair.second)\n                << \" }\";\n            return rss.str();\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER\n\n// Separate std::tuple specialization\n#if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER)\n#include <tuple>\nnamespace Catch {\n    namespace Detail {\n        template<\n            typename Tuple,\n            std::size_t N = 0,\n            bool = (N < std::tuple_size<Tuple>::value)\n            >\n            struct TupleElementPrinter {\n            static void print(const Tuple& tuple, std::ostream& os) {\n                os << (N ? \", \" : \" \")\n                    << ::Catch::Detail::stringify(std::get<N>(tuple));\n                TupleElementPrinter<Tuple, N + 1>::print(tuple, os);\n            }\n        };\n\n        template<\n            typename Tuple,\n            std::size_t N\n        >\n            struct TupleElementPrinter<Tuple, N, false> {\n            static void print(const Tuple&, std::ostream&) {}\n        };\n\n    }\n\n    template<typename ...Types>\n    struct StringMaker<std::tuple<Types...>> {\n        static std::string convert(const std::tuple<Types...>& tuple) {\n            ReusableStringStream rss;\n            rss << '{';\n            Detail::TupleElementPrinter<std::tuple<Types...>>::print(tuple, rss.get());\n            rss << \" }\";\n            return rss.str();\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER\n\nnamespace Catch {\n    struct not_this_one {}; // Tag type for detecting which begin/ end are being selected\n\n    // Import begin/ end from std here so they are considered alongside the fallback (...) overloads in this namespace\n    using std::begin;\n    using std::end;\n\n    not_this_one begin( ... );\n    not_this_one end( ... );\n\n    template <typename T>\n    struct is_range {\n        static const bool value =\n            !std::is_same<decltype(begin(std::declval<T>())), not_this_one>::value &&\n            !std::is_same<decltype(end(std::declval<T>())), not_this_one>::value;\n    };\n\n    template<typename Range>\n    std::string rangeToString( Range const& range ) {\n        return ::Catch::Detail::rangeToString( begin( range ), end( range ) );\n    }\n\n    // Handle vector<bool> specially\n    template<typename Allocator>\n    std::string rangeToString( std::vector<bool, Allocator> const& v ) {\n        ReusableStringStream rss;\n        rss << \"{ \";\n        bool first = true;\n        for( bool b : v ) {\n            if( first )\n                first = false;\n            else\n                rss << \", \";\n            rss << ::Catch::Detail::stringify( b );\n        }\n        rss << \" }\";\n        return rss.str();\n    }\n\n    template<typename R>\n    struct StringMaker<R, typename std::enable_if<is_range<R>::value && !is_string_array<R>::value>::type> {\n        static std::string convert( R const& range ) {\n            return rangeToString( range );\n        }\n    };\n\n} // namespace Catch\n\n// Separate std::chrono::duration specialization\n#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)\n#include <ctime>\n#include <ratio>\n#include <chrono>\n\nnamespace Catch {\n\ntemplate <class Ratio>\nstruct ratio_string {\n    static std::string symbol();\n};\n\ntemplate <class Ratio>\nstd::string ratio_string<Ratio>::symbol() {\n    Catch::ReusableStringStream rss;\n    rss << '[' << Ratio::num << '/'\n        << Ratio::den << ']';\n    return rss.str();\n}\ntemplate <>\nstruct ratio_string<std::atto> {\n    static std::string symbol();\n};\ntemplate <>\nstruct ratio_string<std::femto> {\n    static std::string symbol();\n};\ntemplate <>\nstruct ratio_string<std::pico> {\n    static std::string symbol();\n};\ntemplate <>\nstruct ratio_string<std::nano> {\n    static std::string symbol();\n};\ntemplate <>\nstruct ratio_string<std::micro> {\n    static std::string symbol();\n};\ntemplate <>\nstruct ratio_string<std::milli> {\n    static std::string symbol();\n};\n\n    ////////////\n    // std::chrono::duration specializations\n    template<typename Value, typename Ratio>\n    struct StringMaker<std::chrono::duration<Value, Ratio>> {\n        static std::string convert(std::chrono::duration<Value, Ratio> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << ' ' << ratio_string<Ratio>::symbol() << 's';\n            return rss.str();\n        }\n    };\n    template<typename Value>\n    struct StringMaker<std::chrono::duration<Value, std::ratio<1>>> {\n        static std::string convert(std::chrono::duration<Value, std::ratio<1>> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << \" s\";\n            return rss.str();\n        }\n    };\n    template<typename Value>\n    struct StringMaker<std::chrono::duration<Value, std::ratio<60>>> {\n        static std::string convert(std::chrono::duration<Value, std::ratio<60>> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << \" m\";\n            return rss.str();\n        }\n    };\n    template<typename Value>\n    struct StringMaker<std::chrono::duration<Value, std::ratio<3600>>> {\n        static std::string convert(std::chrono::duration<Value, std::ratio<3600>> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << \" h\";\n            return rss.str();\n        }\n    };\n\n    ////////////\n    // std::chrono::time_point specialization\n    // Generic time_point cannot be specialized, only std::chrono::time_point<system_clock>\n    template<typename Clock, typename Duration>\n    struct StringMaker<std::chrono::time_point<Clock, Duration>> {\n        static std::string convert(std::chrono::time_point<Clock, Duration> const& time_point) {\n            return ::Catch::Detail::stringify(time_point.time_since_epoch()) + \" since epoch\";\n        }\n    };\n    // std::chrono::time_point<system_clock> specialization\n    template<typename Duration>\n    struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> {\n        static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) {\n            auto converted = std::chrono::system_clock::to_time_t(time_point);\n\n#ifdef _MSC_VER\n            std::tm timeInfo = {};\n            gmtime_s(&timeInfo, &converted);\n#else\n            std::tm* timeInfo = std::gmtime(&converted);\n#endif\n\n            auto const timeStampSize = sizeof(\"2017-01-16T17:06:45Z\");\n            char timeStamp[timeStampSize];\n            const char * const fmt = \"%Y-%m-%dT%H:%M:%SZ\";\n\n#ifdef _MSC_VER\n            std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);\n#else\n            std::strftime(timeStamp, timeStampSize, fmt, timeInfo);\n#endif\n            return std::string(timeStamp);\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER\n\n#ifdef _MSC_VER\n#pragma warning(pop)\n#endif\n\n// end catch_tostring.h\n#include <iosfwd>\n\n#ifdef _MSC_VER\n#pragma warning(push)\n#pragma warning(disable:4389) // '==' : signed/unsigned mismatch\n#pragma warning(disable:4018) // more \"signed/unsigned mismatch\"\n#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)\n#pragma warning(disable:4180) // qualifier applied to function type has no meaning\n#endif\n\nnamespace Catch {\n\n    struct ITransientExpression {\n        auto isBinaryExpression() const -> bool { return m_isBinaryExpression; }\n        auto getResult() const -> bool { return m_result; }\n        virtual void streamReconstructedExpression( std::ostream &os ) const = 0;\n\n        ITransientExpression( bool isBinaryExpression, bool result )\n        :   m_isBinaryExpression( isBinaryExpression ),\n            m_result( result )\n        {}\n\n        // We don't actually need a virtual destructor, but many static analysers\n        // complain if it's not here :-(\n        virtual ~ITransientExpression();\n\n        bool m_isBinaryExpression;\n        bool m_result;\n\n    };\n\n    void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );\n\n    template<typename LhsT, typename RhsT>\n    class BinaryExpr  : public ITransientExpression {\n        LhsT m_lhs;\n        StringRef m_op;\n        RhsT m_rhs;\n\n        void streamReconstructedExpression( std::ostream &os ) const override {\n            formatReconstructedExpression\n                    ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) );\n        }\n\n    public:\n        BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs )\n        :   ITransientExpression{ true, comparisonResult },\n            m_lhs( lhs ),\n            m_op( op ),\n            m_rhs( rhs )\n        {}\n    };\n\n    template<typename LhsT>\n    class UnaryExpr : public ITransientExpression {\n        LhsT m_lhs;\n\n        void streamReconstructedExpression( std::ostream &os ) const override {\n            os << Catch::Detail::stringify( m_lhs );\n        }\n\n    public:\n        explicit UnaryExpr( LhsT lhs )\n        :   ITransientExpression{ false, lhs ? true : false },\n            m_lhs( lhs )\n        {}\n    };\n\n    // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)\n    template<typename LhsT, typename RhsT>\n    auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return lhs == rhs; };\n    template<typename T>\n    auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }\n    template<typename T>\n    auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }\n    template<typename T>\n    auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }\n    template<typename T>\n    auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }\n\n    template<typename LhsT, typename RhsT>\n    auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return lhs != rhs; };\n    template<typename T>\n    auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }\n    template<typename T>\n    auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }\n    template<typename T>\n    auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }\n    template<typename T>\n    auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }\n\n    template<typename LhsT>\n    class ExprLhs {\n        LhsT m_lhs;\n    public:\n        explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {}\n\n        template<typename RhsT>\n        auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { compareEqual( m_lhs, rhs ), m_lhs, \"==\", rhs };\n        }\n        auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const {\n            return { m_lhs == rhs, m_lhs, \"==\", rhs };\n        }\n\n        template<typename RhsT>\n        auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { compareNotEqual( m_lhs, rhs ), m_lhs, \"!=\", rhs };\n        }\n        auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const {\n            return { m_lhs != rhs, m_lhs, \"!=\", rhs };\n        }\n\n        template<typename RhsT>\n        auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { m_lhs > rhs, m_lhs, \">\", rhs };\n        }\n        template<typename RhsT>\n        auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { m_lhs < rhs, m_lhs, \"<\", rhs };\n        }\n        template<typename RhsT>\n        auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { m_lhs >= rhs, m_lhs, \">=\", rhs };\n        }\n        template<typename RhsT>\n        auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { m_lhs <= rhs, m_lhs, \"<=\", rhs };\n        }\n\n        auto makeUnaryExpr() const -> UnaryExpr<LhsT> {\n            return UnaryExpr<LhsT>{ m_lhs };\n        }\n    };\n\n    void handleExpression( ITransientExpression const& expr );\n\n    template<typename T>\n    void handleExpression( ExprLhs<T> const& expr ) {\n        handleExpression( expr.makeUnaryExpr() );\n    }\n\n    struct Decomposer {\n        template<typename T>\n        auto operator <= ( T const& lhs ) -> ExprLhs<T const&> {\n            return ExprLhs<T const&>{ lhs };\n        }\n\n        auto operator <=( bool value ) -> ExprLhs<bool> {\n            return ExprLhs<bool>{ value };\n        }\n    };\n\n} // end namespace Catch\n\n#ifdef _MSC_VER\n#pragma warning(pop)\n#endif\n\n// end catch_decomposer.h\n// start catch_interfaces_capture.h\n\n#include <string>\n\nnamespace Catch {\n\n    class AssertionResult;\n    struct AssertionInfo;\n    struct SectionInfo;\n    struct SectionEndInfo;\n    struct MessageInfo;\n    struct Counts;\n    struct BenchmarkInfo;\n    struct BenchmarkStats;\n    struct AssertionReaction;\n\n    struct ITransientExpression;\n\n    struct IResultCapture {\n\n        virtual ~IResultCapture();\n\n        virtual bool sectionStarted(    SectionInfo const& sectionInfo,\n                                        Counts& assertions ) = 0;\n        virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;\n        virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;\n\n        virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0;\n        virtual void benchmarkEnded( BenchmarkStats const& stats ) = 0;\n\n        virtual void pushScopedMessage( MessageInfo const& message ) = 0;\n        virtual void popScopedMessage( MessageInfo const& message ) = 0;\n\n        virtual void handleFatalErrorCondition( StringRef message ) = 0;\n\n        virtual void handleExpr\n                (   AssertionInfo const& info,\n                    ITransientExpression const& expr,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleMessage\n                (   AssertionInfo const& info,\n                    ResultWas::OfType resultType,\n                    StringRef const& message,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleUnexpectedExceptionNotThrown\n                (   AssertionInfo const& info,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleUnexpectedInflightException\n                (   AssertionInfo const& info,\n                    std::string const& message,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleIncomplete\n                (   AssertionInfo const& info ) = 0;\n        virtual void handleNonExpr\n                (   AssertionInfo const &info,\n                    ResultWas::OfType resultType,\n                    AssertionReaction &reaction ) = 0;\n\n        virtual bool lastAssertionPassed() = 0;\n        virtual void assertionPassed() = 0;\n\n        // Deprecated, do not use:\n        virtual std::string getCurrentTestName() const = 0;\n        virtual const AssertionResult* getLastResult() const = 0;\n        virtual void exceptionEarlyReported() = 0;\n    };\n\n    IResultCapture& getResultCapture();\n}\n\n// end catch_interfaces_capture.h\nnamespace Catch {\n\n    struct TestFailureException{};\n    struct AssertionResultData;\n    struct IResultCapture;\n    class RunContext;\n\n    class LazyExpression {\n        friend class AssertionHandler;\n        friend struct AssertionStats;\n        friend class RunContext;\n\n        ITransientExpression const* m_transientExpression = nullptr;\n        bool m_isNegated;\n    public:\n        LazyExpression( bool isNegated );\n        LazyExpression( LazyExpression const& other );\n        LazyExpression& operator = ( LazyExpression const& ) = delete;\n\n        explicit operator bool() const;\n\n        friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&;\n    };\n\n    struct AssertionReaction {\n        bool shouldDebugBreak = false;\n        bool shouldThrow = false;\n    };\n\n    class AssertionHandler {\n        AssertionInfo m_assertionInfo;\n        AssertionReaction m_reaction;\n        bool m_completed = false;\n        IResultCapture& m_resultCapture;\n\n    public:\n        AssertionHandler\n            (   StringRef macroName,\n                SourceLineInfo const& lineInfo,\n                StringRef capturedExpression,\n                ResultDisposition::Flags resultDisposition );\n        ~AssertionHandler() {\n            if ( !m_completed ) {\n                m_resultCapture.handleIncomplete( m_assertionInfo );\n            }\n        }\n\n        template<typename T>\n        void handleExpr( ExprLhs<T> const& expr ) {\n            handleExpr( expr.makeUnaryExpr() );\n        }\n        void handleExpr( ITransientExpression const& expr );\n\n        void handleMessage(ResultWas::OfType resultType, StringRef const& message);\n\n        void handleExceptionThrownAsExpected();\n        void handleUnexpectedExceptionNotThrown();\n        void handleExceptionNotThrownAsExpected();\n        void handleThrowingCallSkipped();\n        void handleUnexpectedInflightException();\n\n        void complete();\n        void setCompleted();\n\n        // query\n        auto allowThrows() const -> bool;\n    };\n\n    void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString );\n\n} // namespace Catch\n\n// end catch_assertionhandler.h\n// start catch_message.h\n\n#include <string>\n\nnamespace Catch {\n\n    struct MessageInfo {\n        MessageInfo(    std::string const& _macroName,\n                        SourceLineInfo const& _lineInfo,\n                        ResultWas::OfType _type );\n\n        std::string macroName;\n        std::string message;\n        SourceLineInfo lineInfo;\n        ResultWas::OfType type;\n        unsigned int sequence;\n\n        bool operator == ( MessageInfo const& other ) const;\n        bool operator < ( MessageInfo const& other ) const;\n    private:\n        static unsigned int globalCount;\n    };\n\n    struct MessageStream {\n\n        template<typename T>\n        MessageStream& operator << ( T const& value ) {\n            m_stream << value;\n            return *this;\n        }\n\n        ReusableStringStream m_stream;\n    };\n\n    struct MessageBuilder : MessageStream {\n        MessageBuilder( std::string const& macroName,\n                        SourceLineInfo const& lineInfo,\n                        ResultWas::OfType type );\n\n        template<typename T>\n        MessageBuilder& operator << ( T const& value ) {\n            m_stream << value;\n            return *this;\n        }\n\n        MessageInfo m_info;\n    };\n\n    class ScopedMessage {\n    public:\n        explicit ScopedMessage( MessageBuilder const& builder );\n        ~ScopedMessage();\n\n        MessageInfo m_info;\n    };\n\n} // end namespace Catch\n\n// end catch_message.h\n#if !defined(CATCH_CONFIG_DISABLE)\n\n#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)\n  #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__\n#else\n  #define CATCH_INTERNAL_STRINGIFY(...) \"Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION\"\n#endif\n\n#if defined(CATCH_CONFIG_FAST_COMPILE)\n\n///////////////////////////////////////////////////////////////////////////////\n// Another way to speed-up compilation is to omit local try-catch for REQUIRE*\n// macros.\n#define INTERNAL_CATCH_TRY\n#define INTERNAL_CATCH_CATCH( capturer )\n\n#else // CATCH_CONFIG_FAST_COMPILE\n\n#define INTERNAL_CATCH_TRY try\n#define INTERNAL_CATCH_CATCH( handler ) catch(...) { handler.handleUnexpectedInflightException(); }\n\n#endif\n\n#define INTERNAL_CATCH_REACT( handler ) handler.complete();\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \\\n        INTERNAL_CATCH_TRY { \\\n            CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \\\n            catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \\\n            CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \\\n        } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( (void)0, false && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look\n    // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \\\n    INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \\\n    if( Catch::getResultCapture().lastAssertionPassed() )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_ELSE( macroName, resultDisposition, ... ) \\\n    INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \\\n    if( !Catch::getResultCapture().lastAssertionPassed() )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \\\n        try { \\\n            static_cast<void>(__VA_ARGS__); \\\n            catchAssertionHandler.handleExceptionNotThrownAsExpected(); \\\n        } \\\n        catch( ... ) { \\\n            catchAssertionHandler.handleUnexpectedInflightException(); \\\n        } \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                static_cast<void>(__VA_ARGS__); \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( ... ) { \\\n                catchAssertionHandler.handleExceptionThrownAsExpected(); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) \", \" CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                static_cast<void>(expr); \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( exceptionType const& ) { \\\n                catchAssertionHandler.handleExceptionThrownAsExpected(); \\\n            } \\\n            catch( ... ) { \\\n                catchAssertionHandler.handleUnexpectedInflightException(); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, \"\", resultDisposition ); \\\n        catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_INFO( macroName, log ) \\\n    Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log );\n\n///////////////////////////////////////////////////////////////////////////////\n// Although this is matcher-based, it can be used with just a string\n#define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) \", \" CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                static_cast<void>(__VA_ARGS__); \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( ... ) { \\\n                Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher ); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n#endif // CATCH_CONFIG_DISABLE\n\n// end catch_capture.hpp\n// start catch_section.h\n\n// start catch_section_info.h\n\n// start catch_totals.h\n\n#include <cstddef>\n\nnamespace Catch {\n\n    struct Counts {\n        Counts operator - ( Counts const& other ) const;\n        Counts& operator += ( Counts const& other );\n\n        std::size_t total() const;\n        bool allPassed() const;\n        bool allOk() const;\n\n        std::size_t passed = 0;\n        std::size_t failed = 0;\n        std::size_t failedButOk = 0;\n    };\n\n    struct Totals {\n\n        Totals operator - ( Totals const& other ) const;\n        Totals& operator += ( Totals const& other );\n\n        Totals delta( Totals const& prevTotals ) const;\n\n        Counts assertions;\n        Counts testCases;\n    };\n}\n\n// end catch_totals.h\n#include <string>\n\nnamespace Catch {\n\n    struct SectionInfo {\n        SectionInfo\n            (   SourceLineInfo const& _lineInfo,\n                std::string const& _name,\n                std::string const& _description = std::string() );\n\n        std::string name;\n        std::string description;\n        SourceLineInfo lineInfo;\n    };\n\n    struct SectionEndInfo {\n        SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds );\n\n        SectionInfo sectionInfo;\n        Counts prevAssertions;\n        double durationInSeconds;\n    };\n\n} // end namespace Catch\n\n// end catch_section_info.h\n// start catch_timer.h\n\n#include <cstdint>\n\nnamespace Catch {\n\n    auto getCurrentNanosecondsSinceEpoch() -> uint64_t;\n    auto getEstimatedClockResolution() -> uint64_t;\n\n    class Timer {\n        uint64_t m_nanoseconds = 0;\n    public:\n        void start();\n        auto getElapsedNanoseconds() const -> uint64_t;\n        auto getElapsedMicroseconds() const -> uint64_t;\n        auto getElapsedMilliseconds() const -> unsigned int;\n        auto getElapsedSeconds() const -> double;\n    };\n\n} // namespace Catch\n\n// end catch_timer.h\n#include <string>\n\nnamespace Catch {\n\n    class Section : NonCopyable {\n    public:\n        Section( SectionInfo const& info );\n        ~Section();\n\n        // This indicates whether the section should be executed or not\n        explicit operator bool() const;\n\n    private:\n        SectionInfo m_info;\n\n        std::string m_name;\n        Counts m_assertions;\n        bool m_sectionIncluded;\n        Timer m_timer;\n    };\n\n} // end namespace Catch\n\n    #define INTERNAL_CATCH_SECTION( ... ) \\\n        if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )\n\n// end catch_section.h\n// start catch_benchmark.h\n\n#include <cstdint>\n#include <string>\n\nnamespace Catch {\n\n    class BenchmarkLooper {\n\n        std::string m_name;\n        std::size_t m_count = 0;\n        std::size_t m_iterationsToRun = 1;\n        uint64_t m_resolution;\n        Timer m_timer;\n\n        static auto getResolution() -> uint64_t;\n    public:\n        // Keep most of this inline as it's on the code path that is being timed\n        BenchmarkLooper( StringRef name )\n        :   m_name( name ),\n            m_resolution( getResolution() )\n        {\n            reportStart();\n            m_timer.start();\n        }\n\n        explicit operator bool() {\n            if( m_count < m_iterationsToRun )\n                return true;\n            return needsMoreIterations();\n        }\n\n        void increment() {\n            ++m_count;\n        }\n\n        void reportStart();\n        auto needsMoreIterations() -> bool;\n    };\n\n} // end namespace Catch\n\n#define BENCHMARK( name ) \\\n    for( Catch::BenchmarkLooper looper( name ); looper; looper.increment() )\n\n// end catch_benchmark.h\n// start catch_interfaces_exception.h\n\n// start catch_interfaces_registry_hub.h\n\n#include <string>\n#include <memory>\n\nnamespace Catch {\n\n    class TestCase;\n    struct ITestCaseRegistry;\n    struct IExceptionTranslatorRegistry;\n    struct IExceptionTranslator;\n    struct IReporterRegistry;\n    struct IReporterFactory;\n    struct ITagAliasRegistry;\n    class StartupExceptionRegistry;\n\n    using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;\n\n    struct IRegistryHub {\n        virtual ~IRegistryHub();\n\n        virtual IReporterRegistry const& getReporterRegistry() const = 0;\n        virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0;\n        virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0;\n\n        virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() = 0;\n\n        virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0;\n    };\n\n    struct IMutableRegistryHub {\n        virtual ~IMutableRegistryHub();\n        virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0;\n        virtual void registerListener( IReporterFactoryPtr const& factory ) = 0;\n        virtual void registerTest( TestCase const& testInfo ) = 0;\n        virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;\n        virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;\n        virtual void registerStartupException() noexcept = 0;\n    };\n\n    IRegistryHub& getRegistryHub();\n    IMutableRegistryHub& getMutableRegistryHub();\n    void cleanUp();\n    std::string translateActiveException();\n\n}\n\n// end catch_interfaces_registry_hub.h\n#if defined(CATCH_CONFIG_DISABLE)\n    #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \\\n        static std::string translatorName( signature )\n#endif\n\n#include <exception>\n#include <string>\n#include <vector>\n\nnamespace Catch {\n    using exceptionTranslateFunction = std::string(*)();\n\n    struct IExceptionTranslator;\n    using ExceptionTranslators = std::vector<std::unique_ptr<IExceptionTranslator const>>;\n\n    struct IExceptionTranslator {\n        virtual ~IExceptionTranslator();\n        virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0;\n    };\n\n    struct IExceptionTranslatorRegistry {\n        virtual ~IExceptionTranslatorRegistry();\n\n        virtual std::string translateActiveException() const = 0;\n    };\n\n    class ExceptionTranslatorRegistrar {\n        template<typename T>\n        class ExceptionTranslator : public IExceptionTranslator {\n        public:\n\n            ExceptionTranslator( std::string(*translateFunction)( T& ) )\n            : m_translateFunction( translateFunction )\n            {}\n\n            std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {\n                try {\n                    if( it == itEnd )\n                        std::rethrow_exception(std::current_exception());\n                    else\n                        return (*it)->translate( it+1, itEnd );\n                }\n                catch( T& ex ) {\n                    return m_translateFunction( ex );\n                }\n            }\n\n        protected:\n            std::string(*m_translateFunction)( T& );\n        };\n\n    public:\n        template<typename T>\n        ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) {\n            getMutableRegistryHub().registerTranslator\n                ( new ExceptionTranslator<T>( translateFunction ) );\n        }\n    };\n}\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \\\n    static std::string translatorName( signature ); \\\n    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n    namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \\\n    CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \\\n    static std::string translatorName( signature )\n\n#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )\n\n// end catch_interfaces_exception.h\n// start catch_approx.h\n\n#include <type_traits>\n#include <stdexcept>\n\nnamespace Catch {\nnamespace Detail {\n\n    class Approx {\n    private:\n        bool equalityComparisonImpl(double other) const;\n\n    public:\n        explicit Approx ( double value );\n\n        static Approx custom();\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        Approx operator()( T const& value ) {\n            Approx approx( static_cast<double>(value) );\n            approx.epsilon( m_epsilon );\n            approx.margin( m_margin );\n            approx.scale( m_scale );\n            return approx;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        explicit Approx( T const& value ): Approx(static_cast<double>(value))\n        {}\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator == ( const T& lhs, Approx const& rhs ) {\n            auto lhs_v = static_cast<double>(lhs);\n            return rhs.equalityComparisonImpl(lhs_v);\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator == ( Approx const& lhs, const T& rhs ) {\n            return operator==( rhs, lhs );\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator != ( T const& lhs, Approx const& rhs ) {\n            return !operator==( lhs, rhs );\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator != ( Approx const& lhs, T const& rhs ) {\n            return !operator==( rhs, lhs );\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator <= ( T const& lhs, Approx const& rhs ) {\n            return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator <= ( Approx const& lhs, T const& rhs ) {\n            return lhs.m_value < static_cast<double>(rhs) || lhs == rhs;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator >= ( T const& lhs, Approx const& rhs ) {\n            return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator >= ( Approx const& lhs, T const& rhs ) {\n            return lhs.m_value > static_cast<double>(rhs) || lhs == rhs;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        Approx& epsilon( T const& newEpsilon ) {\n            double epsilonAsDouble = static_cast<double>(newEpsilon);\n            if( epsilonAsDouble < 0 || epsilonAsDouble > 1.0 ) {\n                throw std::domain_error\n                    (   \"Invalid Approx::epsilon: \" +\n                        Catch::Detail::stringify( epsilonAsDouble ) +\n                        \", Approx::epsilon has to be between 0 and 1\" );\n            }\n            m_epsilon = epsilonAsDouble;\n            return *this;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        Approx& margin( T const& newMargin ) {\n            double marginAsDouble = static_cast<double>(newMargin);\n            if( marginAsDouble < 0 ) {\n                throw std::domain_error\n                    (   \"Invalid Approx::margin: \" +\n                         Catch::Detail::stringify( marginAsDouble ) +\n                         \", Approx::Margin has to be non-negative.\" );\n\n            }\n            m_margin = marginAsDouble;\n            return *this;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        Approx& scale( T const& newScale ) {\n            m_scale = static_cast<double>(newScale);\n            return *this;\n        }\n\n        std::string toString() const;\n\n    private:\n        double m_epsilon;\n        double m_margin;\n        double m_scale;\n        double m_value;\n    };\n}\n\ntemplate<>\nstruct StringMaker<Catch::Detail::Approx> {\n    static std::string convert(Catch::Detail::Approx const& value);\n};\n\n} // end namespace Catch\n\n// end catch_approx.h\n// start catch_string_manip.h\n\n#include <string>\n#include <iosfwd>\n\nnamespace Catch {\n\n    bool startsWith( std::string const& s, std::string const& prefix );\n    bool startsWith( std::string const& s, char prefix );\n    bool endsWith( std::string const& s, std::string const& suffix );\n    bool endsWith( std::string const& s, char suffix );\n    bool contains( std::string const& s, std::string const& infix );\n    void toLowerInPlace( std::string& s );\n    std::string toLower( std::string const& s );\n    std::string trim( std::string const& str );\n    bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );\n\n    struct pluralise {\n        pluralise( std::size_t count, std::string const& label );\n\n        friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );\n\n        std::size_t m_count;\n        std::string m_label;\n    };\n}\n\n// end catch_string_manip.h\n#ifndef CATCH_CONFIG_DISABLE_MATCHERS\n// start catch_capture_matchers.h\n\n// start catch_matchers.h\n\n#include <string>\n#include <vector>\n\nnamespace Catch {\nnamespace Matchers {\n    namespace Impl {\n\n        template<typename ArgT> struct MatchAllOf;\n        template<typename ArgT> struct MatchAnyOf;\n        template<typename ArgT> struct MatchNotOf;\n\n        class MatcherUntypedBase {\n        public:\n            MatcherUntypedBase() = default;\n            MatcherUntypedBase ( MatcherUntypedBase const& ) = default;\n            MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete;\n            std::string toString() const;\n\n        protected:\n            virtual ~MatcherUntypedBase();\n            virtual std::string describe() const = 0;\n            mutable std::string m_cachedToString;\n        };\n\n        template<typename ObjectT>\n        struct MatcherMethod {\n            virtual bool match( ObjectT const& arg ) const = 0;\n        };\n        template<typename PtrT>\n        struct MatcherMethod<PtrT*> {\n            virtual bool match( PtrT* arg ) const = 0;\n        };\n\n        template<typename T>\n        struct MatcherBase : MatcherUntypedBase, MatcherMethod<T> {\n\n            MatchAllOf<T> operator && ( MatcherBase const& other ) const;\n            MatchAnyOf<T> operator || ( MatcherBase const& other ) const;\n            MatchNotOf<T> operator ! () const;\n        };\n\n        template<typename ArgT>\n        struct MatchAllOf : MatcherBase<ArgT> {\n            bool match( ArgT const& arg ) const override {\n                for( auto matcher : m_matchers ) {\n                    if (!matcher->match(arg))\n                        return false;\n                }\n                return true;\n            }\n            std::string describe() const override {\n                std::string description;\n                description.reserve( 4 + m_matchers.size()*32 );\n                description += \"( \";\n                bool first = true;\n                for( auto matcher : m_matchers ) {\n                    if( first )\n                        first = false;\n                    else\n                        description += \" and \";\n                    description += matcher->toString();\n                }\n                description += \" )\";\n                return description;\n            }\n\n            MatchAllOf<ArgT>& operator && ( MatcherBase<ArgT> const& other ) {\n                m_matchers.push_back( &other );\n                return *this;\n            }\n\n            std::vector<MatcherBase<ArgT> const*> m_matchers;\n        };\n        template<typename ArgT>\n        struct MatchAnyOf : MatcherBase<ArgT> {\n\n            bool match( ArgT const& arg ) const override {\n                for( auto matcher : m_matchers ) {\n                    if (matcher->match(arg))\n                        return true;\n                }\n                return false;\n            }\n            std::string describe() const override {\n                std::string description;\n                description.reserve( 4 + m_matchers.size()*32 );\n                description += \"( \";\n                bool first = true;\n                for( auto matcher : m_matchers ) {\n                    if( first )\n                        first = false;\n                    else\n                        description += \" or \";\n                    description += matcher->toString();\n                }\n                description += \" )\";\n                return description;\n            }\n\n            MatchAnyOf<ArgT>& operator || ( MatcherBase<ArgT> const& other ) {\n                m_matchers.push_back( &other );\n                return *this;\n            }\n\n            std::vector<MatcherBase<ArgT> const*> m_matchers;\n        };\n\n        template<typename ArgT>\n        struct MatchNotOf : MatcherBase<ArgT> {\n\n            MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {}\n\n            bool match( ArgT const& arg ) const override {\n                return !m_underlyingMatcher.match( arg );\n            }\n\n            std::string describe() const override {\n                return \"not \" + m_underlyingMatcher.toString();\n            }\n            MatcherBase<ArgT> const& m_underlyingMatcher;\n        };\n\n        template<typename T>\n        MatchAllOf<T> MatcherBase<T>::operator && ( MatcherBase const& other ) const {\n            return MatchAllOf<T>() && *this && other;\n        }\n        template<typename T>\n        MatchAnyOf<T> MatcherBase<T>::operator || ( MatcherBase const& other ) const {\n            return MatchAnyOf<T>() || *this || other;\n        }\n        template<typename T>\n        MatchNotOf<T> MatcherBase<T>::operator ! () const {\n            return MatchNotOf<T>( *this );\n        }\n\n    } // namespace Impl\n\n} // namespace Matchers\n\nusing namespace Matchers;\nusing Matchers::Impl::MatcherBase;\n\n} // namespace Catch\n\n// end catch_matchers.h\n// start catch_matchers_floating.h\n\n#include <type_traits>\n#include <cmath>\n\nnamespace Catch {\nnamespace Matchers {\n\n    namespace Floating {\n\n        enum class FloatingPointKind : uint8_t;\n\n        struct WithinAbsMatcher : MatcherBase<double> {\n            WithinAbsMatcher(double target, double margin);\n            bool match(double const& matchee) const override;\n            std::string describe() const override;\n        private:\n            double m_target;\n            double m_margin;\n        };\n\n        struct WithinUlpsMatcher : MatcherBase<double> {\n            WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType);\n            bool match(double const& matchee) const override;\n            std::string describe() const override;\n        private:\n            double m_target;\n            int m_ulps;\n            FloatingPointKind m_type;\n        };\n\n    } // namespace Floating\n\n    // The following functions create the actual matcher objects.\n    // This allows the types to be inferred\n    Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff);\n    Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff);\n    Floating::WithinAbsMatcher WithinAbs(double target, double margin);\n\n} // namespace Matchers\n} // namespace Catch\n\n// end catch_matchers_floating.h\n// start catch_matchers_string.h\n\n#include <string>\n\nnamespace Catch {\nnamespace Matchers {\n\n    namespace StdString {\n\n        struct CasedString\n        {\n            CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity );\n            std::string adjustString( std::string const& str ) const;\n            std::string caseSensitivitySuffix() const;\n\n            CaseSensitive::Choice m_caseSensitivity;\n            std::string m_str;\n        };\n\n        struct StringMatcherBase : MatcherBase<std::string> {\n            StringMatcherBase( std::string const& operation, CasedString const& comparator );\n            std::string describe() const override;\n\n            CasedString m_comparator;\n            std::string m_operation;\n        };\n\n        struct EqualsMatcher : StringMatcherBase {\n            EqualsMatcher( CasedString const& comparator );\n            bool match( std::string const& source ) const override;\n        };\n        struct ContainsMatcher : StringMatcherBase {\n            ContainsMatcher( CasedString const& comparator );\n            bool match( std::string const& source ) const override;\n        };\n        struct StartsWithMatcher : StringMatcherBase {\n            StartsWithMatcher( CasedString const& comparator );\n            bool match( std::string const& source ) const override;\n        };\n        struct EndsWithMatcher : StringMatcherBase {\n            EndsWithMatcher( CasedString const& comparator );\n            bool match( std::string const& source ) const override;\n        };\n\n        struct RegexMatcher : MatcherBase<std::string> {\n            RegexMatcher( std::string regex, CaseSensitive::Choice caseSensitivity );\n            bool match( std::string const& matchee ) const override;\n            std::string describe() const override;\n\n        private:\n            std::string m_regex;\n            CaseSensitive::Choice m_caseSensitivity;\n        };\n\n    } // namespace StdString\n\n    // The following functions create the actual matcher objects.\n    // This allows the types to be inferred\n\n    StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );\n    StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );\n    StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );\n    StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );\n    StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );\n\n} // namespace Matchers\n} // namespace Catch\n\n// end catch_matchers_string.h\n// start catch_matchers_vector.h\n\n#include <algorithm>\n\nnamespace Catch {\nnamespace Matchers {\n\n    namespace Vector {\n        namespace Detail {\n            template <typename InputIterator, typename T>\n            size_t count(InputIterator first, InputIterator last, T const& item) {\n                size_t cnt = 0;\n                for (; first != last; ++first) {\n                    if (*first == item) {\n                        ++cnt;\n                    }\n                }\n                return cnt;\n            }\n            template <typename InputIterator, typename T>\n            bool contains(InputIterator first, InputIterator last, T const& item) {\n                for (; first != last; ++first) {\n                    if (*first == item) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n        }\n\n        template<typename T>\n        struct ContainsElementMatcher : MatcherBase<std::vector<T>> {\n\n            ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {}\n\n            bool match(std::vector<T> const &v) const override {\n                for (auto const& el : v) {\n                    if (el == m_comparator) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n\n            std::string describe() const override {\n                return \"Contains: \" + ::Catch::Detail::stringify( m_comparator );\n            }\n\n            T const& m_comparator;\n        };\n\n        template<typename T>\n        struct ContainsMatcher : MatcherBase<std::vector<T>> {\n\n            ContainsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}\n\n            bool match(std::vector<T> const &v) const override {\n                // !TBD: see note in EqualsMatcher\n                if (m_comparator.size() > v.size())\n                    return false;\n                for (auto const& comparator : m_comparator) {\n                    auto present = false;\n                    for (const auto& el : v) {\n                        if (el == comparator) {\n                            present = true;\n                            break;\n                        }\n                    }\n                    if (!present) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            std::string describe() const override {\n                return \"Contains: \" + ::Catch::Detail::stringify( m_comparator );\n            }\n\n            std::vector<T> const& m_comparator;\n        };\n\n        template<typename T>\n        struct EqualsMatcher : MatcherBase<std::vector<T>> {\n\n            EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}\n\n            bool match(std::vector<T> const &v) const override {\n                // !TBD: This currently works if all elements can be compared using !=\n                // - a more general approach would be via a compare template that defaults\n                // to using !=. but could be specialised for, e.g. std::vector<T> etc\n                // - then just call that directly\n                if (m_comparator.size() != v.size())\n                    return false;\n                for (std::size_t i = 0; i < v.size(); ++i)\n                    if (m_comparator[i] != v[i])\n                        return false;\n                return true;\n            }\n            std::string describe() const override {\n                return \"Equals: \" + ::Catch::Detail::stringify( m_comparator );\n            }\n            std::vector<T> const& m_comparator;\n        };\n\n        template<typename T>\n        struct UnorderedEqualsMatcher : MatcherBase<std::vector<T>> {\n            UnorderedEqualsMatcher(std::vector<T> const& target) : m_target(target) {}\n            bool match(std::vector<T> const& vec) const override {\n                // Note: This is a reimplementation of std::is_permutation,\n                //       because I don't want to include <algorithm> inside the common path\n                if (m_target.size() != vec.size()) {\n                    return false;\n                }\n                auto lfirst = m_target.begin(), llast = m_target.end();\n                auto rfirst = vec.begin(), rlast = vec.end();\n                // Cut common prefix to optimize checking of permuted parts\n                while (lfirst != llast && *lfirst != *rfirst) {\n                    ++lfirst; ++rfirst;\n                }\n                if (lfirst == llast) {\n                    return true;\n                }\n\n                for (auto mid = lfirst; mid != llast; ++mid) {\n                    // Skip already counted items\n                    if (Detail::contains(lfirst, mid, *mid)) {\n                        continue;\n                    }\n                    size_t num_vec = Detail::count(rfirst, rlast, *mid);\n                    if (num_vec == 0 || Detail::count(lfirst, llast, *mid) != num_vec) {\n                        return false;\n                    }\n                }\n\n                return true;\n            }\n\n            std::string describe() const override {\n                return \"UnorderedEquals: \" + ::Catch::Detail::stringify(m_target);\n            }\n        private:\n            std::vector<T> const& m_target;\n        };\n\n    } // namespace Vector\n\n    // The following functions create the actual matcher objects.\n    // This allows the types to be inferred\n\n    template<typename T>\n    Vector::ContainsMatcher<T> Contains( std::vector<T> const& comparator ) {\n        return Vector::ContainsMatcher<T>( comparator );\n    }\n\n    template<typename T>\n    Vector::ContainsElementMatcher<T> VectorContains( T const& comparator ) {\n        return Vector::ContainsElementMatcher<T>( comparator );\n    }\n\n    template<typename T>\n    Vector::EqualsMatcher<T> Equals( std::vector<T> const& comparator ) {\n        return Vector::EqualsMatcher<T>( comparator );\n    }\n\n    template<typename T>\n    Vector::UnorderedEqualsMatcher<T> UnorderedEquals(std::vector<T> const& target) {\n        return Vector::UnorderedEqualsMatcher<T>(target);\n    }\n\n} // namespace Matchers\n} // namespace Catch\n\n// end catch_matchers_vector.h\nnamespace Catch {\n\n    template<typename ArgT, typename MatcherT>\n    class MatchExpr : public ITransientExpression {\n        ArgT const& m_arg;\n        MatcherT m_matcher;\n        StringRef m_matcherString;\n    public:\n        MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef matcherString )\n        :   ITransientExpression{ true, matcher.match( arg ) },\n            m_arg( arg ),\n            m_matcher( matcher ),\n            m_matcherString( matcherString )\n        {}\n\n        void streamReconstructedExpression( std::ostream &os ) const override {\n            auto matcherAsString = m_matcher.toString();\n            os << Catch::Detail::stringify( m_arg ) << ' ';\n            if( matcherAsString == Detail::unprintableString )\n                os << m_matcherString;\n            else\n                os << matcherAsString;\n        }\n    };\n\n    using StringMatcher = Matchers::Impl::MatcherBase<std::string>;\n\n    void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString  );\n\n    template<typename ArgT, typename MatcherT>\n    auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef matcherString  ) -> MatchExpr<ArgT, MatcherT> {\n        return MatchExpr<ArgT, MatcherT>( arg, matcher, matcherString );\n    }\n\n} // namespace Catch\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) \", \" CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \\\n        INTERNAL_CATCH_TRY { \\\n            catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher ) ); \\\n        } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) \", \" CATCH_INTERNAL_STRINGIFY(exceptionType) \", \" CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                static_cast<void>(__VA_ARGS__ ); \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( exceptionType const& ex ) { \\\n                catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher, #matcher ) ); \\\n            } \\\n            catch( ... ) { \\\n                catchAssertionHandler.handleUnexpectedInflightException(); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n// end catch_capture_matchers.h\n#endif\n\n// These files are included here so the single_include script doesn't put them\n// in the conditionally compiled sections\n// start catch_test_case_info.h\n\n#include <string>\n#include <vector>\n#include <memory>\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wpadded\"\n#endif\n\nnamespace Catch {\n\n    struct ITestInvoker;\n\n    struct TestCaseInfo {\n        enum SpecialProperties{\n            None = 0,\n            IsHidden = 1 << 1,\n            ShouldFail = 1 << 2,\n            MayFail = 1 << 3,\n            Throws = 1 << 4,\n            NonPortable = 1 << 5,\n            Benchmark = 1 << 6\n        };\n\n        TestCaseInfo(   std::string const& _name,\n                        std::string const& _className,\n                        std::string const& _description,\n                        std::vector<std::string> const& _tags,\n                        SourceLineInfo const& _lineInfo );\n\n        friend void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags );\n\n        bool isHidden() const;\n        bool throws() const;\n        bool okToFail() const;\n        bool expectedToFail() const;\n\n        std::string tagsAsString() const;\n\n        std::string name;\n        std::string className;\n        std::string description;\n        std::vector<std::string> tags;\n        std::vector<std::string> lcaseTags;\n        SourceLineInfo lineInfo;\n        SpecialProperties properties;\n    };\n\n    class TestCase : public TestCaseInfo {\n    public:\n\n        TestCase( ITestInvoker* testCase, TestCaseInfo const& info );\n\n        TestCase withName( std::string const& _newName ) const;\n\n        void invoke() const;\n\n        TestCaseInfo const& getTestCaseInfo() const;\n\n        bool operator == ( TestCase const& other ) const;\n        bool operator < ( TestCase const& other ) const;\n\n    private:\n        std::shared_ptr<ITestInvoker> test;\n    };\n\n    TestCase makeTestCase(  ITestInvoker* testCase,\n                            std::string const& className,\n                            std::string const& name,\n                            std::string const& description,\n                            SourceLineInfo const& lineInfo );\n}\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n// end catch_test_case_info.h\n// start catch_interfaces_runner.h\n\nnamespace Catch {\n\n    struct IRunner {\n        virtual ~IRunner();\n        virtual bool aborting() const = 0;\n    };\n}\n\n// end catch_interfaces_runner.h\n\n#ifdef __OBJC__\n// start catch_objc.hpp\n\n#import <objc/runtime.h>\n\n#include <string>\n\n// NB. Any general catch headers included here must be included\n// in catch.hpp first to make sure they are included by the single\n// header for non obj-usage\n\n///////////////////////////////////////////////////////////////////////////////\n// This protocol is really only here for (self) documenting purposes, since\n// all its methods are optional.\n@protocol OcFixture\n\n@optional\n\n-(void) setUp;\n-(void) tearDown;\n\n@end\n\nnamespace Catch {\n\n    class OcMethod : public ITestInvoker {\n\n    public:\n        OcMethod( Class cls, SEL sel ) : m_cls( cls ), m_sel( sel ) {}\n\n        virtual void invoke() const {\n            id obj = [[m_cls alloc] init];\n\n            performOptionalSelector( obj, @selector(setUp)  );\n            performOptionalSelector( obj, m_sel );\n            performOptionalSelector( obj, @selector(tearDown)  );\n\n            arcSafeRelease( obj );\n        }\n    private:\n        virtual ~OcMethod() {}\n\n        Class m_cls;\n        SEL m_sel;\n    };\n\n    namespace Detail{\n\n        inline std::string getAnnotation(   Class cls,\n                                            std::string const& annotationName,\n                                            std::string const& testCaseName ) {\n            NSString* selStr = [[NSString alloc] initWithFormat:@\"Catch_%s_%s\", annotationName.c_str(), testCaseName.c_str()];\n            SEL sel = NSSelectorFromString( selStr );\n            arcSafeRelease( selStr );\n            id value = performOptionalSelector( cls, sel );\n            if( value )\n                return [(NSString*)value UTF8String];\n            return \"\";\n        }\n    }\n\n    inline std::size_t registerTestMethods() {\n        std::size_t noTestMethods = 0;\n        int noClasses = objc_getClassList( nullptr, 0 );\n\n        Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);\n        objc_getClassList( classes, noClasses );\n\n        for( int c = 0; c < noClasses; c++ ) {\n            Class cls = classes[c];\n            {\n                u_int count;\n                Method* methods = class_copyMethodList( cls, &count );\n                for( u_int m = 0; m < count ; m++ ) {\n                    SEL selector = method_getName(methods[m]);\n                    std::string methodName = sel_getName(selector);\n                    if( startsWith( methodName, \"Catch_TestCase_\" ) ) {\n                        std::string testCaseName = methodName.substr( 15 );\n                        std::string name = Detail::getAnnotation( cls, \"Name\", testCaseName );\n                        std::string desc = Detail::getAnnotation( cls, \"Description\", testCaseName );\n                        const char* className = class_getName( cls );\n\n                        getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, name.c_str(), desc.c_str(), SourceLineInfo(\"\",0) ) );\n                        noTestMethods++;\n                    }\n                }\n                free(methods);\n            }\n        }\n        return noTestMethods;\n    }\n\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n\n    namespace Matchers {\n        namespace Impl {\n        namespace NSStringMatchers {\n\n            struct StringHolder : MatcherBase<NSString*>{\n                StringHolder( NSString* substr ) : m_substr( [substr copy] ){}\n                StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){}\n                StringHolder() {\n                    arcSafeRelease( m_substr );\n                }\n\n                bool match( NSString* arg ) const override {\n                    return false;\n                }\n\n                NSString* CATCH_ARC_STRONG m_substr;\n            };\n\n            struct Equals : StringHolder {\n                Equals( NSString* substr ) : StringHolder( substr ){}\n\n                bool match( NSString* str ) const override {\n                    return  (str != nil || m_substr == nil ) &&\n                            [str isEqualToString:m_substr];\n                }\n\n                std::string describe() const override {\n                    return \"equals string: \" + Catch::Detail::stringify( m_substr );\n                }\n            };\n\n            struct Contains : StringHolder {\n                Contains( NSString* substr ) : StringHolder( substr ){}\n\n                bool match( NSString* str ) const {\n                    return  (str != nil || m_substr == nil ) &&\n                            [str rangeOfString:m_substr].location != NSNotFound;\n                }\n\n                std::string describe() const override {\n                    return \"contains string: \" + Catch::Detail::stringify( m_substr );\n                }\n            };\n\n            struct StartsWith : StringHolder {\n                StartsWith( NSString* substr ) : StringHolder( substr ){}\n\n                bool match( NSString* str ) const override {\n                    return  (str != nil || m_substr == nil ) &&\n                            [str rangeOfString:m_substr].location == 0;\n                }\n\n                std::string describe() const override {\n                    return \"starts with: \" + Catch::Detail::stringify( m_substr );\n                }\n            };\n            struct EndsWith : StringHolder {\n                EndsWith( NSString* substr ) : StringHolder( substr ){}\n\n                bool match( NSString* str ) const override {\n                    return  (str != nil || m_substr == nil ) &&\n                            [str rangeOfString:m_substr].location == [str length] - [m_substr length];\n                }\n\n                std::string describe() const override {\n                    return \"ends with: \" + Catch::Detail::stringify( m_substr );\n                }\n            };\n\n        } // namespace NSStringMatchers\n        } // namespace Impl\n\n        inline Impl::NSStringMatchers::Equals\n            Equals( NSString* substr ){ return Impl::NSStringMatchers::Equals( substr ); }\n\n        inline Impl::NSStringMatchers::Contains\n            Contains( NSString* substr ){ return Impl::NSStringMatchers::Contains( substr ); }\n\n        inline Impl::NSStringMatchers::StartsWith\n            StartsWith( NSString* substr ){ return Impl::NSStringMatchers::StartsWith( substr ); }\n\n        inline Impl::NSStringMatchers::EndsWith\n            EndsWith( NSString* substr ){ return Impl::NSStringMatchers::EndsWith( substr ); }\n\n    } // namespace Matchers\n\n    using namespace Matchers;\n\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n\n} // namespace Catch\n\n///////////////////////////////////////////////////////////////////////////////\n#define OC_MAKE_UNIQUE_NAME( root, uniqueSuffix ) root##uniqueSuffix\n#define OC_TEST_CASE2( name, desc, uniqueSuffix ) \\\n+(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Name_test_, uniqueSuffix ) \\\n{ \\\nreturn @ name; \\\n} \\\n+(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Description_test_, uniqueSuffix ) \\\n{ \\\nreturn @ desc; \\\n} \\\n-(void) OC_MAKE_UNIQUE_NAME( Catch_TestCase_test_, uniqueSuffix )\n\n#define OC_TEST_CASE( name, desc ) OC_TEST_CASE2( name, desc, __LINE__ )\n\n// end catch_objc.hpp\n#endif\n\n#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES\n// start catch_external_interfaces.h\n\n// start catch_reporter_bases.hpp\n\n// start catch_interfaces_reporter.h\n\n// start catch_config.hpp\n\n// start catch_test_spec_parser.h\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wpadded\"\n#endif\n\n// start catch_test_spec.h\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wpadded\"\n#endif\n\n// start catch_wildcard_pattern.h\n\nnamespace Catch\n{\n    class WildcardPattern {\n        enum WildcardPosition {\n            NoWildcard = 0,\n            WildcardAtStart = 1,\n            WildcardAtEnd = 2,\n            WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd\n        };\n\n    public:\n\n        WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity );\n        virtual ~WildcardPattern() = default;\n        virtual bool matches( std::string const& str ) const;\n\n    private:\n        std::string adjustCase( std::string const& str ) const;\n        CaseSensitive::Choice m_caseSensitivity;\n        WildcardPosition m_wildcard = NoWildcard;\n        std::string m_pattern;\n    };\n}\n\n// end catch_wildcard_pattern.h\n#include <string>\n#include <vector>\n#include <memory>\n\nnamespace Catch {\n\n    class TestSpec {\n        struct Pattern {\n            virtual ~Pattern();\n            virtual bool matches( TestCaseInfo const& testCase ) const = 0;\n        };\n        using PatternPtr = std::shared_ptr<Pattern>;\n\n        class NamePattern : public Pattern {\n        public:\n            NamePattern( std::string const& name );\n            virtual ~NamePattern();\n            virtual bool matches( TestCaseInfo const& testCase ) const override;\n        private:\n            WildcardPattern m_wildcardPattern;\n        };\n\n        class TagPattern : public Pattern {\n        public:\n            TagPattern( std::string const& tag );\n            virtual ~TagPattern();\n            virtual bool matches( TestCaseInfo const& testCase ) const override;\n        private:\n            std::string m_tag;\n        };\n\n        class ExcludedPattern : public Pattern {\n        public:\n            ExcludedPattern( PatternPtr const& underlyingPattern );\n            virtual ~ExcludedPattern();\n            virtual bool matches( TestCaseInfo const& testCase ) const override;\n        private:\n            PatternPtr m_underlyingPattern;\n        };\n\n        struct Filter {\n            std::vector<PatternPtr> m_patterns;\n\n            bool matches( TestCaseInfo const& testCase ) const;\n        };\n\n    public:\n        bool hasFilters() const;\n        bool matches( TestCaseInfo const& testCase ) const;\n\n    private:\n        std::vector<Filter> m_filters;\n\n        friend class TestSpecParser;\n    };\n}\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n// end catch_test_spec.h\n// start catch_interfaces_tag_alias_registry.h\n\n#include <string>\n\nnamespace Catch {\n\n    struct TagAlias;\n\n    struct ITagAliasRegistry {\n        virtual ~ITagAliasRegistry();\n        // Nullptr if not present\n        virtual TagAlias const* find( std::string const& alias ) const = 0;\n        virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0;\n\n        static ITagAliasRegistry const& get();\n    };\n\n} // end namespace Catch\n\n// end catch_interfaces_tag_alias_registry.h\nnamespace Catch {\n\n    class TestSpecParser {\n        enum Mode{ None, Name, QuotedName, Tag, EscapedName };\n        Mode m_mode = None;\n        bool m_exclusion = false;\n        std::size_t m_start = std::string::npos, m_pos = 0;\n        std::string m_arg;\n        std::vector<std::size_t> m_escapeChars;\n        TestSpec::Filter m_currentFilter;\n        TestSpec m_testSpec;\n        ITagAliasRegistry const* m_tagAliases = nullptr;\n\n    public:\n        TestSpecParser( ITagAliasRegistry const& tagAliases );\n\n        TestSpecParser& parse( std::string const& arg );\n        TestSpec testSpec();\n\n    private:\n        void visitChar( char c );\n        void startNewMode( Mode mode, std::size_t start );\n        void escape();\n        std::string subString() const;\n\n        template<typename T>\n        void addPattern() {\n            std::string token = subString();\n            for( std::size_t i = 0; i < m_escapeChars.size(); ++i )\n                token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 );\n            m_escapeChars.clear();\n            if( startsWith( token, \"exclude:\" ) ) {\n                m_exclusion = true;\n                token = token.substr( 8 );\n            }\n            if( !token.empty() ) {\n                TestSpec::PatternPtr pattern = std::make_shared<T>( token );\n                if( m_exclusion )\n                    pattern = std::make_shared<TestSpec::ExcludedPattern>( pattern );\n                m_currentFilter.m_patterns.push_back( pattern );\n            }\n            m_exclusion = false;\n            m_mode = None;\n        }\n\n        void addFilter();\n    };\n    TestSpec parseTestSpec( std::string const& arg );\n\n} // namespace Catch\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n// end catch_test_spec_parser.h\n// start catch_interfaces_config.h\n\n#include <iosfwd>\n#include <string>\n#include <vector>\n#include <memory>\n\nnamespace Catch {\n\n    enum class Verbosity {\n        Quiet = 0,\n        Normal,\n        High\n    };\n\n    struct WarnAbout { enum What {\n        Nothing = 0x00,\n        NoAssertions = 0x01\n    }; };\n\n    struct ShowDurations { enum OrNot {\n        DefaultForReporter,\n        Always,\n        Never\n    }; };\n    struct RunTests { enum InWhatOrder {\n        InDeclarationOrder,\n        InLexicographicalOrder,\n        InRandomOrder\n    }; };\n    struct UseColour { enum YesOrNo {\n        Auto,\n        Yes,\n        No\n    }; };\n    struct WaitForKeypress { enum When {\n        Never,\n        BeforeStart = 1,\n        BeforeExit = 2,\n        BeforeStartAndExit = BeforeStart | BeforeExit\n    }; };\n\n    class TestSpec;\n\n    struct IConfig : NonCopyable {\n\n        virtual ~IConfig();\n\n        virtual bool allowThrows() const = 0;\n        virtual std::ostream& stream() const = 0;\n        virtual std::string name() const = 0;\n        virtual bool includeSuccessfulResults() const = 0;\n        virtual bool shouldDebugBreak() const = 0;\n        virtual bool warnAboutMissingAssertions() const = 0;\n        virtual int abortAfter() const = 0;\n        virtual bool showInvisibles() const = 0;\n        virtual ShowDurations::OrNot showDurations() const = 0;\n        virtual TestSpec const& testSpec() const = 0;\n        virtual RunTests::InWhatOrder runOrder() const = 0;\n        virtual unsigned int rngSeed() const = 0;\n        virtual int benchmarkResolutionMultiple() const = 0;\n        virtual UseColour::YesOrNo useColour() const = 0;\n        virtual std::vector<std::string> const& getSectionsToRun() const = 0;\n        virtual Verbosity verbosity() const = 0;\n    };\n\n    using IConfigPtr = std::shared_ptr<IConfig const>;\n}\n\n// end catch_interfaces_config.h\n// Libstdc++ doesn't like incomplete classes for unique_ptr\n\n#include <memory>\n#include <vector>\n#include <string>\n\n#ifndef CATCH_CONFIG_CONSOLE_WIDTH\n#define CATCH_CONFIG_CONSOLE_WIDTH 80\n#endif\n\nnamespace Catch {\n\n    struct IStream;\n\n    struct ConfigData {\n        bool listTests = false;\n        bool listTags = false;\n        bool listReporters = false;\n        bool listTestNamesOnly = false;\n\n        bool showSuccessfulTests = false;\n        bool shouldDebugBreak = false;\n        bool noThrow = false;\n        bool showHelp = false;\n        bool showInvisibles = false;\n        bool filenamesAsTags = false;\n        bool libIdentify = false;\n\n        int abortAfter = -1;\n        unsigned int rngSeed = 0;\n        int benchmarkResolutionMultiple = 100;\n\n        Verbosity verbosity = Verbosity::Normal;\n        WarnAbout::What warnings = WarnAbout::Nothing;\n        ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter;\n        RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder;\n        UseColour::YesOrNo useColour = UseColour::Auto;\n        WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;\n\n        std::string outputFilename;\n        std::string name;\n        std::string processName;\n\n        std::vector<std::string> reporterNames;\n        std::vector<std::string> testsOrTags;\n        std::vector<std::string> sectionsToRun;\n    };\n\n    class Config : public IConfig {\n    public:\n\n        Config() = default;\n        Config( ConfigData const& data );\n        virtual ~Config() = default;\n\n        std::string const& getFilename() const;\n\n        bool listTests() const;\n        bool listTestNamesOnly() const;\n        bool listTags() const;\n        bool listReporters() const;\n\n        std::string getProcessName() const;\n\n        std::vector<std::string> const& getReporterNames() const;\n        std::vector<std::string> const& getSectionsToRun() const override;\n\n        virtual TestSpec const& testSpec() const override;\n\n        bool showHelp() const;\n\n        // IConfig interface\n        bool allowThrows() const override;\n        std::ostream& stream() const override;\n        std::string name() const override;\n        bool includeSuccessfulResults() const override;\n        bool warnAboutMissingAssertions() const override;\n        ShowDurations::OrNot showDurations() const override;\n        RunTests::InWhatOrder runOrder() const override;\n        unsigned int rngSeed() const override;\n        int benchmarkResolutionMultiple() const override;\n        UseColour::YesOrNo useColour() const override;\n        bool shouldDebugBreak() const override;\n        int abortAfter() const override;\n        bool showInvisibles() const override;\n        Verbosity verbosity() const override;\n\n    private:\n\n        IStream const* openStream();\n        ConfigData m_data;\n\n        std::unique_ptr<IStream const> m_stream;\n        TestSpec m_testSpec;\n    };\n\n} // end namespace Catch\n\n// end catch_config.hpp\n// start catch_assertionresult.h\n\n#include <string>\n\nnamespace Catch {\n\n    struct AssertionResultData\n    {\n        AssertionResultData() = delete;\n\n        AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );\n\n        std::string message;\n        mutable std::string reconstructedExpression;\n        LazyExpression lazyExpression;\n        ResultWas::OfType resultType;\n\n        std::string reconstructExpression() const;\n    };\n\n    class AssertionResult {\n    public:\n        AssertionResult() = delete;\n        AssertionResult( AssertionInfo const& info, AssertionResultData const& data );\n\n        bool isOk() const;\n        bool succeeded() const;\n        ResultWas::OfType getResultType() const;\n        bool hasExpression() const;\n        bool hasMessage() const;\n        std::string getExpression() const;\n        std::string getExpressionInMacro() const;\n        bool hasExpandedExpression() const;\n        std::string getExpandedExpression() const;\n        std::string getMessage() const;\n        SourceLineInfo getSourceInfo() const;\n        StringRef getTestMacroName() const;\n\n    //protected:\n        AssertionInfo m_info;\n        AssertionResultData m_resultData;\n    };\n\n} // end namespace Catch\n\n// end catch_assertionresult.h\n// start catch_option.hpp\n\nnamespace Catch {\n\n    // An optional type\n    template<typename T>\n    class Option {\n    public:\n        Option() : nullableValue( nullptr ) {}\n        Option( T const& _value )\n        : nullableValue( new( storage ) T( _value ) )\n        {}\n        Option( Option const& _other )\n        : nullableValue( _other ? new( storage ) T( *_other ) : nullptr )\n        {}\n\n        ~Option() {\n            reset();\n        }\n\n        Option& operator= ( Option const& _other ) {\n            if( &_other != this ) {\n                reset();\n                if( _other )\n                    nullableValue = new( storage ) T( *_other );\n            }\n            return *this;\n        }\n        Option& operator = ( T const& _value ) {\n            reset();\n            nullableValue = new( storage ) T( _value );\n            return *this;\n        }\n\n        void reset() {\n            if( nullableValue )\n                nullableValue->~T();\n            nullableValue = nullptr;\n        }\n\n        T& operator*() { return *nullableValue; }\n        T const& operator*() const { return *nullableValue; }\n        T* operator->() { return nullableValue; }\n        const T* operator->() const { return nullableValue; }\n\n        T valueOr( T const& defaultValue ) const {\n            return nullableValue ? *nullableValue : defaultValue;\n        }\n\n        bool some() const { return nullableValue != nullptr; }\n        bool none() const { return nullableValue == nullptr; }\n\n        bool operator !() const { return nullableValue == nullptr; }\n        explicit operator bool() const {\n            return some();\n        }\n\n    private:\n        T *nullableValue;\n        alignas(alignof(T)) char storage[sizeof(T)];\n    };\n\n} // end namespace Catch\n\n// end catch_option.hpp\n#include <string>\n#include <iosfwd>\n#include <map>\n#include <set>\n#include <memory>\n\nnamespace Catch {\n\n    struct ReporterConfig {\n        explicit ReporterConfig( IConfigPtr const& _fullConfig );\n\n        ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream );\n\n        std::ostream& stream() const;\n        IConfigPtr fullConfig() const;\n\n    private:\n        std::ostream* m_stream;\n        IConfigPtr m_fullConfig;\n    };\n\n    struct ReporterPreferences {\n        bool shouldRedirectStdOut = false;\n    };\n\n    template<typename T>\n    struct LazyStat : Option<T> {\n        LazyStat& operator=( T const& _value ) {\n            Option<T>::operator=( _value );\n            used = false;\n            return *this;\n        }\n        void reset() {\n            Option<T>::reset();\n            used = false;\n        }\n        bool used = false;\n    };\n\n    struct TestRunInfo {\n        TestRunInfo( std::string const& _name );\n        std::string name;\n    };\n    struct GroupInfo {\n        GroupInfo(  std::string const& _name,\n                    std::size_t _groupIndex,\n                    std::size_t _groupsCount );\n\n        std::string name;\n        std::size_t groupIndex;\n        std::size_t groupsCounts;\n    };\n\n    struct AssertionStats {\n        AssertionStats( AssertionResult const& _assertionResult,\n                        std::vector<MessageInfo> const& _infoMessages,\n                        Totals const& _totals );\n\n        AssertionStats( AssertionStats const& )              = default;\n        AssertionStats( AssertionStats && )                  = default;\n        AssertionStats& operator = ( AssertionStats const& ) = default;\n        AssertionStats& operator = ( AssertionStats && )     = default;\n        virtual ~AssertionStats();\n\n        AssertionResult assertionResult;\n        std::vector<MessageInfo> infoMessages;\n        Totals totals;\n    };\n\n    struct SectionStats {\n        SectionStats(   SectionInfo const& _sectionInfo,\n                        Counts const& _assertions,\n                        double _durationInSeconds,\n                        bool _missingAssertions );\n        SectionStats( SectionStats const& )              = default;\n        SectionStats( SectionStats && )                  = default;\n        SectionStats& operator = ( SectionStats const& ) = default;\n        SectionStats& operator = ( SectionStats && )     = default;\n        virtual ~SectionStats();\n\n        SectionInfo sectionInfo;\n        Counts assertions;\n        double durationInSeconds;\n        bool missingAssertions;\n    };\n\n    struct TestCaseStats {\n        TestCaseStats(  TestCaseInfo const& _testInfo,\n                        Totals const& _totals,\n                        std::string const& _stdOut,\n                        std::string const& _stdErr,\n                        bool _aborting );\n\n        TestCaseStats( TestCaseStats const& )              = default;\n        TestCaseStats( TestCaseStats && )                  = default;\n        TestCaseStats& operator = ( TestCaseStats const& ) = default;\n        TestCaseStats& operator = ( TestCaseStats && )     = default;\n        virtual ~TestCaseStats();\n\n        TestCaseInfo testInfo;\n        Totals totals;\n        std::string stdOut;\n        std::string stdErr;\n        bool aborting;\n    };\n\n    struct TestGroupStats {\n        TestGroupStats( GroupInfo const& _groupInfo,\n                        Totals const& _totals,\n                        bool _aborting );\n        TestGroupStats( GroupInfo const& _groupInfo );\n\n        TestGroupStats( TestGroupStats const& )              = default;\n        TestGroupStats( TestGroupStats && )                  = default;\n        TestGroupStats& operator = ( TestGroupStats const& ) = default;\n        TestGroupStats& operator = ( TestGroupStats && )     = default;\n        virtual ~TestGroupStats();\n\n        GroupInfo groupInfo;\n        Totals totals;\n        bool aborting;\n    };\n\n    struct TestRunStats {\n        TestRunStats(   TestRunInfo const& _runInfo,\n                        Totals const& _totals,\n                        bool _aborting );\n\n        TestRunStats( TestRunStats const& )              = default;\n        TestRunStats( TestRunStats && )                  = default;\n        TestRunStats& operator = ( TestRunStats const& ) = default;\n        TestRunStats& operator = ( TestRunStats && )     = default;\n        virtual ~TestRunStats();\n\n        TestRunInfo runInfo;\n        Totals totals;\n        bool aborting;\n    };\n\n    struct BenchmarkInfo {\n        std::string name;\n    };\n    struct BenchmarkStats {\n        BenchmarkInfo info;\n        std::size_t iterations;\n        uint64_t elapsedTimeInNanoseconds;\n    };\n\n    struct IStreamingReporter {\n        virtual ~IStreamingReporter() = default;\n\n        // Implementing class must also provide the following static methods:\n        // static std::string getDescription();\n        // static std::set<Verbosity> getSupportedVerbosities()\n\n        virtual ReporterPreferences getPreferences() const = 0;\n\n        virtual void noMatchingTestCases( std::string const& spec ) = 0;\n\n        virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0;\n        virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0;\n\n        virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;\n        virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;\n\n        // *** experimental ***\n        virtual void benchmarkStarting( BenchmarkInfo const& ) {}\n\n        virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;\n\n        // The return value indicates if the messages buffer should be cleared:\n        virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0;\n\n        // *** experimental ***\n        virtual void benchmarkEnded( BenchmarkStats const& ) {}\n\n        virtual void sectionEnded( SectionStats const& sectionStats ) = 0;\n        virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0;\n        virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0;\n        virtual void testRunEnded( TestRunStats const& testRunStats ) = 0;\n\n        virtual void skipTest( TestCaseInfo const& testInfo ) = 0;\n\n        // Default empty implementation provided\n        virtual void fatalErrorEncountered( StringRef name );\n\n        virtual bool isMulti() const;\n    };\n    using IStreamingReporterPtr = std::unique_ptr<IStreamingReporter>;\n\n    struct IReporterFactory {\n        virtual ~IReporterFactory();\n        virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0;\n        virtual std::string getDescription() const = 0;\n    };\n    using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;\n\n    struct IReporterRegistry {\n        using FactoryMap = std::map<std::string, IReporterFactoryPtr>;\n        using Listeners = std::vector<IReporterFactoryPtr>;\n\n        virtual ~IReporterRegistry();\n        virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0;\n        virtual FactoryMap const& getFactories() const = 0;\n        virtual Listeners const& getListeners() const = 0;\n    };\n\n    void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter );\n\n} // end namespace Catch\n\n// end catch_interfaces_reporter.h\n#include <algorithm>\n#include <cstring>\n#include <cfloat>\n#include <cstdio>\n#include <assert.h>\n#include <memory>\n#include <ostream>\n\nnamespace Catch {\n    void prepareExpandedExpression(AssertionResult& result);\n\n    // Returns double formatted as %.3f (format expected on output)\n    std::string getFormattedDuration( double duration );\n\n    template<typename DerivedT>\n    struct StreamingReporterBase : IStreamingReporter {\n\n        StreamingReporterBase( ReporterConfig const& _config )\n        :   m_config( _config.fullConfig() ),\n            stream( _config.stream() )\n        {\n            m_reporterPrefs.shouldRedirectStdOut = false;\n            if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )\n                throw std::domain_error( \"Verbosity level not supported by this reporter\" );\n        }\n\n        ReporterPreferences getPreferences() const override {\n            return m_reporterPrefs;\n        }\n\n        static std::set<Verbosity> getSupportedVerbosities() {\n            return { Verbosity::Normal };\n        }\n\n        ~StreamingReporterBase() override = default;\n\n        void noMatchingTestCases(std::string const&) override {}\n\n        void testRunStarting(TestRunInfo const& _testRunInfo) override {\n            currentTestRunInfo = _testRunInfo;\n        }\n        void testGroupStarting(GroupInfo const& _groupInfo) override {\n            currentGroupInfo = _groupInfo;\n        }\n\n        void testCaseStarting(TestCaseInfo const& _testInfo) override  {\n            currentTestCaseInfo = _testInfo;\n        }\n        void sectionStarting(SectionInfo const& _sectionInfo) override {\n            m_sectionStack.push_back(_sectionInfo);\n        }\n\n        void sectionEnded(SectionStats const& /* _sectionStats */) override {\n            m_sectionStack.pop_back();\n        }\n        void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override {\n            currentTestCaseInfo.reset();\n        }\n        void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override {\n            currentGroupInfo.reset();\n        }\n        void testRunEnded(TestRunStats const& /* _testRunStats */) override {\n            currentTestCaseInfo.reset();\n            currentGroupInfo.reset();\n            currentTestRunInfo.reset();\n        }\n\n        void skipTest(TestCaseInfo const&) override {\n            // Don't do anything with this by default.\n            // It can optionally be overridden in the derived class.\n        }\n\n        IConfigPtr m_config;\n        std::ostream& stream;\n\n        LazyStat<TestRunInfo> currentTestRunInfo;\n        LazyStat<GroupInfo> currentGroupInfo;\n        LazyStat<TestCaseInfo> currentTestCaseInfo;\n\n        std::vector<SectionInfo> m_sectionStack;\n        ReporterPreferences m_reporterPrefs;\n    };\n\n    template<typename DerivedT>\n    struct CumulativeReporterBase : IStreamingReporter {\n        template<typename T, typename ChildNodeT>\n        struct Node {\n            explicit Node( T const& _value ) : value( _value ) {}\n            virtual ~Node() {}\n\n            using ChildNodes = std::vector<std::shared_ptr<ChildNodeT>>;\n            T value;\n            ChildNodes children;\n        };\n        struct SectionNode {\n            explicit SectionNode(SectionStats const& _stats) : stats(_stats) {}\n            virtual ~SectionNode() = default;\n\n            bool operator == (SectionNode const& other) const {\n                return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo;\n            }\n            bool operator == (std::shared_ptr<SectionNode> const& other) const {\n                return operator==(*other);\n            }\n\n            SectionStats stats;\n            using ChildSections = std::vector<std::shared_ptr<SectionNode>>;\n            using Assertions = std::vector<AssertionStats>;\n            ChildSections childSections;\n            Assertions assertions;\n            std::string stdOut;\n            std::string stdErr;\n        };\n\n        struct BySectionInfo {\n            BySectionInfo( SectionInfo const& other ) : m_other( other ) {}\n            BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {}\n            bool operator() (std::shared_ptr<SectionNode> const& node) const {\n                return ((node->stats.sectionInfo.name == m_other.name) &&\n                        (node->stats.sectionInfo.lineInfo == m_other.lineInfo));\n            }\n            void operator=(BySectionInfo const&) = delete;\n\n        private:\n            SectionInfo const& m_other;\n        };\n\n        using TestCaseNode = Node<TestCaseStats, SectionNode>;\n        using TestGroupNode = Node<TestGroupStats, TestCaseNode>;\n        using TestRunNode = Node<TestRunStats, TestGroupNode>;\n\n        CumulativeReporterBase( ReporterConfig const& _config )\n        :   m_config( _config.fullConfig() ),\n            stream( _config.stream() )\n        {\n            m_reporterPrefs.shouldRedirectStdOut = false;\n            if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )\n                throw std::domain_error( \"Verbosity level not supported by this reporter\" );\n        }\n        ~CumulativeReporterBase() override = default;\n\n        ReporterPreferences getPreferences() const override {\n            return m_reporterPrefs;\n        }\n\n        static std::set<Verbosity> getSupportedVerbosities() {\n            return { Verbosity::Normal };\n        }\n\n        void testRunStarting( TestRunInfo const& ) override {}\n        void testGroupStarting( GroupInfo const& ) override {}\n\n        void testCaseStarting( TestCaseInfo const& ) override {}\n\n        void sectionStarting( SectionInfo const& sectionInfo ) override {\n            SectionStats incompleteStats( sectionInfo, Counts(), 0, false );\n            std::shared_ptr<SectionNode> node;\n            if( m_sectionStack.empty() ) {\n                if( !m_rootSection )\n                    m_rootSection = std::make_shared<SectionNode>( incompleteStats );\n                node = m_rootSection;\n            }\n            else {\n                SectionNode& parentNode = *m_sectionStack.back();\n                auto it =\n                    std::find_if(   parentNode.childSections.begin(),\n                                    parentNode.childSections.end(),\n                                    BySectionInfo( sectionInfo ) );\n                if( it == parentNode.childSections.end() ) {\n                    node = std::make_shared<SectionNode>( incompleteStats );\n                    parentNode.childSections.push_back( node );\n                }\n                else\n                    node = *it;\n            }\n            m_sectionStack.push_back( node );\n            m_deepestSection = std::move(node);\n        }\n\n        void assertionStarting(AssertionInfo const&) override {}\n\n        bool assertionEnded(AssertionStats const& assertionStats) override {\n            assert(!m_sectionStack.empty());\n            // AssertionResult holds a pointer to a temporary DecomposedExpression,\n            // which getExpandedExpression() calls to build the expression string.\n            // Our section stack copy of the assertionResult will likely outlive the\n            // temporary, so it must be expanded or discarded now to avoid calling\n            // a destroyed object later.\n            prepareExpandedExpression(const_cast<AssertionResult&>( assertionStats.assertionResult ) );\n            SectionNode& sectionNode = *m_sectionStack.back();\n            sectionNode.assertions.push_back(assertionStats);\n            return true;\n        }\n        void sectionEnded(SectionStats const& sectionStats) override {\n            assert(!m_sectionStack.empty());\n            SectionNode& node = *m_sectionStack.back();\n            node.stats = sectionStats;\n            m_sectionStack.pop_back();\n        }\n        void testCaseEnded(TestCaseStats const& testCaseStats) override {\n            auto node = std::make_shared<TestCaseNode>(testCaseStats);\n            assert(m_sectionStack.size() == 0);\n            node->children.push_back(m_rootSection);\n            m_testCases.push_back(node);\n            m_rootSection.reset();\n\n            assert(m_deepestSection);\n            m_deepestSection->stdOut = testCaseStats.stdOut;\n            m_deepestSection->stdErr = testCaseStats.stdErr;\n        }\n        void testGroupEnded(TestGroupStats const& testGroupStats) override {\n            auto node = std::make_shared<TestGroupNode>(testGroupStats);\n            node->children.swap(m_testCases);\n            m_testGroups.push_back(node);\n        }\n        void testRunEnded(TestRunStats const& testRunStats) override {\n            auto node = std::make_shared<TestRunNode>(testRunStats);\n            node->children.swap(m_testGroups);\n            m_testRuns.push_back(node);\n            testRunEndedCumulative();\n        }\n        virtual void testRunEndedCumulative() = 0;\n\n        void skipTest(TestCaseInfo const&) override {}\n\n        IConfigPtr m_config;\n        std::ostream& stream;\n        std::vector<AssertionStats> m_assertions;\n        std::vector<std::vector<std::shared_ptr<SectionNode>>> m_sections;\n        std::vector<std::shared_ptr<TestCaseNode>> m_testCases;\n        std::vector<std::shared_ptr<TestGroupNode>> m_testGroups;\n\n        std::vector<std::shared_ptr<TestRunNode>> m_testRuns;\n\n        std::shared_ptr<SectionNode> m_rootSection;\n        std::shared_ptr<SectionNode> m_deepestSection;\n        std::vector<std::shared_ptr<SectionNode>> m_sectionStack;\n        ReporterPreferences m_reporterPrefs;\n    };\n\n    template<char C>\n    char const* getLineOfChars() {\n        static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0};\n        if( !*line ) {\n            std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 );\n            line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0;\n        }\n        return line;\n    }\n\n    struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> {\n        TestEventListenerBase( ReporterConfig const& _config );\n\n        void assertionStarting(AssertionInfo const&) override;\n        bool assertionEnded(AssertionStats const&) override;\n    };\n\n} // end namespace Catch\n\n// end catch_reporter_bases.hpp\n// start catch_console_colour.h\n\nnamespace Catch {\n\n    struct Colour {\n        enum Code {\n            None = 0,\n\n            White,\n            Red,\n            Green,\n            Blue,\n            Cyan,\n            Yellow,\n            Grey,\n\n            Bright = 0x10,\n\n            BrightRed = Bright | Red,\n            BrightGreen = Bright | Green,\n            LightGrey = Bright | Grey,\n            BrightWhite = Bright | White,\n\n            // By intention\n            FileName = LightGrey,\n            Warning = Yellow,\n            ResultError = BrightRed,\n            ResultSuccess = BrightGreen,\n            ResultExpectedFailure = Warning,\n\n            Error = BrightRed,\n            Success = Green,\n\n            OriginalExpression = Cyan,\n            ReconstructedExpression = Yellow,\n\n            SecondaryText = LightGrey,\n            Headers = White\n        };\n\n        // Use constructed object for RAII guard\n        Colour( Code _colourCode );\n        Colour( Colour&& other ) noexcept;\n        Colour& operator=( Colour&& other ) noexcept;\n        ~Colour();\n\n        // Use static method for one-shot changes\n        static void use( Code _colourCode );\n\n    private:\n        bool m_moved = false;\n    };\n\n    std::ostream& operator << ( std::ostream& os, Colour const& );\n\n} // end namespace Catch\n\n// end catch_console_colour.h\n// start catch_reporter_registrars.hpp\n\n\nnamespace Catch {\n\n    template<typename T>\n    class ReporterRegistrar {\n\n        class ReporterFactory : public IReporterFactory {\n\n            virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {\n                return std::unique_ptr<T>( new T( config ) );\n            }\n\n            virtual std::string getDescription() const override {\n                return T::getDescription();\n            }\n        };\n\n    public:\n\n        explicit ReporterRegistrar( std::string const& name ) {\n            getMutableRegistryHub().registerReporter( name, std::make_shared<ReporterFactory>() );\n        }\n    };\n\n    template<typename T>\n    class ListenerRegistrar {\n\n        class ListenerFactory : public IReporterFactory {\n\n            virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {\n                return std::unique_ptr<T>( new T( config ) );\n            }\n            virtual std::string getDescription() const override {\n                return std::string();\n            }\n        };\n\n    public:\n\n        ListenerRegistrar() {\n            getMutableRegistryHub().registerListener( std::make_shared<ListenerFactory>() );\n        }\n    };\n}\n\n#if !defined(CATCH_CONFIG_DISABLE)\n\n#define CATCH_REGISTER_REPORTER( name, reporterType ) \\\n    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS          \\\n    namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } \\\n    CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\n\n#define CATCH_REGISTER_LISTENER( listenerType ) \\\n     CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS   \\\n     namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } \\\n     CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS\n#else // CATCH_CONFIG_DISABLE\n\n#define CATCH_REGISTER_REPORTER(name, reporterType)\n#define CATCH_REGISTER_LISTENER(listenerType)\n\n#endif // CATCH_CONFIG_DISABLE\n\n// end catch_reporter_registrars.hpp\n// Allow users to base their work off existing reporters\n// start catch_reporter_compact.h\n\nnamespace Catch {\n\n    struct CompactReporter : StreamingReporterBase<CompactReporter> {\n\n        using StreamingReporterBase::StreamingReporterBase;\n\n        ~CompactReporter() override;\n\n        static std::string getDescription();\n\n        ReporterPreferences getPreferences() const override;\n\n        void noMatchingTestCases(std::string const& spec) override;\n\n        void assertionStarting(AssertionInfo const&) override;\n\n        bool assertionEnded(AssertionStats const& _assertionStats) override;\n\n        void sectionEnded(SectionStats const& _sectionStats) override;\n\n        void testRunEnded(TestRunStats const& _testRunStats) override;\n\n    };\n\n} // end namespace Catch\n\n// end catch_reporter_compact.h\n// start catch_reporter_console.h\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch\n                              // Note that 4062 (not all labels are handled\n                              // and default is missing) is enabled\n#endif\n\nnamespace Catch {\n    // Fwd decls\n    struct SummaryColumn;\n    class TablePrinter;\n\n    struct ConsoleReporter : StreamingReporterBase<ConsoleReporter> {\n        std::unique_ptr<TablePrinter> m_tablePrinter;\n\n        ConsoleReporter(ReporterConfig const& config);\n        ~ConsoleReporter() override;\n        static std::string getDescription();\n\n        void noMatchingTestCases(std::string const& spec) override;\n\n        void assertionStarting(AssertionInfo const&) override;\n\n        bool assertionEnded(AssertionStats const& _assertionStats) override;\n\n        void sectionStarting(SectionInfo const& _sectionInfo) override;\n        void sectionEnded(SectionStats const& _sectionStats) override;\n\n        void benchmarkStarting(BenchmarkInfo const& info) override;\n        void benchmarkEnded(BenchmarkStats const& stats) override;\n\n        void testCaseEnded(TestCaseStats const& _testCaseStats) override;\n        void testGroupEnded(TestGroupStats const& _testGroupStats) override;\n        void testRunEnded(TestRunStats const& _testRunStats) override;\n\n    private:\n\n        void lazyPrint();\n\n        void lazyPrintWithoutClosingBenchmarkTable();\n        void lazyPrintRunInfo();\n        void lazyPrintGroupInfo();\n        void printTestCaseAndSectionHeader();\n\n        void printClosedHeader(std::string const& _name);\n        void printOpenHeader(std::string const& _name);\n\n        // if string has a : in first line will set indent to follow it on\n        // subsequent lines\n        void printHeaderString(std::string const& _string, std::size_t indent = 0);\n\n        void printTotals(Totals const& totals);\n        void printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row);\n\n        void printTotalsDivider(Totals const& totals);\n        void printSummaryDivider();\n\n    private:\n        bool m_headerPrinted = false;\n    };\n\n} // end namespace Catch\n\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n\n// end catch_reporter_console.h\n// start catch_reporter_junit.h\n\n// start catch_xmlwriter.h\n\n#include <vector>\n\nnamespace Catch {\n\n    class XmlEncode {\n    public:\n        enum ForWhat { ForTextNodes, ForAttributes };\n\n        XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes );\n\n        void encodeTo( std::ostream& os ) const;\n\n        friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode );\n\n    private:\n        std::string m_str;\n        ForWhat m_forWhat;\n    };\n\n    class XmlWriter {\n    public:\n\n        class ScopedElement {\n        public:\n            ScopedElement( XmlWriter* writer );\n\n            ScopedElement( ScopedElement&& other ) noexcept;\n            ScopedElement& operator=( ScopedElement&& other ) noexcept;\n\n            ~ScopedElement();\n\n            ScopedElement& writeText( std::string const& text, bool indent = true );\n\n            template<typename T>\n            ScopedElement& writeAttribute( std::string const& name, T const& attribute ) {\n                m_writer->writeAttribute( name, attribute );\n                return *this;\n            }\n\n        private:\n            mutable XmlWriter* m_writer = nullptr;\n        };\n\n        XmlWriter( std::ostream& os = Catch::cout() );\n        ~XmlWriter();\n\n        XmlWriter( XmlWriter const& ) = delete;\n        XmlWriter& operator=( XmlWriter const& ) = delete;\n\n        XmlWriter& startElement( std::string const& name );\n\n        ScopedElement scopedElement( std::string const& name );\n\n        XmlWriter& endElement();\n\n        XmlWriter& writeAttribute( std::string const& name, std::string const& attribute );\n\n        XmlWriter& writeAttribute( std::string const& name, bool attribute );\n\n        template<typename T>\n        XmlWriter& writeAttribute( std::string const& name, T const& attribute ) {\n            ReusableStringStream rss;\n            rss << attribute;\n            return writeAttribute( name, rss.str() );\n        }\n\n        XmlWriter& writeText( std::string const& text, bool indent = true );\n\n        XmlWriter& writeComment( std::string const& text );\n\n        void writeStylesheetRef( std::string const& url );\n\n        XmlWriter& writeBlankLine();\n\n        void ensureTagClosed();\n\n    private:\n\n        void writeDeclaration();\n\n        void newlineIfNecessary();\n\n        bool m_tagIsOpen = false;\n        bool m_needsNewline = false;\n        std::vector<std::string> m_tags;\n        std::string m_indent;\n        std::ostream& m_os;\n    };\n\n}\n\n// end catch_xmlwriter.h\nnamespace Catch {\n\n    class JunitReporter : public CumulativeReporterBase<JunitReporter> {\n    public:\n        JunitReporter(ReporterConfig const& _config);\n\n        ~JunitReporter() override;\n\n        static std::string getDescription();\n\n        void noMatchingTestCases(std::string const& /*spec*/) override;\n\n        void testRunStarting(TestRunInfo const& runInfo) override;\n\n        void testGroupStarting(GroupInfo const& groupInfo) override;\n\n        void testCaseStarting(TestCaseInfo const& testCaseInfo) override;\n        bool assertionEnded(AssertionStats const& assertionStats) override;\n\n        void testCaseEnded(TestCaseStats const& testCaseStats) override;\n\n        void testGroupEnded(TestGroupStats const& testGroupStats) override;\n\n        void testRunEndedCumulative() override;\n\n        void writeGroup(TestGroupNode const& groupNode, double suiteTime);\n\n        void writeTestCase(TestCaseNode const& testCaseNode);\n\n        void writeSection(std::string const& className,\n                          std::string const& rootName,\n                          SectionNode const& sectionNode);\n\n        void writeAssertions(SectionNode const& sectionNode);\n        void writeAssertion(AssertionStats const& stats);\n\n        XmlWriter xml;\n        Timer suiteTimer;\n        std::string stdOutForSuite;\n        std::string stdErrForSuite;\n        unsigned int unexpectedExceptions = 0;\n        bool m_okToFail = false;\n    };\n\n} // end namespace Catch\n\n// end catch_reporter_junit.h\n// start catch_reporter_xml.h\n\nnamespace Catch {\n    class XmlReporter : public StreamingReporterBase<XmlReporter> {\n    public:\n        XmlReporter(ReporterConfig const& _config);\n\n        ~XmlReporter() override;\n\n        static std::string getDescription();\n\n        virtual std::string getStylesheetRef() const;\n\n        void writeSourceInfo(SourceLineInfo const& sourceInfo);\n\n    public: // StreamingReporterBase\n\n        void noMatchingTestCases(std::string const& s) override;\n\n        void testRunStarting(TestRunInfo const& testInfo) override;\n\n        void testGroupStarting(GroupInfo const& groupInfo) override;\n\n        void testCaseStarting(TestCaseInfo const& testInfo) override;\n\n        void sectionStarting(SectionInfo const& sectionInfo) override;\n\n        void assertionStarting(AssertionInfo const&) override;\n\n        bool assertionEnded(AssertionStats const& assertionStats) override;\n\n        void sectionEnded(SectionStats const& sectionStats) override;\n\n        void testCaseEnded(TestCaseStats const& testCaseStats) override;\n\n        void testGroupEnded(TestGroupStats const& testGroupStats) override;\n\n        void testRunEnded(TestRunStats const& testRunStats) override;\n\n    private:\n        Timer m_testCaseTimer;\n        XmlWriter m_xml;\n        int m_sectionDepth = 0;\n    };\n\n} // end namespace Catch\n\n// end catch_reporter_xml.h\n\n// end catch_external_interfaces.h\n#endif\n\n#endif // ! CATCH_CONFIG_IMPL_ONLY\n\n#ifdef CATCH_IMPL\n// start catch_impl.hpp\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wweak-vtables\"\n#endif\n\n// Keep these here for external reporters\n// start catch_test_case_tracker.h\n\n#include <string>\n#include <vector>\n#include <memory>\n\nnamespace Catch {\nnamespace TestCaseTracking {\n\n    struct NameAndLocation {\n        std::string name;\n        SourceLineInfo location;\n\n        NameAndLocation( std::string const& _name, SourceLineInfo const& _location );\n    };\n\n    struct ITracker;\n\n    using ITrackerPtr = std::shared_ptr<ITracker>;\n\n    struct ITracker {\n        virtual ~ITracker();\n\n        // static queries\n        virtual NameAndLocation const& nameAndLocation() const = 0;\n\n        // dynamic queries\n        virtual bool isComplete() const = 0; // Successfully completed or failed\n        virtual bool isSuccessfullyCompleted() const = 0;\n        virtual bool isOpen() const = 0; // Started but not complete\n        virtual bool hasChildren() const = 0;\n\n        virtual ITracker& parent() = 0;\n\n        // actions\n        virtual void close() = 0; // Successfully complete\n        virtual void fail() = 0;\n        virtual void markAsNeedingAnotherRun() = 0;\n\n        virtual void addChild( ITrackerPtr const& child ) = 0;\n        virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) = 0;\n        virtual void openChild() = 0;\n\n        // Debug/ checking\n        virtual bool isSectionTracker() const = 0;\n        virtual bool isIndexTracker() const = 0;\n    };\n\n    class TrackerContext {\n\n        enum RunState {\n            NotStarted,\n            Executing,\n            CompletedCycle\n        };\n\n        ITrackerPtr m_rootTracker;\n        ITracker* m_currentTracker = nullptr;\n        RunState m_runState = NotStarted;\n\n    public:\n\n        static TrackerContext& instance();\n\n        ITracker& startRun();\n        void endRun();\n\n        void startCycle();\n        void completeCycle();\n\n        bool completedCycle() const;\n        ITracker& currentTracker();\n        void setCurrentTracker( ITracker* tracker );\n    };\n\n    class TrackerBase : public ITracker {\n    protected:\n        enum CycleState {\n            NotStarted,\n            Executing,\n            ExecutingChildren,\n            NeedsAnotherRun,\n            CompletedSuccessfully,\n            Failed\n        };\n\n        class TrackerHasName {\n            NameAndLocation m_nameAndLocation;\n        public:\n            TrackerHasName( NameAndLocation const& nameAndLocation );\n            bool operator ()( ITrackerPtr const& tracker ) const;\n        };\n\n        using Children = std::vector<ITrackerPtr>;\n        NameAndLocation m_nameAndLocation;\n        TrackerContext& m_ctx;\n        ITracker* m_parent;\n        Children m_children;\n        CycleState m_runState = NotStarted;\n\n    public:\n        TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );\n\n        NameAndLocation const& nameAndLocation() const override;\n        bool isComplete() const override;\n        bool isSuccessfullyCompleted() const override;\n        bool isOpen() const override;\n        bool hasChildren() const override;\n\n        void addChild( ITrackerPtr const& child ) override;\n\n        ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override;\n        ITracker& parent() override;\n\n        void openChild() override;\n\n        bool isSectionTracker() const override;\n        bool isIndexTracker() const override;\n\n        void open();\n\n        void close() override;\n        void fail() override;\n        void markAsNeedingAnotherRun() override;\n\n    private:\n        void moveToParent();\n        void moveToThis();\n    };\n\n    class SectionTracker : public TrackerBase {\n        std::vector<std::string> m_filters;\n    public:\n        SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );\n\n        bool isSectionTracker() const override;\n\n        static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation );\n\n        void tryOpen();\n\n        void addInitialFilters( std::vector<std::string> const& filters );\n        void addNextFilters( std::vector<std::string> const& filters );\n    };\n\n    class IndexTracker : public TrackerBase {\n        int m_size;\n        int m_index = -1;\n    public:\n        IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size );\n\n        bool isIndexTracker() const override;\n        void close() override;\n\n        static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size );\n\n        int index() const;\n\n        void moveNext();\n    };\n\n} // namespace TestCaseTracking\n\nusing TestCaseTracking::ITracker;\nusing TestCaseTracking::TrackerContext;\nusing TestCaseTracking::SectionTracker;\nusing TestCaseTracking::IndexTracker;\n\n} // namespace Catch\n\n// end catch_test_case_tracker.h\n\n// start catch_leak_detector.h\n\nnamespace Catch {\n\n    struct LeakDetector {\n        LeakDetector();\n    };\n\n}\n// end catch_leak_detector.h\n// Cpp files will be included in the single-header file here\n// start catch_approx.cpp\n\n#include <cmath>\n#include <limits>\n\nnamespace {\n\n// Performs equivalent check of std::fabs(lhs - rhs) <= margin\n// But without the subtraction to allow for INFINITY in comparison\nbool marginComparison(double lhs, double rhs, double margin) {\n    return (lhs + margin >= rhs) && (rhs + margin >= lhs);\n}\n\n}\n\nnamespace Catch {\nnamespace Detail {\n\n    Approx::Approx ( double value )\n    :   m_epsilon( std::numeric_limits<float>::epsilon()*100 ),\n        m_margin( 0.0 ),\n        m_scale( 0.0 ),\n        m_value( value )\n    {}\n\n    Approx Approx::custom() {\n        return Approx( 0 );\n    }\n\n    std::string Approx::toString() const {\n        ReusableStringStream rss;\n        rss << \"Approx( \" << ::Catch::Detail::stringify( m_value ) << \" )\";\n        return rss.str();\n    }\n\n    bool Approx::equalityComparisonImpl(const double other) const {\n        // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value\n        // Thanks to Richard Harris for his help refining the scaled margin value\n        return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value)));\n    }\n\n} // end namespace Detail\n\nstd::string StringMaker<Catch::Detail::Approx>::convert(Catch::Detail::Approx const& value) {\n    return value.toString();\n}\n\n} // end namespace Catch\n// end catch_approx.cpp\n// start catch_assertionhandler.cpp\n\n// start catch_context.h\n\n#include <memory>\n\nnamespace Catch {\n\n    struct IResultCapture;\n    struct IRunner;\n    struct IConfig;\n    struct IMutableContext;\n\n    using IConfigPtr = std::shared_ptr<IConfig const>;\n\n    struct IContext\n    {\n        virtual ~IContext();\n\n        virtual IResultCapture* getResultCapture() = 0;\n        virtual IRunner* getRunner() = 0;\n        virtual IConfigPtr const& getConfig() const = 0;\n    };\n\n    struct IMutableContext : IContext\n    {\n        virtual ~IMutableContext();\n        virtual void setResultCapture( IResultCapture* resultCapture ) = 0;\n        virtual void setRunner( IRunner* runner ) = 0;\n        virtual void setConfig( IConfigPtr const& config ) = 0;\n\n    private:\n        static IMutableContext *currentContext;\n        friend IMutableContext& getCurrentMutableContext();\n        friend void cleanUpContext();\n        static void createContext();\n    };\n\n    inline IMutableContext& getCurrentMutableContext()\n    {\n        if( !IMutableContext::currentContext )\n            IMutableContext::createContext();\n        return *IMutableContext::currentContext;\n    }\n\n    inline IContext& getCurrentContext()\n    {\n        return getCurrentMutableContext();\n    }\n\n    void cleanUpContext();\n}\n\n// end catch_context.h\n// start catch_debugger.h\n\nnamespace Catch {\n    bool isDebuggerActive();\n}\n\n#ifdef CATCH_PLATFORM_MAC\n\n    #define CATCH_TRAP() __asm__(\"int $3\\n\" : : ) /* NOLINT */\n\n#elif defined(CATCH_PLATFORM_LINUX)\n    // If we can use inline assembler, do it because this allows us to break\n    // directly at the location of the failing check instead of breaking inside\n    // raise() called from it, i.e. one stack frame below.\n    #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64))\n        #define CATCH_TRAP() asm volatile (\"int $3\") /* NOLINT */\n    #else // Fall back to the generic way.\n        #include <signal.h>\n\n        #define CATCH_TRAP() raise(SIGTRAP)\n    #endif\n#elif defined(_MSC_VER)\n    #define CATCH_TRAP() __debugbreak()\n#elif defined(__MINGW32__)\n    extern \"C\" __declspec(dllimport) void __stdcall DebugBreak();\n    #define CATCH_TRAP() DebugBreak()\n#endif\n\n#ifdef CATCH_TRAP\n    #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); }\n#else\n    #define CATCH_BREAK_INTO_DEBUGGER() (void)0, 0\n#endif\n\n// end catch_debugger.h\n// start catch_run_context.h\n\n// start catch_fatal_condition.h\n\n#include <string>\n\n#if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////\n// start catch_windows_h_proxy.h\n\n\n#if defined(CATCH_PLATFORM_WINDOWS)\n\n#if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX)\n#  define CATCH_DEFINED_NOMINMAX\n#  define NOMINMAX\n#endif\n#if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN)\n#  define CATCH_DEFINED_WIN32_LEAN_AND_MEAN\n#  define WIN32_LEAN_AND_MEAN\n#endif\n\n#ifdef __AFXDLL\n#include <AfxWin.h>\n#else\n#include <windows.h>\n#endif\n\n#ifdef CATCH_DEFINED_NOMINMAX\n#  undef NOMINMAX\n#endif\n#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN\n#  undef WIN32_LEAN_AND_MEAN\n#endif\n\n#endif // defined(CATCH_PLATFORM_WINDOWS)\n\n// end catch_windows_h_proxy.h\n\n#  if !defined ( CATCH_CONFIG_WINDOWS_SEH )\n\nnamespace Catch {\n    struct FatalConditionHandler {\n        void reset();\n    };\n}\n\n#  else // CATCH_CONFIG_WINDOWS_SEH is defined\n\nnamespace Catch {\n\n    struct FatalConditionHandler {\n\n        static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo);\n        FatalConditionHandler();\n        static void reset();\n        ~FatalConditionHandler();\n\n    private:\n        static bool isSet;\n        static ULONG guaranteeSize;\n        static PVOID exceptionHandlerHandle;\n    };\n\n} // namespace Catch\n\n#  endif // CATCH_CONFIG_WINDOWS_SEH\n\n#else // Not Windows - assumed to be POSIX compatible //////////////////////////\n\n#  if !defined(CATCH_CONFIG_POSIX_SIGNALS)\n\nnamespace Catch {\n    struct FatalConditionHandler {\n        void reset();\n    };\n}\n\n#  else // CATCH_CONFIG_POSIX_SIGNALS is defined\n\n#include <signal.h>\n\nnamespace Catch {\n\n    struct FatalConditionHandler {\n\n        static bool isSet;\n        static struct sigaction oldSigActions[];// [sizeof(signalDefs) / sizeof(SignalDefs)];\n        static stack_t oldSigStack;\n        static char altStackMem[];\n\n        static void handleSignal( int sig );\n\n        FatalConditionHandler();\n        ~FatalConditionHandler();\n        static void reset();\n    };\n\n} // namespace Catch\n\n#  endif // CATCH_CONFIG_POSIX_SIGNALS\n\n#endif // not Windows\n\n// end catch_fatal_condition.h\n#include <string>\n\nnamespace Catch {\n\n    struct IMutableContext;\n\n    ///////////////////////////////////////////////////////////////////////////\n\n    class RunContext : public IResultCapture, public IRunner {\n\n    public:\n        RunContext( RunContext const& ) = delete;\n        RunContext& operator =( RunContext const& ) = delete;\n\n        explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter );\n\n        ~RunContext() override;\n\n        void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount );\n        void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount );\n\n        Totals runTest(TestCase const& testCase);\n\n        IConfigPtr config() const;\n        IStreamingReporter& reporter() const;\n\n    public: // IResultCapture\n\n        // Assertion handlers\n        void handleExpr\n                (   AssertionInfo const& info,\n                    ITransientExpression const& expr,\n                    AssertionReaction& reaction ) override;\n        void handleMessage\n                (   AssertionInfo const& info,\n                    ResultWas::OfType resultType,\n                    StringRef const& message,\n                    AssertionReaction& reaction ) override;\n        void handleUnexpectedExceptionNotThrown\n                (   AssertionInfo const& info,\n                    AssertionReaction& reaction ) override;\n        void handleUnexpectedInflightException\n                (   AssertionInfo const& info,\n                    std::string const& message,\n                    AssertionReaction& reaction ) override;\n        void handleIncomplete\n                (   AssertionInfo const& info ) override;\n        void handleNonExpr\n                (   AssertionInfo const &info,\n                    ResultWas::OfType resultType,\n                    AssertionReaction &reaction ) override;\n\n        bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override;\n\n        void sectionEnded( SectionEndInfo const& endInfo ) override;\n        void sectionEndedEarly( SectionEndInfo const& endInfo ) override;\n\n        void benchmarkStarting( BenchmarkInfo const& info ) override;\n        void benchmarkEnded( BenchmarkStats const& stats ) override;\n\n        void pushScopedMessage( MessageInfo const& message ) override;\n        void popScopedMessage( MessageInfo const& message ) override;\n\n        std::string getCurrentTestName() const override;\n\n        const AssertionResult* getLastResult() const override;\n\n        void exceptionEarlyReported() override;\n\n        void handleFatalErrorCondition( StringRef message ) override;\n\n        bool lastAssertionPassed() override;\n\n        void assertionPassed() override;\n\n    public:\n        // !TBD We need to do this another way!\n        bool aborting() const override;\n\n    private:\n\n        void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr );\n        void invokeActiveTestCase();\n\n        void resetAssertionInfo();\n        bool testForMissingAssertions( Counts& assertions );\n\n        void assertionEnded( AssertionResult const& result );\n        void reportExpr\n                (   AssertionInfo const &info,\n                    ResultWas::OfType resultType,\n                    ITransientExpression const *expr,\n                    bool negated );\n\n        void populateReaction( AssertionReaction& reaction );\n\n    private:\n\n        void handleUnfinishedSections();\n\n        TestRunInfo m_runInfo;\n        IMutableContext& m_context;\n        TestCase const* m_activeTestCase = nullptr;\n        ITracker* m_testCaseTracker;\n        Option<AssertionResult> m_lastResult;\n\n        IConfigPtr m_config;\n        Totals m_totals;\n        IStreamingReporterPtr m_reporter;\n        std::vector<MessageInfo> m_messages;\n        AssertionInfo m_lastAssertionInfo;\n        std::vector<SectionEndInfo> m_unfinishedSections;\n        std::vector<ITracker*> m_activeSections;\n        TrackerContext m_trackerContext;\n        bool m_lastAssertionPassed = false;\n        bool m_shouldReportUnexpected = true;\n        bool m_includeSuccessfulResults;\n    };\n\n} // end namespace Catch\n\n// end catch_run_context.h\nnamespace Catch {\n\n    auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& {\n        expr.streamReconstructedExpression( os );\n        return os;\n    }\n\n    LazyExpression::LazyExpression( bool isNegated )\n    :   m_isNegated( isNegated )\n    {}\n\n    LazyExpression::LazyExpression( LazyExpression const& other ) : m_isNegated( other.m_isNegated ) {}\n\n    LazyExpression::operator bool() const {\n        return m_transientExpression != nullptr;\n    }\n\n    auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream& {\n        if( lazyExpr.m_isNegated )\n            os << \"!\";\n\n        if( lazyExpr ) {\n            if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() )\n                os << \"(\" << *lazyExpr.m_transientExpression << \")\";\n            else\n                os << *lazyExpr.m_transientExpression;\n        }\n        else {\n            os << \"{** error - unchecked empty expression requested **}\";\n        }\n        return os;\n    }\n\n    AssertionHandler::AssertionHandler\n        (   StringRef macroName,\n            SourceLineInfo const& lineInfo,\n            StringRef capturedExpression,\n            ResultDisposition::Flags resultDisposition )\n    :   m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },\n        m_resultCapture( getResultCapture() )\n    {}\n\n    void AssertionHandler::handleExpr( ITransientExpression const& expr ) {\n        m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );\n    }\n    void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) {\n        m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction );\n    }\n\n    auto AssertionHandler::allowThrows() const -> bool {\n        return getCurrentContext().getConfig()->allowThrows();\n    }\n\n    void AssertionHandler::complete() {\n        setCompleted();\n        if( m_reaction.shouldDebugBreak ) {\n\n            // If you find your debugger stopping you here then go one level up on the\n            // call-stack for the code that caused it (typically a failed assertion)\n\n            // (To go back to the test and change execution, jump over the throw, next)\n            CATCH_BREAK_INTO_DEBUGGER();\n        }\n        if( m_reaction.shouldThrow )\n            throw Catch::TestFailureException();\n    }\n    void AssertionHandler::setCompleted() {\n        m_completed = true;\n    }\n\n    void AssertionHandler::handleUnexpectedInflightException() {\n        m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction );\n    }\n\n    void AssertionHandler::handleExceptionThrownAsExpected() {\n        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);\n    }\n    void AssertionHandler::handleExceptionNotThrownAsExpected() {\n        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);\n    }\n\n    void AssertionHandler::handleUnexpectedExceptionNotThrown() {\n        m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction );\n    }\n\n    void AssertionHandler::handleThrowingCallSkipped() {\n        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);\n    }\n\n    // This is the overload that takes a string and infers the Equals matcher from it\n    // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp\n    void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString  ) {\n        handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString );\n    }\n\n} // namespace Catch\n// end catch_assertionhandler.cpp\n// start catch_assertionresult.cpp\n\nnamespace Catch {\n    AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):\n        lazyExpression(_lazyExpression),\n        resultType(_resultType) {}\n\n    std::string AssertionResultData::reconstructExpression() const {\n\n        if( reconstructedExpression.empty() ) {\n            if( lazyExpression ) {\n                ReusableStringStream rss;\n                rss << lazyExpression;\n                reconstructedExpression = rss.str();\n            }\n        }\n        return reconstructedExpression;\n    }\n\n    AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data )\n    :   m_info( info ),\n        m_resultData( data )\n    {}\n\n    // Result was a success\n    bool AssertionResult::succeeded() const {\n        return Catch::isOk( m_resultData.resultType );\n    }\n\n    // Result was a success, or failure is suppressed\n    bool AssertionResult::isOk() const {\n        return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition );\n    }\n\n    ResultWas::OfType AssertionResult::getResultType() const {\n        return m_resultData.resultType;\n    }\n\n    bool AssertionResult::hasExpression() const {\n        return m_info.capturedExpression[0] != 0;\n    }\n\n    bool AssertionResult::hasMessage() const {\n        return !m_resultData.message.empty();\n    }\n\n    std::string AssertionResult::getExpression() const {\n        if( isFalseTest( m_info.resultDisposition ) )\n            return \"!(\" + m_info.capturedExpression + \")\";\n        else\n            return m_info.capturedExpression;\n    }\n\n    std::string AssertionResult::getExpressionInMacro() const {\n        std::string expr;\n        if( m_info.macroName[0] == 0 )\n            expr = m_info.capturedExpression;\n        else {\n            expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );\n            expr += m_info.macroName.c_str();\n            expr += \"( \";\n            expr += m_info.capturedExpression.c_str();\n            expr += \" )\";\n        }\n        return expr;\n    }\n\n    bool AssertionResult::hasExpandedExpression() const {\n        return hasExpression() && getExpandedExpression() != getExpression();\n    }\n\n    std::string AssertionResult::getExpandedExpression() const {\n        std::string expr = m_resultData.reconstructExpression();\n        return expr.empty()\n                ? getExpression()\n                : expr;\n    }\n\n    std::string AssertionResult::getMessage() const {\n        return m_resultData.message;\n    }\n    SourceLineInfo AssertionResult::getSourceInfo() const {\n        return m_info.lineInfo;\n    }\n\n    StringRef AssertionResult::getTestMacroName() const {\n        return m_info.macroName;\n    }\n\n} // end namespace Catch\n// end catch_assertionresult.cpp\n// start catch_benchmark.cpp\n\nnamespace Catch {\n\n    auto BenchmarkLooper::getResolution() -> uint64_t {\n        return getEstimatedClockResolution() * getCurrentContext().getConfig()->benchmarkResolutionMultiple();\n    }\n\n    void BenchmarkLooper::reportStart() {\n        getResultCapture().benchmarkStarting( { m_name } );\n    }\n    auto BenchmarkLooper::needsMoreIterations() -> bool {\n        auto elapsed = m_timer.getElapsedNanoseconds();\n\n        // Exponentially increasing iterations until we're confident in our timer resolution\n        if( elapsed < m_resolution ) {\n            m_iterationsToRun *= 10;\n            return true;\n        }\n\n        getResultCapture().benchmarkEnded( { { m_name }, m_count, elapsed } );\n        return false;\n    }\n\n} // end namespace Catch\n// end catch_benchmark.cpp\n// start catch_capture_matchers.cpp\n\nnamespace Catch {\n\n    using StringMatcher = Matchers::Impl::MatcherBase<std::string>;\n\n    // This is the general overload that takes a any string matcher\n    // There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers\n    // the Equals matcher (so the header does not mention matchers)\n    void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString  ) {\n        std::string exceptionMessage = Catch::translateActiveException();\n        MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );\n        handler.handleExpr( expr );\n    }\n\n} // namespace Catch\n// end catch_capture_matchers.cpp\n// start catch_commandline.cpp\n\n// start catch_commandline.h\n\n// start catch_clara.h\n\n// Use Catch's value for console width (store Clara's off to the side, if present)\n#ifdef CLARA_CONFIG_CONSOLE_WIDTH\n#define CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#undef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#endif\n#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wweak-vtables\"\n#pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#pragma clang diagnostic ignored \"-Wshadow\"\n#endif\n\n// start clara.hpp\n// v1.0-develop.2\n// See https://github.com/philsquared/Clara\n\n\n#ifndef CATCH_CLARA_CONFIG_CONSOLE_WIDTH\n#define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 80\n#endif\n\n#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH\n#endif\n\n// ----------- #included from clara_textflow.hpp -----------\n\n// TextFlowCpp\n//\n// A single-header library for wrapping and laying out basic text, by Phil Nash\n//\n// This work is licensed under the BSD 2-Clause license.\n// See the accompanying LICENSE file, or the one at https://opensource.org/licenses/BSD-2-Clause\n//\n// This project is hosted at https://github.com/philsquared/textflowcpp\n\n\n#include <cassert>\n#include <ostream>\n#include <sstream>\n#include <vector>\n\n#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80\n#endif\n\nnamespace Catch { namespace clara { namespace TextFlow {\n\n    inline auto isWhitespace( char c ) -> bool {\n        static std::string chars = \" \\t\\n\\r\";\n        return chars.find( c ) != std::string::npos;\n    }\n    inline auto isBreakableBefore( char c ) -> bool {\n        static std::string chars = \"[({<|\";\n        return chars.find( c ) != std::string::npos;\n    }\n    inline auto isBreakableAfter( char c ) -> bool {\n        static std::string chars = \"])}>.,:;*+-=&/\\\\\";\n        return chars.find( c ) != std::string::npos;\n    }\n\n    class Columns;\n\n    class Column {\n        std::vector<std::string> m_strings;\n        size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;\n        size_t m_indent = 0;\n        size_t m_initialIndent = std::string::npos;\n\n    public:\n        class iterator {\n            friend Column;\n\n            Column const& m_column;\n            size_t m_stringIndex = 0;\n            size_t m_pos = 0;\n\n            size_t m_len = 0;\n            size_t m_end = 0;\n            bool m_suffix = false;\n\n            iterator( Column const& column, size_t stringIndex )\n            :   m_column( column ),\n                m_stringIndex( stringIndex )\n            {}\n\n            auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }\n\n            auto isBoundary( size_t at ) const -> bool {\n                assert( at > 0 );\n                assert( at <= line().size() );\n\n                return at == line().size() ||\n                       ( isWhitespace( line()[at] ) && !isWhitespace( line()[at-1] ) ) ||\n                       isBreakableBefore( line()[at] ) ||\n                       isBreakableAfter( line()[at-1] );\n            }\n\n            void calcLength() {\n                assert( m_stringIndex < m_column.m_strings.size() );\n\n                m_suffix = false;\n                auto width = m_column.m_width-indent();\n                m_end = m_pos;\n                while( m_end < line().size() && line()[m_end] != '\\n' )\n                    ++m_end;\n\n                if( m_end < m_pos + width ) {\n                    m_len = m_end - m_pos;\n                }\n                else {\n                    size_t len = width;\n                    while (len > 0 && !isBoundary(m_pos + len))\n                        --len;\n                    while (len > 0 && isWhitespace( line()[m_pos + len - 1] ))\n                        --len;\n\n                    if (len > 0) {\n                        m_len = len;\n                    } else {\n                        m_suffix = true;\n                        m_len = width - 1;\n                    }\n                }\n            }\n\n            auto indent() const -> size_t {\n                auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;\n                return initial == std::string::npos ? m_column.m_indent : initial;\n            }\n\n            auto addIndentAndSuffix(std::string const &plain) const -> std::string {\n                return std::string( indent(), ' ' ) + (m_suffix ? plain + \"-\" : plain);\n            }\n\n        public:\n            explicit iterator( Column const& column ) : m_column( column ) {\n                assert( m_column.m_width > m_column.m_indent );\n                assert( m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent );\n                calcLength();\n                if( m_len == 0 )\n                    m_stringIndex++; // Empty string\n            }\n\n            auto operator *() const -> std::string {\n                assert( m_stringIndex < m_column.m_strings.size() );\n                assert( m_pos <= m_end );\n                if( m_pos + m_column.m_width < m_end )\n                    return addIndentAndSuffix(line().substr(m_pos, m_len));\n                else\n                    return addIndentAndSuffix(line().substr(m_pos, m_end - m_pos));\n            }\n\n            auto operator ++() -> iterator& {\n                m_pos += m_len;\n                if( m_pos < line().size() && line()[m_pos] == '\\n' )\n                    m_pos += 1;\n                else\n                    while( m_pos < line().size() && isWhitespace( line()[m_pos] ) )\n                        ++m_pos;\n\n                if( m_pos == line().size() ) {\n                    m_pos = 0;\n                    ++m_stringIndex;\n                }\n                if( m_stringIndex < m_column.m_strings.size() )\n                    calcLength();\n                return *this;\n            }\n            auto operator ++(int) -> iterator {\n                iterator prev( *this );\n                operator++();\n                return prev;\n            }\n\n            auto operator ==( iterator const& other ) const -> bool {\n                return\n                    m_pos == other.m_pos &&\n                    m_stringIndex == other.m_stringIndex &&\n                    &m_column == &other.m_column;\n            }\n            auto operator !=( iterator const& other ) const -> bool {\n                return !operator==( other );\n            }\n        };\n        using const_iterator = iterator;\n\n        explicit Column( std::string const& text ) { m_strings.push_back( text ); }\n\n        auto width( size_t newWidth ) -> Column& {\n            assert( newWidth > 0 );\n            m_width = newWidth;\n            return *this;\n        }\n        auto indent( size_t newIndent ) -> Column& {\n            m_indent = newIndent;\n            return *this;\n        }\n        auto initialIndent( size_t newIndent ) -> Column& {\n            m_initialIndent = newIndent;\n            return *this;\n        }\n\n        auto width() const -> size_t { return m_width; }\n        auto begin() const -> iterator { return iterator( *this ); }\n        auto end() const -> iterator { return { *this, m_strings.size() }; }\n\n        inline friend std::ostream& operator << ( std::ostream& os, Column const& col ) {\n            bool first = true;\n            for( auto line : col ) {\n                if( first )\n                    first = false;\n                else\n                    os << \"\\n\";\n                os <<  line;\n            }\n            return os;\n        }\n\n        auto operator + ( Column const& other ) -> Columns;\n\n        auto toString() const -> std::string {\n            std::ostringstream oss;\n            oss << *this;\n            return oss.str();\n        }\n    };\n\n    class Spacer : public Column {\n\n    public:\n        explicit Spacer( size_t spaceWidth ) : Column( \"\" ) {\n            width( spaceWidth );\n        }\n    };\n\n    class Columns {\n        std::vector<Column> m_columns;\n\n    public:\n\n        class iterator {\n            friend Columns;\n            struct EndTag {};\n\n            std::vector<Column> const& m_columns;\n            std::vector<Column::iterator> m_iterators;\n            size_t m_activeIterators;\n\n            iterator( Columns const& columns, EndTag )\n            :   m_columns( columns.m_columns ),\n                m_activeIterators( 0 )\n            {\n                m_iterators.reserve( m_columns.size() );\n\n                for( auto const& col : m_columns )\n                    m_iterators.push_back( col.end() );\n            }\n\n        public:\n            explicit iterator( Columns const& columns )\n            :   m_columns( columns.m_columns ),\n                m_activeIterators( m_columns.size() )\n            {\n                m_iterators.reserve( m_columns.size() );\n\n                for( auto const& col : m_columns )\n                    m_iterators.push_back( col.begin() );\n            }\n\n            auto operator ==( iterator const& other ) const -> bool {\n                return m_iterators == other.m_iterators;\n            }\n            auto operator !=( iterator const& other ) const -> bool {\n                return m_iterators != other.m_iterators;\n            }\n            auto operator *() const -> std::string {\n                std::string row, padding;\n\n                for( size_t i = 0; i < m_columns.size(); ++i ) {\n                    auto width = m_columns[i].width();\n                    if( m_iterators[i] != m_columns[i].end() ) {\n                        std::string col = *m_iterators[i];\n                        row += padding + col;\n                        if( col.size() < width )\n                            padding = std::string( width - col.size(), ' ' );\n                        else\n                            padding = \"\";\n                    }\n                    else {\n                        padding += std::string( width, ' ' );\n                    }\n                }\n                return row;\n            }\n            auto operator ++() -> iterator& {\n                for( size_t i = 0; i < m_columns.size(); ++i ) {\n                    if (m_iterators[i] != m_columns[i].end())\n                        ++m_iterators[i];\n                }\n                return *this;\n            }\n            auto operator ++(int) -> iterator {\n                iterator prev( *this );\n                operator++();\n                return prev;\n            }\n        };\n        using const_iterator = iterator;\n\n        auto begin() const -> iterator { return iterator( *this ); }\n        auto end() const -> iterator { return { *this, iterator::EndTag() }; }\n\n        auto operator += ( Column const& col ) -> Columns& {\n            m_columns.push_back( col );\n            return *this;\n        }\n        auto operator + ( Column const& col ) -> Columns {\n            Columns combined = *this;\n            combined += col;\n            return combined;\n        }\n\n        inline friend std::ostream& operator << ( std::ostream& os, Columns const& cols ) {\n\n            bool first = true;\n            for( auto line : cols ) {\n                if( first )\n                    first = false;\n                else\n                    os << \"\\n\";\n                os << line;\n            }\n            return os;\n        }\n\n        auto toString() const -> std::string {\n            std::ostringstream oss;\n            oss << *this;\n            return oss.str();\n        }\n    };\n\n    inline auto Column::operator + ( Column const& other ) -> Columns {\n        Columns cols;\n        cols += *this;\n        cols += other;\n        return cols;\n    }\n}}} // namespace Catch::clara::TextFlow\n\n// ----------- end of #include from clara_textflow.hpp -----------\n// ........... back in clara.hpp\n\n#include <memory>\n#include <set>\n#include <algorithm>\n\n#if !defined(CATCH_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )\n#define CATCH_PLATFORM_WINDOWS\n#endif\n\nnamespace Catch { namespace clara {\nnamespace detail {\n\n    // Traits for extracting arg and return type of lambdas (for single argument lambdas)\n    template<typename L>\n    struct UnaryLambdaTraits : UnaryLambdaTraits<decltype( &L::operator() )> {};\n\n    template<typename ClassT, typename ReturnT, typename... Args>\n    struct UnaryLambdaTraits<ReturnT( ClassT::* )( Args... ) const> {\n        static const bool isValid = false;\n    };\n\n    template<typename ClassT, typename ReturnT, typename ArgT>\n    struct UnaryLambdaTraits<ReturnT( ClassT::* )( ArgT ) const> {\n        static const bool isValid = true;\n        using ArgType = typename std::remove_const<typename std::remove_reference<ArgT>::type>::type;;\n        using ReturnType = ReturnT;\n    };\n\n    class TokenStream;\n\n    // Transport for raw args (copied from main args, or supplied via init list for testing)\n    class Args {\n        friend TokenStream;\n        std::string m_exeName;\n        std::vector<std::string> m_args;\n\n    public:\n        Args( int argc, char *argv[] ) {\n            m_exeName = argv[0];\n            for( int i = 1; i < argc; ++i )\n                m_args.push_back( argv[i] );\n        }\n\n        Args( std::initializer_list<std::string> args )\n        :   m_exeName( *args.begin() ),\n            m_args( args.begin()+1, args.end() )\n        {}\n\n        auto exeName() const -> std::string {\n            return m_exeName;\n        }\n    };\n\n    // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string\n    // may encode an option + its argument if the : or = form is used\n    enum class TokenType {\n        Option, Argument\n    };\n    struct Token {\n        TokenType type;\n        std::string token;\n    };\n\n    inline auto isOptPrefix( char c ) -> bool {\n        return c == '-'\n#ifdef CATCH_PLATFORM_WINDOWS\n            || c == '/'\n#endif\n        ;\n    }\n\n    // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled\n    class TokenStream {\n        using Iterator = std::vector<std::string>::const_iterator;\n        Iterator it;\n        Iterator itEnd;\n        std::vector<Token> m_tokenBuffer;\n\n        void loadBuffer() {\n            m_tokenBuffer.resize( 0 );\n\n            // Skip any empty strings\n            while( it != itEnd && it->empty() )\n                ++it;\n\n            if( it != itEnd ) {\n                auto const &next = *it;\n                if( isOptPrefix( next[0] ) ) {\n                    auto delimiterPos = next.find_first_of( \" :=\" );\n                    if( delimiterPos != std::string::npos ) {\n                        m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } );\n                        m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } );\n                    } else {\n                        if( next[1] != '-' && next.size() > 2 ) {\n                            std::string opt = \"- \";\n                            for( size_t i = 1; i < next.size(); ++i ) {\n                                opt[1] = next[i];\n                                m_tokenBuffer.push_back( { TokenType::Option, opt } );\n                            }\n                        } else {\n                            m_tokenBuffer.push_back( { TokenType::Option, next } );\n                        }\n                    }\n                } else {\n                    m_tokenBuffer.push_back( { TokenType::Argument, next } );\n                }\n            }\n        }\n\n    public:\n        explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {}\n\n        TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) {\n            loadBuffer();\n        }\n\n        explicit operator bool() const {\n            return !m_tokenBuffer.empty() || it != itEnd;\n        }\n\n        auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); }\n\n        auto operator*() const -> Token {\n            assert( !m_tokenBuffer.empty() );\n            return m_tokenBuffer.front();\n        }\n\n        auto operator->() const -> Token const * {\n            assert( !m_tokenBuffer.empty() );\n            return &m_tokenBuffer.front();\n        }\n\n        auto operator++() -> TokenStream & {\n            if( m_tokenBuffer.size() >= 2 ) {\n                m_tokenBuffer.erase( m_tokenBuffer.begin() );\n            } else {\n                if( it != itEnd )\n                    ++it;\n                loadBuffer();\n            }\n            return *this;\n        }\n    };\n\n    class ResultBase {\n    public:\n        enum Type {\n            Ok, LogicError, RuntimeError\n        };\n\n    protected:\n        ResultBase( Type type ) : m_type( type ) {}\n        virtual ~ResultBase() = default;\n\n        virtual void enforceOk() const = 0;\n\n        Type m_type;\n    };\n\n    template<typename T>\n    class ResultValueBase : public ResultBase {\n    public:\n        auto value() const -> T const & {\n            enforceOk();\n            return m_value;\n        }\n\n    protected:\n        ResultValueBase( Type type ) : ResultBase( type ) {}\n\n        ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) {\n            if( m_type == ResultBase::Ok )\n                new( &m_value ) T( other.m_value );\n        }\n\n        ResultValueBase( Type, T const &value ) : ResultBase( Ok ) {\n            new( &m_value ) T( value );\n        }\n\n        auto operator=( ResultValueBase const &other ) -> ResultValueBase & {\n            if( m_type == ResultBase::Ok )\n                m_value.~T();\n            ResultBase::operator=(other);\n            if( m_type == ResultBase::Ok )\n                new( &m_value ) T( other.m_value );\n            return *this;\n        }\n\n        ~ResultValueBase() {\n            if( m_type == Ok )\n                m_value.~T();\n        }\n\n        union {\n            T m_value;\n        };\n    };\n\n    template<>\n    class ResultValueBase<void> : public ResultBase {\n    protected:\n        using ResultBase::ResultBase;\n    };\n\n    template<typename T = void>\n    class BasicResult : public ResultValueBase<T> {\n    public:\n        template<typename U>\n        explicit BasicResult( BasicResult<U> const &other )\n        :   ResultValueBase<T>( other.type() ),\n            m_errorMessage( other.errorMessage() )\n        {\n            assert( type() != ResultBase::Ok );\n        }\n\n        template<typename U>\n        static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; }\n        static auto ok() -> BasicResult { return { ResultBase::Ok }; }\n        static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; }\n        static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; }\n\n        explicit operator bool() const { return m_type == ResultBase::Ok; }\n        auto type() const -> ResultBase::Type { return m_type; }\n        auto errorMessage() const -> std::string { return m_errorMessage; }\n\n    protected:\n        virtual void enforceOk() const {\n            // !TBD: If no exceptions, std::terminate here or something\n            switch( m_type ) {\n                case ResultBase::LogicError:\n                    throw std::logic_error( m_errorMessage );\n                case ResultBase::RuntimeError:\n                    throw std::runtime_error( m_errorMessage );\n                case ResultBase::Ok:\n                    break;\n            }\n        }\n\n        std::string m_errorMessage; // Only populated if resultType is an error\n\n        BasicResult( ResultBase::Type type, std::string const &message )\n        :   ResultValueBase<T>(type),\n            m_errorMessage(message)\n        {\n            assert( m_type != ResultBase::Ok );\n        }\n\n        using ResultValueBase<T>::ResultValueBase;\n        using ResultBase::m_type;\n    };\n\n    enum class ParseResultType {\n        Matched, NoMatch, ShortCircuitAll, ShortCircuitSame\n    };\n\n    class ParseState {\n    public:\n\n        ParseState( ParseResultType type, TokenStream const &remainingTokens )\n        : m_type(type),\n          m_remainingTokens( remainingTokens )\n        {}\n\n        auto type() const -> ParseResultType { return m_type; }\n        auto remainingTokens() const -> TokenStream { return m_remainingTokens; }\n\n    private:\n        ParseResultType m_type;\n        TokenStream m_remainingTokens;\n    };\n\n    using Result = BasicResult<void>;\n    using ParserResult = BasicResult<ParseResultType>;\n    using InternalParseResult = BasicResult<ParseState>;\n\n    struct HelpColumns {\n        std::string left;\n        std::string right;\n    };\n\n    template<typename T>\n    inline auto convertInto( std::string const &source, T& target ) -> ParserResult {\n        std::stringstream ss;\n        ss << source;\n        ss >> target;\n        if( ss.fail() )\n            return ParserResult::runtimeError( \"Unable to convert '\" + source + \"' to destination type\" );\n        else\n            return ParserResult::ok( ParseResultType::Matched );\n    }\n    inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult {\n        target = source;\n        return ParserResult::ok( ParseResultType::Matched );\n    }\n    inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {\n        std::string srcLC = source;\n        std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast<char>( ::tolower(c) ); } );\n        if (srcLC == \"y\" || srcLC == \"1\" || srcLC == \"true\" || srcLC == \"yes\" || srcLC == \"on\")\n            target = true;\n        else if (srcLC == \"n\" || srcLC == \"0\" || srcLC == \"false\" || srcLC == \"no\" || srcLC == \"off\")\n            target = false;\n        else\n            return ParserResult::runtimeError( \"Expected a boolean value but did not recognise: '\" + source + \"'\" );\n        return ParserResult::ok( ParseResultType::Matched );\n    }\n\n    struct BoundRefBase {\n        BoundRefBase() = default;\n        BoundRefBase( BoundRefBase const & ) = delete;\n        BoundRefBase( BoundRefBase && ) = delete;\n        BoundRefBase &operator=( BoundRefBase const & ) = delete;\n        BoundRefBase &operator=( BoundRefBase && ) = delete;\n\n        virtual ~BoundRefBase() = default;\n\n        virtual auto isFlag() const -> bool = 0;\n        virtual auto isContainer() const -> bool { return false; }\n        virtual auto setValue( std::string const &arg ) -> ParserResult = 0;\n        virtual auto setFlag( bool flag ) -> ParserResult = 0;\n    };\n\n    struct BoundValueRefBase : BoundRefBase {\n        auto isFlag() const -> bool override { return false; }\n\n        auto setFlag( bool ) -> ParserResult override {\n            return ParserResult::logicError( \"Flags can only be set on boolean fields\" );\n        }\n    };\n\n    struct BoundFlagRefBase : BoundRefBase {\n        auto isFlag() const -> bool override { return true; }\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            bool flag;\n            auto result = convertInto( arg, flag );\n            if( result )\n                setFlag( flag );\n            return result;\n        }\n    };\n\n    template<typename T>\n    struct BoundRef : BoundValueRefBase {\n        T &m_ref;\n\n        explicit BoundRef( T &ref ) : m_ref( ref ) {}\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            return convertInto( arg, m_ref );\n        }\n    };\n\n    template<typename T>\n    struct BoundRef<std::vector<T>> : BoundValueRefBase {\n        std::vector<T> &m_ref;\n\n        explicit BoundRef( std::vector<T> &ref ) : m_ref( ref ) {}\n\n        auto isContainer() const -> bool override { return true; }\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            T temp;\n            auto result = convertInto( arg, temp );\n            if( result )\n                m_ref.push_back( temp );\n            return result;\n        }\n    };\n\n    struct BoundFlagRef : BoundFlagRefBase {\n        bool &m_ref;\n\n        explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {}\n\n        auto setFlag( bool flag ) -> ParserResult override {\n            m_ref = flag;\n            return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    template<typename ReturnType>\n    struct LambdaInvoker {\n        static_assert( std::is_same<ReturnType, ParserResult>::value, \"Lambda must return void or clara::ParserResult\" );\n\n        template<typename L, typename ArgType>\n        static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {\n            return lambda( arg );\n        }\n    };\n\n    template<>\n    struct LambdaInvoker<void> {\n        template<typename L, typename ArgType>\n        static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {\n            lambda( arg );\n            return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    template<typename ArgType, typename L>\n    inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult {\n        ArgType temp;\n        auto result = convertInto( arg, temp );\n        return !result\n           ? result\n           : LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( lambda, temp );\n    };\n\n    template<typename L>\n    struct BoundLambda : BoundValueRefBase {\n        L m_lambda;\n\n        static_assert( UnaryLambdaTraits<L>::isValid, \"Supplied lambda must take exactly one argument\" );\n        explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {}\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            return invokeLambda<typename UnaryLambdaTraits<L>::ArgType>( m_lambda, arg );\n        }\n    };\n\n    template<typename L>\n    struct BoundFlagLambda : BoundFlagRefBase {\n        L m_lambda;\n\n        static_assert( UnaryLambdaTraits<L>::isValid, \"Supplied lambda must take exactly one argument\" );\n        static_assert( std::is_same<typename UnaryLambdaTraits<L>::ArgType, bool>::value, \"flags must be boolean\" );\n\n        explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {}\n\n        auto setFlag( bool flag ) -> ParserResult override {\n            return LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( m_lambda, flag );\n        }\n    };\n\n    enum class Optionality { Optional, Required };\n\n    struct Parser;\n\n    class ParserBase {\n    public:\n        virtual ~ParserBase() = default;\n        virtual auto validate() const -> Result { return Result::ok(); }\n        virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult  = 0;\n        virtual auto cardinality() const -> size_t { return 1; }\n\n        auto parse( Args const &args ) const -> InternalParseResult {\n            return parse( args.exeName(), TokenStream( args ) );\n        }\n    };\n\n    template<typename DerivedT>\n    class ComposableParserImpl : public ParserBase {\n    public:\n        template<typename T>\n        auto operator|( T const &other ) const -> Parser;\n    };\n\n    // Common code and state for Args and Opts\n    template<typename DerivedT>\n    class ParserRefImpl : public ComposableParserImpl<DerivedT> {\n    protected:\n        Optionality m_optionality = Optionality::Optional;\n        std::shared_ptr<BoundRefBase> m_ref;\n        std::string m_hint;\n        std::string m_description;\n\n        explicit ParserRefImpl( std::shared_ptr<BoundRefBase> const &ref ) : m_ref( ref ) {}\n\n    public:\n        template<typename T>\n        ParserRefImpl( T &ref, std::string const &hint )\n        :   m_ref( std::make_shared<BoundRef<T>>( ref ) ),\n            m_hint( hint )\n        {}\n\n        template<typename LambdaT>\n        ParserRefImpl( LambdaT const &ref, std::string const &hint )\n        :   m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),\n            m_hint(hint)\n        {}\n\n        auto operator()( std::string const &description ) -> DerivedT & {\n            m_description = description;\n            return static_cast<DerivedT &>( *this );\n        }\n\n        auto optional() -> DerivedT & {\n            m_optionality = Optionality::Optional;\n            return static_cast<DerivedT &>( *this );\n        };\n\n        auto required() -> DerivedT & {\n            m_optionality = Optionality::Required;\n            return static_cast<DerivedT &>( *this );\n        };\n\n        auto isOptional() const -> bool {\n            return m_optionality == Optionality::Optional;\n        }\n\n        auto cardinality() const -> size_t override {\n            if( m_ref->isContainer() )\n                return 0;\n            else\n                return 1;\n        }\n\n        auto hint() const -> std::string { return m_hint; }\n    };\n\n    class ExeName : public ComposableParserImpl<ExeName> {\n        std::shared_ptr<std::string> m_name;\n        std::shared_ptr<BoundRefBase> m_ref;\n\n        template<typename LambdaT>\n        static auto makeRef(LambdaT const &lambda) -> std::shared_ptr<BoundRefBase> {\n            return std::make_shared<BoundLambda<LambdaT>>( lambda) ;\n        }\n\n    public:\n        ExeName() : m_name( std::make_shared<std::string>( \"<executable>\" ) ) {}\n\n        explicit ExeName( std::string &ref ) : ExeName() {\n            m_ref = std::make_shared<BoundRef<std::string>>( ref );\n        }\n\n        template<typename LambdaT>\n        explicit ExeName( LambdaT const& lambda ) : ExeName() {\n            m_ref = std::make_shared<BoundLambda<LambdaT>>( lambda );\n        }\n\n        // The exe name is not parsed out of the normal tokens, but is handled specially\n        auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {\n            return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );\n        }\n\n        auto name() const -> std::string { return *m_name; }\n        auto set( std::string const& newName ) -> ParserResult {\n\n            auto lastSlash = newName.find_last_of( \"\\\\/\" );\n            auto filename = ( lastSlash == std::string::npos )\n                    ? newName\n                    : newName.substr( lastSlash+1 );\n\n            *m_name = filename;\n            if( m_ref )\n                return m_ref->setValue( filename );\n            else\n                return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    class Arg : public ParserRefImpl<Arg> {\n    public:\n        using ParserRefImpl::ParserRefImpl;\n\n        auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override {\n            auto validationResult = validate();\n            if( !validationResult )\n                return InternalParseResult( validationResult );\n\n            auto remainingTokens = tokens;\n            auto const &token = *remainingTokens;\n            if( token.type != TokenType::Argument )\n                return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );\n\n            auto result = m_ref->setValue( remainingTokens->token );\n            if( !result )\n                return InternalParseResult( result );\n            else\n                return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );\n        }\n    };\n\n    inline auto normaliseOpt( std::string const &optName ) -> std::string {\n#ifdef CATCH_PLATFORM_WINDOWS\n        if( optName[0] == '/' )\n            return \"-\" + optName.substr( 1 );\n        else\n#endif\n            return optName;\n    }\n\n    class Opt : public ParserRefImpl<Opt> {\n    protected:\n        std::vector<std::string> m_optNames;\n\n    public:\n        template<typename LambdaT>\n        explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared<BoundFlagLambda<LambdaT>>( ref ) ) {}\n\n        explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared<BoundFlagRef>( ref ) ) {}\n\n        template<typename LambdaT>\n        Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}\n\n        template<typename T>\n        Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}\n\n        auto operator[]( std::string const &optName ) -> Opt & {\n            m_optNames.push_back( optName );\n            return *this;\n        }\n\n        auto getHelpColumns() const -> std::vector<HelpColumns> {\n            std::ostringstream oss;\n            bool first = true;\n            for( auto const &opt : m_optNames ) {\n                if (first)\n                    first = false;\n                else\n                    oss << \", \";\n                oss << opt;\n            }\n            if( !m_hint.empty() )\n                oss << \" <\" << m_hint << \">\";\n            return { { oss.str(), m_description } };\n        }\n\n        auto isMatch( std::string const &optToken ) const -> bool {\n            auto normalisedToken = normaliseOpt( optToken );\n            for( auto const &name : m_optNames ) {\n                if( normaliseOpt( name ) == normalisedToken )\n                    return true;\n            }\n            return false;\n        }\n\n        using ParserBase::parse;\n\n        auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {\n            auto validationResult = validate();\n            if( !validationResult )\n                return InternalParseResult( validationResult );\n\n            auto remainingTokens = tokens;\n            if( remainingTokens && remainingTokens->type == TokenType::Option ) {\n                auto const &token = *remainingTokens;\n                if( isMatch(token.token ) ) {\n                    if( m_ref->isFlag() ) {\n                        auto result = m_ref->setFlag( true );\n                        if( !result )\n                            return InternalParseResult( result );\n                        if( result.value() == ParseResultType::ShortCircuitAll )\n                            return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );\n                    } else {\n                        ++remainingTokens;\n                        if( !remainingTokens )\n                            return InternalParseResult::runtimeError( \"Expected argument following \" + token.token );\n                        auto const &argToken = *remainingTokens;\n                        if( argToken.type != TokenType::Argument )\n                            return InternalParseResult::runtimeError( \"Expected argument following \" + token.token );\n                        auto result = m_ref->setValue( argToken.token );\n                        if( !result )\n                            return InternalParseResult( result );\n                        if( result.value() == ParseResultType::ShortCircuitAll )\n                            return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );\n                    }\n                    return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );\n                }\n            }\n            return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );\n        }\n\n        auto validate() const -> Result override {\n            if( m_optNames.empty() )\n                return Result::logicError( \"No options supplied to Opt\" );\n            for( auto const &name : m_optNames ) {\n                if( name.empty() )\n                    return Result::logicError( \"Option name cannot be empty\" );\n#ifdef CATCH_PLATFORM_WINDOWS\n                if( name[0] != '-' && name[0] != '/' )\n                    return Result::logicError( \"Option name must begin with '-' or '/'\" );\n#else\n                if( name[0] != '-' )\n                    return Result::logicError( \"Option name must begin with '-'\" );\n#endif\n            }\n            return ParserRefImpl::validate();\n        }\n    };\n\n    struct Help : Opt {\n        Help( bool &showHelpFlag )\n        :   Opt([&]( bool flag ) {\n                showHelpFlag = flag;\n                return ParserResult::ok( ParseResultType::ShortCircuitAll );\n            })\n        {\n            static_cast<Opt &>( *this )\n                    (\"display usage information\")\n                    [\"-?\"][\"-h\"][\"--help\"]\n                    .optional();\n        }\n    };\n\n    struct Parser : ParserBase {\n\n        mutable ExeName m_exeName;\n        std::vector<Opt> m_options;\n        std::vector<Arg> m_args;\n\n        auto operator|=( ExeName const &exeName ) -> Parser & {\n            m_exeName = exeName;\n            return *this;\n        }\n\n        auto operator|=( Arg const &arg ) -> Parser & {\n            m_args.push_back(arg);\n            return *this;\n        }\n\n        auto operator|=( Opt const &opt ) -> Parser & {\n            m_options.push_back(opt);\n            return *this;\n        }\n\n        auto operator|=( Parser const &other ) -> Parser & {\n            m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end());\n            m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end());\n            return *this;\n        }\n\n        template<typename T>\n        auto operator|( T const &other ) const -> Parser {\n            return Parser( *this ) |= other;\n        }\n\n        auto getHelpColumns() const -> std::vector<HelpColumns> {\n            std::vector<HelpColumns> cols;\n            for (auto const &o : m_options) {\n                auto childCols = o.getHelpColumns();\n                cols.insert( cols.end(), childCols.begin(), childCols.end() );\n            }\n            return cols;\n        }\n\n        void writeToStream( std::ostream &os ) const {\n            if (!m_exeName.name().empty()) {\n                os << \"usage:\\n\" << \"  \" << m_exeName.name() << \" \";\n                bool required = true, first = true;\n                for( auto const &arg : m_args ) {\n                    if (first)\n                        first = false;\n                    else\n                        os << \" \";\n                    if( arg.isOptional() && required ) {\n                        os << \"[\";\n                        required = false;\n                    }\n                    os << \"<\" << arg.hint() << \">\";\n                    if( arg.cardinality() == 0 )\n                        os << \" ... \";\n                }\n                if( !required )\n                    os << \"]\";\n                if( !m_options.empty() )\n                    os << \" options\";\n                os << \"\\n\\nwhere options are:\" << std::endl;\n            }\n\n            auto rows = getHelpColumns();\n            size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH;\n            size_t optWidth = 0;\n            for( auto const &cols : rows )\n                optWidth = (std::max)(optWidth, cols.left.size() + 2);\n\n            for( auto const &cols : rows ) {\n                auto row =\n                        TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) +\n                        TextFlow::Spacer(4) +\n                        TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth );\n                os << row << std::endl;\n            }\n        }\n\n        friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& {\n            parser.writeToStream( os );\n            return os;\n        }\n\n        auto validate() const -> Result override {\n            for( auto const &opt : m_options ) {\n                auto result = opt.validate();\n                if( !result )\n                    return result;\n            }\n            for( auto const &arg : m_args ) {\n                auto result = arg.validate();\n                if( !result )\n                    return result;\n            }\n            return Result::ok();\n        }\n\n        using ParserBase::parse;\n\n        auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override {\n\n            struct ParserInfo {\n                ParserBase const* parser = nullptr;\n                size_t count = 0;\n            };\n            const size_t totalParsers = m_options.size() + m_args.size();\n            assert( totalParsers < 512 );\n            // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do\n            ParserInfo parseInfos[512];\n\n            {\n                size_t i = 0;\n                for (auto const &opt : m_options) parseInfos[i++].parser = &opt;\n                for (auto const &arg : m_args) parseInfos[i++].parser = &arg;\n            }\n\n            m_exeName.set( exeName );\n\n            auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );\n            while( result.value().remainingTokens() ) {\n                bool tokenParsed = false;\n\n                for( size_t i = 0; i < totalParsers; ++i ) {\n                    auto&  parseInfo = parseInfos[i];\n                    if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) {\n                        result = parseInfo.parser->parse(exeName, result.value().remainingTokens());\n                        if (!result)\n                            return result;\n                        if (result.value().type() != ParseResultType::NoMatch) {\n                            tokenParsed = true;\n                            ++parseInfo.count;\n                            break;\n                        }\n                    }\n                }\n\n                if( result.value().type() == ParseResultType::ShortCircuitAll )\n                    return result;\n                if( !tokenParsed )\n                    return InternalParseResult::runtimeError( \"Unrecognised token: \" + result.value().remainingTokens()->token );\n            }\n            // !TBD Check missing required options\n            return result;\n        }\n    };\n\n    template<typename DerivedT>\n    template<typename T>\n    auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {\n        return Parser() | static_cast<DerivedT const &>( *this ) | other;\n    }\n} // namespace detail\n\n// A Combined parser\nusing detail::Parser;\n\n// A parser for options\nusing detail::Opt;\n\n// A parser for arguments\nusing detail::Arg;\n\n// Wrapper for argc, argv from main()\nusing detail::Args;\n\n// Specifies the name of the executable\nusing detail::ExeName;\n\n// Convenience wrapper for option parser that specifies the help option\nusing detail::Help;\n\n// enum of result types from a parse\nusing detail::ParseResultType;\n\n// Result type for parser operation\nusing detail::ParserResult;\n\n}} // namespace Catch::clara\n\n// end clara.hpp\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n// Restore Clara's value for console width, if present\n#ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH\n#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH\n#undef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH\n#endif\n\n// end catch_clara.h\nnamespace Catch {\n\n    clara::Parser makeCommandLineParser( ConfigData& config );\n\n} // end namespace Catch\n\n// end catch_commandline.h\n#include <fstream>\n#include <ctime>\n\nnamespace Catch {\n\n    clara::Parser makeCommandLineParser( ConfigData& config ) {\n\n        using namespace clara;\n\n        auto const setWarning = [&]( std::string const& warning ) {\n                if( warning != \"NoAssertions\" )\n                    return ParserResult::runtimeError( \"Unrecognised warning: '\" + warning + \"'\" );\n                config.warnings = static_cast<WarnAbout::What>( config.warnings | WarnAbout::NoAssertions );\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const loadTestNamesFromFile = [&]( std::string const& filename ) {\n                std::ifstream f( filename.c_str() );\n                if( !f.is_open() )\n                    return ParserResult::runtimeError( \"Unable to load input file: '\" + filename + \"'\" );\n\n                std::string line;\n                while( std::getline( f, line ) ) {\n                    line = trim(line);\n                    if( !line.empty() && !startsWith( line, '#' ) ) {\n                        if( !startsWith( line, '\"' ) )\n                            line = '\"' + line + '\"';\n                        config.testsOrTags.push_back( line + ',' );\n                    }\n                }\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setTestOrder = [&]( std::string const& order ) {\n                if( startsWith( \"declared\", order ) )\n                    config.runOrder = RunTests::InDeclarationOrder;\n                else if( startsWith( \"lexical\", order ) )\n                    config.runOrder = RunTests::InLexicographicalOrder;\n                else if( startsWith( \"random\", order ) )\n                    config.runOrder = RunTests::InRandomOrder;\n                else\n                    return clara::ParserResult::runtimeError( \"Unrecognised ordering: '\" + order + \"'\" );\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setRngSeed = [&]( std::string const& seed ) {\n                if( seed != \"time\" )\n                    return clara::detail::convertInto( seed, config.rngSeed );\n                config.rngSeed = static_cast<unsigned int>( std::time(nullptr) );\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setColourUsage = [&]( std::string const& useColour ) {\n                    auto mode = toLower( useColour );\n\n                    if( mode == \"yes\" )\n                        config.useColour = UseColour::Yes;\n                    else if( mode == \"no\" )\n                        config.useColour = UseColour::No;\n                    else if( mode == \"auto\" )\n                        config.useColour = UseColour::Auto;\n                    else\n                        return ParserResult::runtimeError( \"colour mode must be one of: auto, yes or no. '\" + useColour + \"' not recognised\" );\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setWaitForKeypress = [&]( std::string const& keypress ) {\n                auto keypressLc = toLower( keypress );\n                if( keypressLc == \"start\" )\n                    config.waitForKeypress = WaitForKeypress::BeforeStart;\n                else if( keypressLc == \"exit\" )\n                    config.waitForKeypress = WaitForKeypress::BeforeExit;\n                else if( keypressLc == \"both\" )\n                    config.waitForKeypress = WaitForKeypress::BeforeStartAndExit;\n                else\n                    return ParserResult::runtimeError( \"keypress argument must be one of: start, exit or both. '\" + keypress + \"' not recognised\" );\n            return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setVerbosity = [&]( std::string const& verbosity ) {\n            auto lcVerbosity = toLower( verbosity );\n            if( lcVerbosity == \"quiet\" )\n                config.verbosity = Verbosity::Quiet;\n            else if( lcVerbosity == \"normal\" )\n                config.verbosity = Verbosity::Normal;\n            else if( lcVerbosity == \"high\" )\n                config.verbosity = Verbosity::High;\n            else\n                return ParserResult::runtimeError( \"Unrecognised verbosity, '\" + verbosity + \"'\" );\n            return ParserResult::ok( ParseResultType::Matched );\n        };\n\n        auto cli\n            = ExeName( config.processName )\n            | Help( config.showHelp )\n            | Opt( config.listTests )\n                [\"-l\"][\"--list-tests\"]\n                ( \"list all/matching test cases\" )\n            | Opt( config.listTags )\n                [\"-t\"][\"--list-tags\"]\n                ( \"list all/matching tags\" )\n            | Opt( config.showSuccessfulTests )\n                [\"-s\"][\"--success\"]\n                ( \"include successful tests in output\" )\n            | Opt( config.shouldDebugBreak )\n                [\"-b\"][\"--break\"]\n                ( \"break into debugger on failure\" )\n            | Opt( config.noThrow )\n                [\"-e\"][\"--nothrow\"]\n                ( \"skip exception tests\" )\n            | Opt( config.showInvisibles )\n                [\"-i\"][\"--invisibles\"]\n                ( \"show invisibles (tabs, newlines)\" )\n            | Opt( config.outputFilename, \"filename\" )\n                [\"-o\"][\"--out\"]\n                ( \"output filename\" )\n            | Opt( config.reporterNames, \"name\" )\n                [\"-r\"][\"--reporter\"]\n                ( \"reporter to use (defaults to console)\" )\n            | Opt( config.name, \"name\" )\n                [\"-n\"][\"--name\"]\n                ( \"suite name\" )\n            | Opt( [&]( bool ){ config.abortAfter = 1; } )\n                [\"-a\"][\"--abort\"]\n                ( \"abort at first failure\" )\n            | Opt( [&]( int x ){ config.abortAfter = x; }, \"no. failures\" )\n                [\"-x\"][\"--abortx\"]\n                ( \"abort after x failures\" )\n            | Opt( setWarning, \"warning name\" )\n                [\"-w\"][\"--warn\"]\n                ( \"enable warnings\" )\n            | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, \"yes|no\" )\n                [\"-d\"][\"--durations\"]\n                ( \"show test durations\" )\n            | Opt( loadTestNamesFromFile, \"filename\" )\n                [\"-f\"][\"--input-file\"]\n                ( \"load test names to run from a file\" )\n            | Opt( config.filenamesAsTags )\n                [\"-#\"][\"--filenames-as-tags\"]\n                ( \"adds a tag for the filename\" )\n            | Opt( config.sectionsToRun, \"section name\" )\n                [\"-c\"][\"--section\"]\n                ( \"specify section to run\" )\n            | Opt( setVerbosity, \"quiet|normal|high\" )\n                [\"-v\"][\"--verbosity\"]\n                ( \"set output verbosity\" )\n            | Opt( config.listTestNamesOnly )\n                [\"--list-test-names-only\"]\n                ( \"list all/matching test cases names only\" )\n            | Opt( config.listReporters )\n                [\"--list-reporters\"]\n                ( \"list all reporters\" )\n            | Opt( setTestOrder, \"decl|lex|rand\" )\n                [\"--order\"]\n                ( \"test case order (defaults to decl)\" )\n            | Opt( setRngSeed, \"'time'|number\" )\n                [\"--rng-seed\"]\n                ( \"set a specific seed for random numbers\" )\n            | Opt( setColourUsage, \"yes|no\" )\n                [\"--use-colour\"]\n                ( \"should output be colourised\" )\n            | Opt( config.libIdentify )\n                [\"--libidentify\"]\n                ( \"report name and version according to libidentify standard\" )\n            | Opt( setWaitForKeypress, \"start|exit|both\" )\n                [\"--wait-for-keypress\"]\n                ( \"waits for a keypress before exiting\" )\n            | Opt( config.benchmarkResolutionMultiple, \"multiplier\" )\n                [\"--benchmark-resolution-multiple\"]\n                ( \"multiple of clock resolution to run benchmarks\" )\n\n            | Arg( config.testsOrTags, \"test name|pattern|tags\" )\n                ( \"which test or tests to use\" );\n\n        return cli;\n    }\n\n} // end namespace Catch\n// end catch_commandline.cpp\n// start catch_common.cpp\n\n#include <cstring>\n#include <ostream>\n\nnamespace Catch {\n\n    bool SourceLineInfo::empty() const noexcept {\n        return file[0] == '\\0';\n    }\n    bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {\n        return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);\n    }\n    bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept {\n        return line < other.line || ( line == other.line && (std::strcmp(file, other.file) < 0));\n    }\n\n    std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {\n#ifndef __GNUG__\n        os << info.file << '(' << info.line << ')';\n#else\n        os << info.file << ':' << info.line;\n#endif\n        return os;\n    }\n\n    std::string StreamEndStop::operator+() const {\n        return std::string();\n    }\n\n    NonCopyable::NonCopyable() = default;\n    NonCopyable::~NonCopyable() = default;\n\n}\n// end catch_common.cpp\n// start catch_config.cpp\n\n// start catch_enforce.h\n\n#include <stdexcept>\n#include <iosfwd>\n\n#define CATCH_PREPARE_EXCEPTION( type, msg ) \\\n    type( static_cast<std::ostringstream&&>( Catch::ReusableStringStream().get() << msg ).str() )\n#define CATCH_INTERNAL_ERROR( msg ) \\\n    throw CATCH_PREPARE_EXCEPTION( std::logic_error, CATCH_INTERNAL_LINEINFO << \": Internal Catch error: \" << msg);\n#define CATCH_ERROR( msg ) \\\n    throw CATCH_PREPARE_EXCEPTION( std::domain_error, msg )\n#define CATCH_ENFORCE( condition, msg ) \\\n    do{ if( !(condition) ) CATCH_ERROR( msg ); } while(false)\n\n// end catch_enforce.h\nnamespace Catch {\n\n    Config::Config( ConfigData const& data )\n    :   m_data( data ),\n        m_stream( openStream() )\n    {\n        if( !data.testsOrTags.empty() ) {\n            TestSpecParser parser( ITagAliasRegistry::get() );\n            for( auto const& testOrTags : data.testsOrTags )\n                parser.parse( testOrTags );\n            m_testSpec = parser.testSpec();\n        }\n    }\n\n    std::string const& Config::getFilename() const {\n        return m_data.outputFilename ;\n    }\n\n    bool Config::listTests() const          { return m_data.listTests; }\n    bool Config::listTestNamesOnly() const  { return m_data.listTestNamesOnly; }\n    bool Config::listTags() const           { return m_data.listTags; }\n    bool Config::listReporters() const      { return m_data.listReporters; }\n\n    std::string Config::getProcessName() const { return m_data.processName; }\n\n    std::vector<std::string> const& Config::getReporterNames() const { return m_data.reporterNames; }\n    std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }\n\n    TestSpec const& Config::testSpec() const { return m_testSpec; }\n\n    bool Config::showHelp() const { return m_data.showHelp; }\n\n    // IConfig interface\n    bool Config::allowThrows() const                   { return !m_data.noThrow; }\n    std::ostream& Config::stream() const               { return m_stream->stream(); }\n    std::string Config::name() const                   { return m_data.name.empty() ? m_data.processName : m_data.name; }\n    bool Config::includeSuccessfulResults() const      { return m_data.showSuccessfulTests; }\n    bool Config::warnAboutMissingAssertions() const    { return m_data.warnings & WarnAbout::NoAssertions; }\n    ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; }\n    RunTests::InWhatOrder Config::runOrder() const     { return m_data.runOrder; }\n    unsigned int Config::rngSeed() const               { return m_data.rngSeed; }\n    int Config::benchmarkResolutionMultiple() const    { return m_data.benchmarkResolutionMultiple; }\n    UseColour::YesOrNo Config::useColour() const       { return m_data.useColour; }\n    bool Config::shouldDebugBreak() const              { return m_data.shouldDebugBreak; }\n    int Config::abortAfter() const                     { return m_data.abortAfter; }\n    bool Config::showInvisibles() const                { return m_data.showInvisibles; }\n    Verbosity Config::verbosity() const                { return m_data.verbosity; }\n\n    IStream const* Config::openStream() {\n        return Catch::makeStream(m_data.outputFilename);\n    }\n\n} // end namespace Catch\n// end catch_config.cpp\n// start catch_console_colour.cpp\n\n#if defined(__clang__)\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#endif\n\n// start catch_errno_guard.h\n\nnamespace Catch {\n\n    class ErrnoGuard {\n    public:\n        ErrnoGuard();\n        ~ErrnoGuard();\n    private:\n        int m_oldErrno;\n    };\n\n}\n\n// end catch_errno_guard.h\n#include <sstream>\n\nnamespace Catch {\n    namespace {\n\n        struct IColourImpl {\n            virtual ~IColourImpl() = default;\n            virtual void use( Colour::Code _colourCode ) = 0;\n        };\n\n        struct NoColourImpl : IColourImpl {\n            void use( Colour::Code ) {}\n\n            static IColourImpl* instance() {\n                static NoColourImpl s_instance;\n                return &s_instance;\n            }\n        };\n\n    } // anon namespace\n} // namespace Catch\n\n#if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI )\n#   ifdef CATCH_PLATFORM_WINDOWS\n#       define CATCH_CONFIG_COLOUR_WINDOWS\n#   else\n#       define CATCH_CONFIG_COLOUR_ANSI\n#   endif\n#endif\n\n#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) /////////////////////////////////////////\n\nnamespace Catch {\nnamespace {\n\n    class Win32ColourImpl : public IColourImpl {\n    public:\n        Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) )\n        {\n            CONSOLE_SCREEN_BUFFER_INFO csbiInfo;\n            GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo );\n            originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY );\n            originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );\n        }\n\n        virtual void use( Colour::Code _colourCode ) override {\n            switch( _colourCode ) {\n                case Colour::None:      return setTextAttribute( originalForegroundAttributes );\n                case Colour::White:     return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );\n                case Colour::Red:       return setTextAttribute( FOREGROUND_RED );\n                case Colour::Green:     return setTextAttribute( FOREGROUND_GREEN );\n                case Colour::Blue:      return setTextAttribute( FOREGROUND_BLUE );\n                case Colour::Cyan:      return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN );\n                case Colour::Yellow:    return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN );\n                case Colour::Grey:      return setTextAttribute( 0 );\n\n                case Colour::LightGrey:     return setTextAttribute( FOREGROUND_INTENSITY );\n                case Colour::BrightRed:     return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED );\n                case Colour::BrightGreen:   return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN );\n                case Colour::BrightWhite:   return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );\n\n                case Colour::Bright: CATCH_INTERNAL_ERROR( \"not a colour\" );\n            }\n        }\n\n    private:\n        void setTextAttribute( WORD _textAttribute ) {\n            SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes );\n        }\n        HANDLE stdoutHandle;\n        WORD originalForegroundAttributes;\n        WORD originalBackgroundAttributes;\n    };\n\n    IColourImpl* platformColourInstance() {\n        static Win32ColourImpl s_instance;\n\n        IConfigPtr config = getCurrentContext().getConfig();\n        UseColour::YesOrNo colourMode = config\n            ? config->useColour()\n            : UseColour::Auto;\n        if( colourMode == UseColour::Auto )\n            colourMode = UseColour::Yes;\n        return colourMode == UseColour::Yes\n            ? &s_instance\n            : NoColourImpl::instance();\n    }\n\n} // end anon namespace\n} // end namespace Catch\n\n#elif defined( CATCH_CONFIG_COLOUR_ANSI ) //////////////////////////////////////\n\n#include <unistd.h>\n\nnamespace Catch {\nnamespace {\n\n    // use POSIX/ ANSI console terminal codes\n    // Thanks to Adam Strzelecki for original contribution\n    // (http://github.com/nanoant)\n    // https://github.com/philsquared/Catch/pull/131\n    class PosixColourImpl : public IColourImpl {\n    public:\n        virtual void use( Colour::Code _colourCode ) override {\n            switch( _colourCode ) {\n                case Colour::None:\n                case Colour::White:     return setColour( \"[0m\" );\n                case Colour::Red:       return setColour( \"[0;31m\" );\n                case Colour::Green:     return setColour( \"[0;32m\" );\n                case Colour::Blue:      return setColour( \"[0;34m\" );\n                case Colour::Cyan:      return setColour( \"[0;36m\" );\n                case Colour::Yellow:    return setColour( \"[0;33m\" );\n                case Colour::Grey:      return setColour( \"[1;30m\" );\n\n                case Colour::LightGrey:     return setColour( \"[0;37m\" );\n                case Colour::BrightRed:     return setColour( \"[1;31m\" );\n                case Colour::BrightGreen:   return setColour( \"[1;32m\" );\n                case Colour::BrightWhite:   return setColour( \"[1;37m\" );\n\n                case Colour::Bright: CATCH_INTERNAL_ERROR( \"not a colour\" );\n            }\n        }\n        static IColourImpl* instance() {\n            static PosixColourImpl s_instance;\n            return &s_instance;\n        }\n\n    private:\n        void setColour( const char* _escapeCode ) {\n            Catch::cout() << '\\033' << _escapeCode;\n        }\n    };\n\n    bool useColourOnPlatform() {\n        return\n#ifdef CATCH_PLATFORM_MAC\n            !isDebuggerActive() &&\n#endif\n            isatty(STDOUT_FILENO);\n    }\n    IColourImpl* platformColourInstance() {\n        ErrnoGuard guard;\n        IConfigPtr config = getCurrentContext().getConfig();\n        UseColour::YesOrNo colourMode = config\n            ? config->useColour()\n            : UseColour::Auto;\n        if( colourMode == UseColour::Auto )\n            colourMode = useColourOnPlatform()\n                ? UseColour::Yes\n                : UseColour::No;\n        return colourMode == UseColour::Yes\n            ? PosixColourImpl::instance()\n            : NoColourImpl::instance();\n    }\n\n} // end anon namespace\n} // end namespace Catch\n\n#else  // not Windows or ANSI ///////////////////////////////////////////////\n\nnamespace Catch {\n\n    static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); }\n\n} // end namespace Catch\n\n#endif // Windows/ ANSI/ None\n\nnamespace Catch {\n\n    Colour::Colour( Code _colourCode ) { use( _colourCode ); }\n    Colour::Colour( Colour&& rhs ) noexcept {\n        m_moved = rhs.m_moved;\n        rhs.m_moved = true;\n    }\n    Colour& Colour::operator=( Colour&& rhs ) noexcept {\n        m_moved = rhs.m_moved;\n        rhs.m_moved  = true;\n        return *this;\n    }\n\n    Colour::~Colour(){ if( !m_moved ) use( None ); }\n\n    void Colour::use( Code _colourCode ) {\n        static IColourImpl* impl = platformColourInstance();\n        impl->use( _colourCode );\n    }\n\n    std::ostream& operator << ( std::ostream& os, Colour const& ) {\n        return os;\n    }\n\n} // end namespace Catch\n\n#if defined(__clang__)\n#    pragma clang diagnostic pop\n#endif\n\n// end catch_console_colour.cpp\n// start catch_context.cpp\n\nnamespace Catch {\n\n    class Context : public IMutableContext, NonCopyable {\n\n    public: // IContext\n        virtual IResultCapture* getResultCapture() override {\n            return m_resultCapture;\n        }\n        virtual IRunner* getRunner() override {\n            return m_runner;\n        }\n\n        virtual IConfigPtr const& getConfig() const override {\n            return m_config;\n        }\n\n        virtual ~Context() override;\n\n    public: // IMutableContext\n        virtual void setResultCapture( IResultCapture* resultCapture ) override {\n            m_resultCapture = resultCapture;\n        }\n        virtual void setRunner( IRunner* runner ) override {\n            m_runner = runner;\n        }\n        virtual void setConfig( IConfigPtr const& config ) override {\n            m_config = config;\n        }\n\n        friend IMutableContext& getCurrentMutableContext();\n\n    private:\n        IConfigPtr m_config;\n        IRunner* m_runner = nullptr;\n        IResultCapture* m_resultCapture = nullptr;\n    };\n\n    IMutableContext *IMutableContext::currentContext = nullptr;\n\n    void IMutableContext::createContext()\n    {\n        currentContext = new Context();\n    }\n\n    void cleanUpContext() {\n        delete IMutableContext::currentContext;\n        IMutableContext::currentContext = nullptr;\n    }\n    IContext::~IContext() = default;\n    IMutableContext::~IMutableContext() = default;\n    Context::~Context() = default;\n}\n// end catch_context.cpp\n// start catch_debug_console.cpp\n\n// start catch_debug_console.h\n\n#include <string>\n\nnamespace Catch {\n    void writeToDebugConsole( std::string const& text );\n}\n\n// end catch_debug_console.h\n#ifdef CATCH_PLATFORM_WINDOWS\n\n    namespace Catch {\n        void writeToDebugConsole( std::string const& text ) {\n            ::OutputDebugStringA( text.c_str() );\n        }\n    }\n#else\n    namespace Catch {\n        void writeToDebugConsole( std::string const& text ) {\n            // !TBD: Need a version for Mac/ XCode and other IDEs\n            Catch::cout() << text;\n        }\n    }\n#endif // Platform\n// end catch_debug_console.cpp\n// start catch_debugger.cpp\n\n#ifdef CATCH_PLATFORM_MAC\n\n#  include <assert.h>\n#  include <stdbool.h>\n#  include <sys/types.h>\n#  include <unistd.h>\n#  include <sys/sysctl.h>\n#  include <cstddef>\n#  include <ostream>\n\nnamespace Catch {\n\n        // The following function is taken directly from the following technical note:\n        // http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html\n\n        // Returns true if the current process is being debugged (either\n        // running under the debugger or has a debugger attached post facto).\n        bool isDebuggerActive(){\n\n            int                 mib[4];\n            struct kinfo_proc   info;\n            std::size_t         size;\n\n            // Initialize the flags so that, if sysctl fails for some bizarre\n            // reason, we get a predictable result.\n\n            info.kp_proc.p_flag = 0;\n\n            // Initialize mib, which tells sysctl the info we want, in this case\n            // we're looking for information about a specific process ID.\n\n            mib[0] = CTL_KERN;\n            mib[1] = KERN_PROC;\n            mib[2] = KERN_PROC_PID;\n            mib[3] = getpid();\n\n            // Call sysctl.\n\n            size = sizeof(info);\n            if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) {\n                Catch::cerr() << \"\\n** Call to sysctl failed - unable to determine if debugger is active **\\n\" << std::endl;\n                return false;\n            }\n\n            // We're being debugged if the P_TRACED flag is set.\n\n            return ( (info.kp_proc.p_flag & P_TRACED) != 0 );\n        }\n    } // namespace Catch\n\n#elif defined(CATCH_PLATFORM_LINUX)\n    #include <fstream>\n    #include <string>\n\n    namespace Catch{\n        // The standard POSIX way of detecting a debugger is to attempt to\n        // ptrace() the process, but this needs to be done from a child and not\n        // this process itself to still allow attaching to this process later\n        // if wanted, so is rather heavy. Under Linux we have the PID of the\n        // \"debugger\" (which doesn't need to be gdb, of course, it could also\n        // be strace, for example) in /proc/$PID/status, so just get it from\n        // there instead.\n        bool isDebuggerActive(){\n            // Libstdc++ has a bug, where std::ifstream sets errno to 0\n            // This way our users can properly assert over errno values\n            ErrnoGuard guard;\n            std::ifstream in(\"/proc/self/status\");\n            for( std::string line; std::getline(in, line); ) {\n                static const int PREFIX_LEN = 11;\n                if( line.compare(0, PREFIX_LEN, \"TracerPid:\\t\") == 0 ) {\n                    // We're traced if the PID is not 0 and no other PID starts\n                    // with 0 digit, so it's enough to check for just a single\n                    // character.\n                    return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0';\n                }\n            }\n\n            return false;\n        }\n    } // namespace Catch\n#elif defined(_MSC_VER)\n    extern \"C\" __declspec(dllimport) int __stdcall IsDebuggerPresent();\n    namespace Catch {\n        bool isDebuggerActive() {\n            return IsDebuggerPresent() != 0;\n        }\n    }\n#elif defined(__MINGW32__)\n    extern \"C\" __declspec(dllimport) int __stdcall IsDebuggerPresent();\n    namespace Catch {\n        bool isDebuggerActive() {\n            return IsDebuggerPresent() != 0;\n        }\n    }\n#else\n    namespace Catch {\n       bool isDebuggerActive() { return false; }\n    }\n#endif // Platform\n// end catch_debugger.cpp\n// start catch_decomposer.cpp\n\nnamespace Catch {\n\n    ITransientExpression::~ITransientExpression() = default;\n\n    void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {\n        if( lhs.size() + rhs.size() < 40 &&\n                lhs.find('\\n') == std::string::npos &&\n                rhs.find('\\n') == std::string::npos )\n            os << lhs << \" \" << op << \" \" << rhs;\n        else\n            os << lhs << \"\\n\" << op << \"\\n\" << rhs;\n    }\n}\n// end catch_decomposer.cpp\n// start catch_errno_guard.cpp\n\n#include <cerrno>\n\nnamespace Catch {\n        ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}\n        ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }\n}\n// end catch_errno_guard.cpp\n// start catch_exception_translator_registry.cpp\n\n// start catch_exception_translator_registry.h\n\n#include <vector>\n#include <string>\n#include <memory>\n\nnamespace Catch {\n\n    class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry {\n    public:\n        ~ExceptionTranslatorRegistry();\n        virtual void registerTranslator( const IExceptionTranslator* translator );\n        virtual std::string translateActiveException() const override;\n        std::string tryTranslators() const;\n\n    private:\n        std::vector<std::unique_ptr<IExceptionTranslator const>> m_translators;\n    };\n}\n\n// end catch_exception_translator_registry.h\n#ifdef __OBJC__\n#import \"Foundation/Foundation.h\"\n#endif\n\nnamespace Catch {\n\n    ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() {\n    }\n\n    void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) {\n        m_translators.push_back( std::unique_ptr<const IExceptionTranslator>( translator ) );\n    }\n\n    std::string ExceptionTranslatorRegistry::translateActiveException() const {\n        try {\n#ifdef __OBJC__\n            // In Objective-C try objective-c exceptions first\n            @try {\n                return tryTranslators();\n            }\n            @catch (NSException *exception) {\n                return Catch::Detail::stringify( [exception description] );\n            }\n#else\n            return tryTranslators();\n#endif\n        }\n        catch( TestFailureException& ) {\n            std::rethrow_exception(std::current_exception());\n        }\n        catch( std::exception& ex ) {\n            return ex.what();\n        }\n        catch( std::string& msg ) {\n            return msg;\n        }\n        catch( const char* msg ) {\n            return msg;\n        }\n        catch(...) {\n            return \"Unknown exception\";\n        }\n    }\n\n    std::string ExceptionTranslatorRegistry::tryTranslators() const {\n        if( m_translators.empty() )\n            std::rethrow_exception(std::current_exception());\n        else\n            return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() );\n    }\n}\n// end catch_exception_translator_registry.cpp\n// start catch_fatal_condition.cpp\n\n#if defined(__GNUC__)\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wmissing-field-initializers\"\n#endif\n\nnamespace {\n    // Report the error condition\n    void reportFatal( char const * const message ) {\n        Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );\n    }\n}\n\n#if defined ( CATCH_PLATFORM_WINDOWS ) /////////////////////////////////////////\n\n#  if !defined ( CATCH_CONFIG_WINDOWS_SEH )\n\nnamespace Catch {\n    void FatalConditionHandler::reset() {}\n}\n\n#  else // CATCH_CONFIG_WINDOWS_SEH is defined\n\nnamespace Catch {\n    struct SignalDefs { DWORD id; const char* name; };\n\n    // There is no 1-1 mapping between signals and windows exceptions.\n    // Windows can easily distinguish between SO and SigSegV,\n    // but SigInt, SigTerm, etc are handled differently.\n    static SignalDefs signalDefs[] = {\n        { EXCEPTION_ILLEGAL_INSTRUCTION,  \"SIGILL - Illegal instruction signal\" },\n        { EXCEPTION_STACK_OVERFLOW, \"SIGSEGV - Stack overflow\" },\n        { EXCEPTION_ACCESS_VIOLATION, \"SIGSEGV - Segmentation violation signal\" },\n        { EXCEPTION_INT_DIVIDE_BY_ZERO, \"Divide by zero error\" },\n    };\n\n    LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {\n        for (auto const& def : signalDefs) {\n            if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {\n                reportFatal(def.name);\n            }\n        }\n        // If its not an exception we care about, pass it along.\n        // This stops us from eating debugger breaks etc.\n        return EXCEPTION_CONTINUE_SEARCH;\n    }\n\n    FatalConditionHandler::FatalConditionHandler() {\n        isSet = true;\n        // 32k seems enough for Catch to handle stack overflow,\n        // but the value was found experimentally, so there is no strong guarantee\n        guaranteeSize = 32 * 1024;\n        exceptionHandlerHandle = nullptr;\n        // Register as first handler in current chain\n        exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);\n        // Pass in guarantee size to be filled\n        SetThreadStackGuarantee(&guaranteeSize);\n    }\n\n    void FatalConditionHandler::reset() {\n        if (isSet) {\n            // Unregister handler and restore the old guarantee\n            RemoveVectoredExceptionHandler(exceptionHandlerHandle);\n            SetThreadStackGuarantee(&guaranteeSize);\n            exceptionHandlerHandle = nullptr;\n            isSet = false;\n        }\n    }\n\n    FatalConditionHandler::~FatalConditionHandler() {\n        reset();\n    }\n\nbool FatalConditionHandler::isSet = false;\nULONG FatalConditionHandler::guaranteeSize = 0;\nPVOID FatalConditionHandler::exceptionHandlerHandle = nullptr;\n\n} // namespace Catch\n\n#  endif // CATCH_CONFIG_WINDOWS_SEH\n\n#else // Not Windows - assumed to be POSIX compatible //////////////////////////\n\n#  if !defined(CATCH_CONFIG_POSIX_SIGNALS)\n\nnamespace Catch {\n    void FatalConditionHandler::reset() {}\n}\n\n#  else // CATCH_CONFIG_POSIX_SIGNALS is defined\n\n#include <signal.h>\n\nnamespace Catch {\n\n    struct SignalDefs {\n        int id;\n        const char* name;\n    };\n    static SignalDefs signalDefs[] = {\n        { SIGINT,  \"SIGINT - Terminal interrupt signal\" },\n        { SIGILL,  \"SIGILL - Illegal instruction signal\" },\n        { SIGFPE,  \"SIGFPE - Floating point error signal\" },\n        { SIGSEGV, \"SIGSEGV - Segmentation violation signal\" },\n        { SIGTERM, \"SIGTERM - Termination request signal\" },\n        { SIGABRT, \"SIGABRT - Abort (abnormal termination) signal\" }\n    };\n\n    void FatalConditionHandler::handleSignal( int sig ) {\n        char const * name = \"<unknown signal>\";\n        for (auto const& def : signalDefs) {\n            if (sig == def.id) {\n                name = def.name;\n                break;\n            }\n        }\n        reset();\n        reportFatal(name);\n        raise( sig );\n    }\n\n    FatalConditionHandler::FatalConditionHandler() {\n        isSet = true;\n        stack_t sigStack;\n        sigStack.ss_sp = altStackMem;\n        sigStack.ss_size = SIGSTKSZ;\n        sigStack.ss_flags = 0;\n        sigaltstack(&sigStack, &oldSigStack);\n        struct sigaction sa = { };\n\n        sa.sa_handler = handleSignal;\n        sa.sa_flags = SA_ONSTACK;\n        for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) {\n            sigaction(signalDefs[i].id, &sa, &oldSigActions[i]);\n        }\n    }\n\n    FatalConditionHandler::~FatalConditionHandler() {\n        reset();\n    }\n\n    void FatalConditionHandler::reset() {\n        if( isSet ) {\n            // Set signals back to previous values -- hopefully nobody overwrote them in the meantime\n            for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) {\n                sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);\n            }\n            // Return the old stack\n            sigaltstack(&oldSigStack, nullptr);\n            isSet = false;\n        }\n    }\n\n    bool FatalConditionHandler::isSet = false;\n    struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {};\n    stack_t FatalConditionHandler::oldSigStack = {};\n    char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};\n\n} // namespace Catch\n\n#  endif // CATCH_CONFIG_POSIX_SIGNALS\n\n#endif // not Windows\n\n#if defined(__GNUC__)\n#    pragma GCC diagnostic pop\n#endif\n// end catch_fatal_condition.cpp\n// start catch_interfaces_capture.cpp\n\nnamespace Catch {\n    IResultCapture::~IResultCapture() = default;\n}\n// end catch_interfaces_capture.cpp\n// start catch_interfaces_config.cpp\n\nnamespace Catch {\n    IConfig::~IConfig() = default;\n}\n// end catch_interfaces_config.cpp\n// start catch_interfaces_exception.cpp\n\nnamespace Catch {\n    IExceptionTranslator::~IExceptionTranslator() = default;\n    IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;\n}\n// end catch_interfaces_exception.cpp\n// start catch_interfaces_registry_hub.cpp\n\nnamespace Catch {\n    IRegistryHub::~IRegistryHub() = default;\n    IMutableRegistryHub::~IMutableRegistryHub() = default;\n}\n// end catch_interfaces_registry_hub.cpp\n// start catch_interfaces_reporter.cpp\n\n// start catch_reporter_multi.h\n\nnamespace Catch {\n\n    class MultipleReporters : public IStreamingReporter {\n        using Reporters = std::vector<IStreamingReporterPtr>;\n        Reporters m_reporters;\n\n    public:\n        void add( IStreamingReporterPtr&& reporter );\n\n    public: // IStreamingReporter\n\n        ReporterPreferences getPreferences() const override;\n\n        void noMatchingTestCases( std::string const& spec ) override;\n\n        static std::set<Verbosity> getSupportedVerbosities();\n\n        void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;\n        void benchmarkEnded( BenchmarkStats const& benchmarkStats ) override;\n\n        void testRunStarting( TestRunInfo const& testRunInfo ) override;\n        void testGroupStarting( GroupInfo const& groupInfo ) override;\n        void testCaseStarting( TestCaseInfo const& testInfo ) override;\n        void sectionStarting( SectionInfo const& sectionInfo ) override;\n        void assertionStarting( AssertionInfo const& assertionInfo ) override;\n\n        // The return value indicates if the messages buffer should be cleared:\n        bool assertionEnded( AssertionStats const& assertionStats ) override;\n        void sectionEnded( SectionStats const& sectionStats ) override;\n        void testCaseEnded( TestCaseStats const& testCaseStats ) override;\n        void testGroupEnded( TestGroupStats const& testGroupStats ) override;\n        void testRunEnded( TestRunStats const& testRunStats ) override;\n\n        void skipTest( TestCaseInfo const& testInfo ) override;\n        bool isMulti() const override;\n\n    };\n\n} // end namespace Catch\n\n// end catch_reporter_multi.h\nnamespace Catch {\n\n    ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig )\n    :   m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {}\n\n    ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream )\n    :   m_stream( &_stream ), m_fullConfig( _fullConfig ) {}\n\n    std::ostream& ReporterConfig::stream() const { return *m_stream; }\n    IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; }\n\n    TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {}\n\n    GroupInfo::GroupInfo(  std::string const& _name,\n                           std::size_t _groupIndex,\n                           std::size_t _groupsCount )\n    :   name( _name ),\n        groupIndex( _groupIndex ),\n        groupsCounts( _groupsCount )\n    {}\n\n     AssertionStats::AssertionStats( AssertionResult const& _assertionResult,\n                                     std::vector<MessageInfo> const& _infoMessages,\n                                     Totals const& _totals )\n    :   assertionResult( _assertionResult ),\n        infoMessages( _infoMessages ),\n        totals( _totals )\n    {\n        assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression;\n\n        if( assertionResult.hasMessage() ) {\n            // Copy message into messages list.\n            // !TBD This should have been done earlier, somewhere\n            MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );\n            builder << assertionResult.getMessage();\n            builder.m_info.message = builder.m_stream.str();\n\n            infoMessages.push_back( builder.m_info );\n        }\n    }\n\n     AssertionStats::~AssertionStats() = default;\n\n    SectionStats::SectionStats(  SectionInfo const& _sectionInfo,\n                                 Counts const& _assertions,\n                                 double _durationInSeconds,\n                                 bool _missingAssertions )\n    :   sectionInfo( _sectionInfo ),\n        assertions( _assertions ),\n        durationInSeconds( _durationInSeconds ),\n        missingAssertions( _missingAssertions )\n    {}\n\n    SectionStats::~SectionStats() = default;\n\n    TestCaseStats::TestCaseStats(  TestCaseInfo const& _testInfo,\n                                   Totals const& _totals,\n                                   std::string const& _stdOut,\n                                   std::string const& _stdErr,\n                                   bool _aborting )\n    : testInfo( _testInfo ),\n        totals( _totals ),\n        stdOut( _stdOut ),\n        stdErr( _stdErr ),\n        aborting( _aborting )\n    {}\n\n    TestCaseStats::~TestCaseStats() = default;\n\n    TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo,\n                                    Totals const& _totals,\n                                    bool _aborting )\n    :   groupInfo( _groupInfo ),\n        totals( _totals ),\n        aborting( _aborting )\n    {}\n\n    TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo )\n    :   groupInfo( _groupInfo ),\n        aborting( false )\n    {}\n\n    TestGroupStats::~TestGroupStats() = default;\n\n    TestRunStats::TestRunStats(   TestRunInfo const& _runInfo,\n                    Totals const& _totals,\n                    bool _aborting )\n    :   runInfo( _runInfo ),\n        totals( _totals ),\n        aborting( _aborting )\n    {}\n\n    TestRunStats::~TestRunStats() = default;\n\n    void IStreamingReporter::fatalErrorEncountered( StringRef ) {}\n    bool IStreamingReporter::isMulti() const { return false; }\n\n    IReporterFactory::~IReporterFactory() = default;\n    IReporterRegistry::~IReporterRegistry() = default;\n\n    void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter ) {\n\n        if( !existingReporter ) {\n            existingReporter = std::move( additionalReporter );\n            return;\n        }\n\n        MultipleReporters* multi = nullptr;\n\n        if( existingReporter->isMulti() ) {\n            multi = static_cast<MultipleReporters*>( existingReporter.get() );\n        }\n        else {\n            auto newMulti = std::unique_ptr<MultipleReporters>( new MultipleReporters );\n            newMulti->add( std::move( existingReporter ) );\n            multi = newMulti.get();\n            existingReporter = std::move( newMulti );\n        }\n        multi->add( std::move( additionalReporter ) );\n    }\n\n} // end namespace Catch\n// end catch_interfaces_reporter.cpp\n// start catch_interfaces_runner.cpp\n\nnamespace Catch {\n    IRunner::~IRunner() = default;\n}\n// end catch_interfaces_runner.cpp\n// start catch_interfaces_testcase.cpp\n\nnamespace Catch {\n    ITestInvoker::~ITestInvoker() = default;\n    ITestCaseRegistry::~ITestCaseRegistry() = default;\n}\n// end catch_interfaces_testcase.cpp\n// start catch_leak_detector.cpp\n\n#ifdef CATCH_CONFIG_WINDOWS_CRTDBG\n#include <crtdbg.h>\n\nnamespace Catch {\n\n\tLeakDetector::LeakDetector() {\n\t\tint flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);\n\t\tflag |= _CRTDBG_LEAK_CHECK_DF;\n\t\tflag |= _CRTDBG_ALLOC_MEM_DF;\n\t\t_CrtSetDbgFlag(flag);\n\t\t_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);\n\t\t_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);\n\t\t// Change this to leaking allocation's number to break there\n\t\t_CrtSetBreakAlloc(-1);\n\t}\n}\n\n#else\n\n    Catch::LeakDetector::LeakDetector() {}\n\n#endif\n// end catch_leak_detector.cpp\n// start catch_list.cpp\n\n// start catch_list.h\n\n#include <set>\n\nnamespace Catch {\n\n    std::size_t listTests( Config const& config );\n\n    std::size_t listTestsNamesOnly( Config const& config );\n\n    struct TagInfo {\n        void add( std::string const& spelling );\n        std::string all() const;\n\n        std::set<std::string> spellings;\n        std::size_t count = 0;\n    };\n\n    std::size_t listTags( Config const& config );\n\n    std::size_t listReporters( Config const& /*config*/ );\n\n    Option<std::size_t> list( Config const& config );\n\n} // end namespace Catch\n\n// end catch_list.h\n// start catch_text.h\n\nnamespace Catch {\n    using namespace clara::TextFlow;\n}\n\n// end catch_text.h\n#include <limits>\n#include <algorithm>\n#include <iomanip>\n\nnamespace Catch {\n\n    std::size_t listTests( Config const& config ) {\n        TestSpec testSpec = config.testSpec();\n        if( config.testSpec().hasFilters() )\n            Catch::cout() << \"Matching test cases:\\n\";\n        else {\n            Catch::cout() << \"All available test cases:\\n\";\n            testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( \"*\" ).testSpec();\n        }\n\n        auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );\n        for( auto const& testCaseInfo : matchedTestCases ) {\n            Colour::Code colour = testCaseInfo.isHidden()\n                ? Colour::SecondaryText\n                : Colour::None;\n            Colour colourGuard( colour );\n\n            Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << \"\\n\";\n            if( config.verbosity() >= Verbosity::High ) {\n                Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl;\n                std::string description = testCaseInfo.description;\n                if( description.empty() )\n                    description = \"(NO DESCRIPTION)\";\n                Catch::cout() << Column( description ).indent(4) << std::endl;\n            }\n            if( !testCaseInfo.tags.empty() )\n                Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << \"\\n\";\n        }\n\n        if( !config.testSpec().hasFilters() )\n            Catch::cout() << pluralise( matchedTestCases.size(), \"test case\" ) << '\\n' << std::endl;\n        else\n            Catch::cout() << pluralise( matchedTestCases.size(), \"matching test case\" ) << '\\n' << std::endl;\n        return matchedTestCases.size();\n    }\n\n    std::size_t listTestsNamesOnly( Config const& config ) {\n        TestSpec testSpec = config.testSpec();\n        if( !config.testSpec().hasFilters() )\n            testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( \"*\" ).testSpec();\n        std::size_t matchedTests = 0;\n        std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );\n        for( auto const& testCaseInfo : matchedTestCases ) {\n            matchedTests++;\n            if( startsWith( testCaseInfo.name, '#' ) )\n               Catch::cout() << '\"' << testCaseInfo.name << '\"';\n            else\n               Catch::cout() << testCaseInfo.name;\n            if ( config.verbosity() >= Verbosity::High )\n                Catch::cout() << \"\\t@\" << testCaseInfo.lineInfo;\n            Catch::cout() << std::endl;\n        }\n        return matchedTests;\n    }\n\n    void TagInfo::add( std::string const& spelling ) {\n        ++count;\n        spellings.insert( spelling );\n    }\n\n    std::string TagInfo::all() const {\n        std::string out;\n        for( auto const& spelling : spellings )\n            out += \"[\" + spelling + \"]\";\n        return out;\n    }\n\n    std::size_t listTags( Config const& config ) {\n        TestSpec testSpec = config.testSpec();\n        if( config.testSpec().hasFilters() )\n            Catch::cout() << \"Tags for matching test cases:\\n\";\n        else {\n            Catch::cout() << \"All available tags:\\n\";\n            testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( \"*\" ).testSpec();\n        }\n\n        std::map<std::string, TagInfo> tagCounts;\n\n        std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );\n        for( auto const& testCase : matchedTestCases ) {\n            for( auto const& tagName : testCase.getTestCaseInfo().tags ) {\n                std::string lcaseTagName = toLower( tagName );\n                auto countIt = tagCounts.find( lcaseTagName );\n                if( countIt == tagCounts.end() )\n                    countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first;\n                countIt->second.add( tagName );\n            }\n        }\n\n        for( auto const& tagCount : tagCounts ) {\n            ReusableStringStream rss;\n            rss << \"  \" << std::setw(2) << tagCount.second.count << \"  \";\n            auto str = rss.str();\n            auto wrapper = Column( tagCount.second.all() )\n                                                    .initialIndent( 0 )\n                                                    .indent( str.size() )\n                                                    .width( CATCH_CONFIG_CONSOLE_WIDTH-10 );\n            Catch::cout() << str << wrapper << '\\n';\n        }\n        Catch::cout() << pluralise( tagCounts.size(), \"tag\" ) << '\\n' << std::endl;\n        return tagCounts.size();\n    }\n\n    std::size_t listReporters( Config const& /*config*/ ) {\n        Catch::cout() << \"Available reporters:\\n\";\n        IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();\n        std::size_t maxNameLen = 0;\n        for( auto const& factoryKvp : factories )\n            maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );\n\n        for( auto const& factoryKvp : factories ) {\n            Catch::cout()\n                    << Column( factoryKvp.first + \":\" )\n                            .indent(2)\n                            .width( 5+maxNameLen )\n                    +  Column( factoryKvp.second->getDescription() )\n                            .initialIndent(0)\n                            .indent(2)\n                            .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 )\n                    << \"\\n\";\n        }\n        Catch::cout() << std::endl;\n        return factories.size();\n    }\n\n    Option<std::size_t> list( Config const& config ) {\n        Option<std::size_t> listedCount;\n        if( config.listTests() )\n            listedCount = listedCount.valueOr(0) + listTests( config );\n        if( config.listTestNamesOnly() )\n            listedCount = listedCount.valueOr(0) + listTestsNamesOnly( config );\n        if( config.listTags() )\n            listedCount = listedCount.valueOr(0) + listTags( config );\n        if( config.listReporters() )\n            listedCount = listedCount.valueOr(0) + listReporters( config );\n        return listedCount;\n    }\n\n} // end namespace Catch\n// end catch_list.cpp\n// start catch_matchers.cpp\n\nnamespace Catch {\nnamespace Matchers {\n    namespace Impl {\n\n        std::string MatcherUntypedBase::toString() const {\n            if( m_cachedToString.empty() )\n                m_cachedToString = describe();\n            return m_cachedToString;\n        }\n\n        MatcherUntypedBase::~MatcherUntypedBase() = default;\n\n    } // namespace Impl\n} // namespace Matchers\n\nusing namespace Matchers;\nusing Matchers::Impl::MatcherBase;\n\n} // namespace Catch\n// end catch_matchers.cpp\n// start catch_matchers_floating.cpp\n\n#include <cstdlib>\n#include <cstdint>\n#include <cstring>\n#include <stdexcept>\n\nnamespace Catch {\nnamespace Matchers {\nnamespace Floating {\nenum class FloatingPointKind : uint8_t {\n    Float,\n    Double\n};\n}\n}\n}\n\nnamespace {\n\ntemplate <typename T>\nstruct Converter;\n\ntemplate <>\nstruct Converter<float> {\n    static_assert(sizeof(float) == sizeof(int32_t), \"Important ULP matcher assumption violated\");\n    Converter(float f) {\n        std::memcpy(&i, &f, sizeof(f));\n    }\n    int32_t i;\n};\n\ntemplate <>\nstruct Converter<double> {\n    static_assert(sizeof(double) == sizeof(int64_t), \"Important ULP matcher assumption violated\");\n    Converter(double d) {\n        std::memcpy(&i, &d, sizeof(d));\n    }\n    int64_t i;\n};\n\ntemplate <typename T>\nauto convert(T t) -> Converter<T> {\n    return Converter<T>(t);\n}\n\ntemplate <typename FP>\nbool almostEqualUlps(FP lhs, FP rhs, int maxUlpDiff) {\n    // Comparison with NaN should always be false.\n    // This way we can rule it out before getting into the ugly details\n    if (std::isnan(lhs) || std::isnan(rhs)) {\n        return false;\n    }\n\n    auto lc = convert(lhs);\n    auto rc = convert(rhs);\n\n    if ((lc.i < 0) != (rc.i < 0)) {\n        // Potentially we can have +0 and -0\n        return lhs == rhs;\n    }\n\n    auto ulpDiff = std::abs(lc.i - rc.i);\n    return ulpDiff <= maxUlpDiff;\n}\n\n}\n\nnamespace Catch {\nnamespace Matchers {\nnamespace Floating {\n    WithinAbsMatcher::WithinAbsMatcher(double target, double margin)\n        :m_target{ target }, m_margin{ margin } {\n        if (m_margin < 0) {\n            throw std::domain_error(\"Allowed margin difference has to be >= 0\");\n        }\n    }\n\n    // Performs equivalent check of std::fabs(lhs - rhs) <= margin\n    // But without the subtraction to allow for INFINITY in comparison\n    bool WithinAbsMatcher::match(double const& matchee) const {\n        return (matchee + m_margin >= m_target) && (m_target + m_margin >= m_margin);\n    }\n\n    std::string WithinAbsMatcher::describe() const {\n        return \"is within \" + ::Catch::Detail::stringify(m_margin) + \" of \" + ::Catch::Detail::stringify(m_target);\n    }\n\n    WithinUlpsMatcher::WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType)\n        :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } {\n        if (m_ulps < 0) {\n            throw std::domain_error(\"Allowed ulp difference has to be >= 0\");\n        }\n    }\n\n    bool WithinUlpsMatcher::match(double const& matchee) const {\n        switch (m_type) {\n        case FloatingPointKind::Float:\n            return almostEqualUlps<float>(static_cast<float>(matchee), static_cast<float>(m_target), m_ulps);\n        case FloatingPointKind::Double:\n            return almostEqualUlps<double>(matchee, m_target, m_ulps);\n        default:\n            throw std::domain_error(\"Unknown FloatingPointKind value\");\n        }\n    }\n\n    std::string WithinUlpsMatcher::describe() const {\n        return \"is within \" + std::to_string(m_ulps) + \" ULPs of \" + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? \"f\" : \"\");\n    }\n\n}// namespace Floating\n\nFloating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff) {\n    return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Double);\n}\n\nFloating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff) {\n    return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Float);\n}\n\nFloating::WithinAbsMatcher WithinAbs(double target, double margin) {\n    return Floating::WithinAbsMatcher(target, margin);\n}\n\n} // namespace Matchers\n} // namespace Catch\n\n// end catch_matchers_floating.cpp\n// start catch_matchers_string.cpp\n\n#include <regex>\n\nnamespace Catch {\nnamespace Matchers {\n\n    namespace StdString {\n\n        CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity )\n        :   m_caseSensitivity( caseSensitivity ),\n            m_str( adjustString( str ) )\n        {}\n        std::string CasedString::adjustString( std::string const& str ) const {\n            return m_caseSensitivity == CaseSensitive::No\n                   ? toLower( str )\n                   : str;\n        }\n        std::string CasedString::caseSensitivitySuffix() const {\n            return m_caseSensitivity == CaseSensitive::No\n                   ? \" (case insensitive)\"\n                   : std::string();\n        }\n\n        StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator )\n        : m_comparator( comparator ),\n          m_operation( operation ) {\n        }\n\n        std::string StringMatcherBase::describe() const {\n            std::string description;\n            description.reserve(5 + m_operation.size() + m_comparator.m_str.size() +\n                                        m_comparator.caseSensitivitySuffix().size());\n            description += m_operation;\n            description += \": \\\"\";\n            description += m_comparator.m_str;\n            description += \"\\\"\";\n            description += m_comparator.caseSensitivitySuffix();\n            return description;\n        }\n\n        EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( \"equals\", comparator ) {}\n\n        bool EqualsMatcher::match( std::string const& source ) const {\n            return m_comparator.adjustString( source ) == m_comparator.m_str;\n        }\n\n        ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( \"contains\", comparator ) {}\n\n        bool ContainsMatcher::match( std::string const& source ) const {\n            return contains( m_comparator.adjustString( source ), m_comparator.m_str );\n        }\n\n        StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( \"starts with\", comparator ) {}\n\n        bool StartsWithMatcher::match( std::string const& source ) const {\n            return startsWith( m_comparator.adjustString( source ), m_comparator.m_str );\n        }\n\n        EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( \"ends with\", comparator ) {}\n\n        bool EndsWithMatcher::match( std::string const& source ) const {\n            return endsWith( m_comparator.adjustString( source ), m_comparator.m_str );\n        }\n\n        RegexMatcher::RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {}\n\n        bool RegexMatcher::match(std::string const& matchee) const {\n            auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway\n            if (m_caseSensitivity == CaseSensitive::Choice::No) {\n                flags |= std::regex::icase;\n            }\n            auto reg = std::regex(m_regex, flags);\n            return std::regex_match(matchee, reg);\n        }\n\n        std::string RegexMatcher::describe() const {\n            return \"matches \" + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)? \" case sensitively\" : \" case insensitively\");\n        }\n\n    } // namespace StdString\n\n    StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) {\n        return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) );\n    }\n    StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) {\n        return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) );\n    }\n    StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) {\n        return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) );\n    }\n    StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) {\n        return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) );\n    }\n\n    StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice caseSensitivity) {\n        return StdString::RegexMatcher(regex, caseSensitivity);\n    }\n\n} // namespace Matchers\n} // namespace Catch\n// end catch_matchers_string.cpp\n// start catch_message.cpp\n\nnamespace Catch {\n\n    MessageInfo::MessageInfo(   std::string const& _macroName,\n                                SourceLineInfo const& _lineInfo,\n                                ResultWas::OfType _type )\n    :   macroName( _macroName ),\n        lineInfo( _lineInfo ),\n        type( _type ),\n        sequence( ++globalCount )\n    {}\n\n    bool MessageInfo::operator==( MessageInfo const& other ) const {\n        return sequence == other.sequence;\n    }\n\n    bool MessageInfo::operator<( MessageInfo const& other ) const {\n        return sequence < other.sequence;\n    }\n\n    // This may need protecting if threading support is added\n    unsigned int MessageInfo::globalCount = 0;\n\n    ////////////////////////////////////////////////////////////////////////////\n\n    Catch::MessageBuilder::MessageBuilder( std::string const& macroName,\n                                           SourceLineInfo const& lineInfo,\n                                           ResultWas::OfType type )\n        :m_info(macroName, lineInfo, type) {}\n\n    ////////////////////////////////////////////////////////////////////////////\n\n    ScopedMessage::ScopedMessage( MessageBuilder const& builder )\n    : m_info( builder.m_info )\n    {\n        m_info.message = builder.m_stream.str();\n        getResultCapture().pushScopedMessage( m_info );\n    }\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4996) // std::uncaught_exception is deprecated in C++17\n#endif\n    ScopedMessage::~ScopedMessage() {\n        if ( !std::uncaught_exception() ){\n            getResultCapture().popScopedMessage(m_info);\n        }\n    }\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n\n} // end namespace Catch\n// end catch_message.cpp\n// start catch_random_number_generator.cpp\n\n// start catch_random_number_generator.h\n\n#include <algorithm>\n\nnamespace Catch {\n\n    struct IConfig;\n\n    void seedRng( IConfig const& config );\n\n    unsigned int rngSeed();\n\n    struct RandomNumberGenerator {\n        using result_type = unsigned int;\n\n        static constexpr result_type (min)() { return 0; }\n        static constexpr result_type (max)() { return 1000000; }\n\n        result_type operator()( result_type n ) const;\n        result_type operator()() const;\n\n        template<typename V>\n        static void shuffle( V& vector ) {\n            RandomNumberGenerator rng;\n            std::shuffle( vector.begin(), vector.end(), rng );\n        }\n    };\n\n}\n\n// end catch_random_number_generator.h\n#include <cstdlib>\n\nnamespace Catch {\n\n    void seedRng( IConfig const& config ) {\n        if( config.rngSeed() != 0 )\n            std::srand( config.rngSeed() );\n    }\n    unsigned int rngSeed() {\n        return getCurrentContext().getConfig()->rngSeed();\n    }\n\n    RandomNumberGenerator::result_type RandomNumberGenerator::operator()( result_type n ) const {\n        return std::rand() % n;\n    }\n    RandomNumberGenerator::result_type RandomNumberGenerator::operator()() const {\n        return std::rand() % (max)();\n    }\n\n}\n// end catch_random_number_generator.cpp\n// start catch_registry_hub.cpp\n\n// start catch_test_case_registry_impl.h\n\n#include <vector>\n#include <set>\n#include <algorithm>\n#include <ios>\n\nnamespace Catch {\n\n    class TestCase;\n    struct IConfig;\n\n    std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases );\n    bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );\n\n    void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions );\n\n    std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );\n    std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );\n\n    class TestRegistry : public ITestCaseRegistry {\n    public:\n        virtual ~TestRegistry() = default;\n\n        virtual void registerTest( TestCase const& testCase );\n\n        std::vector<TestCase> const& getAllTests() const override;\n        std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const override;\n\n    private:\n        std::vector<TestCase> m_functions;\n        mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder;\n        mutable std::vector<TestCase> m_sortedFunctions;\n        std::size_t m_unnamedCount = 0;\n        std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised\n    };\n\n    ///////////////////////////////////////////////////////////////////////////\n\n    class TestInvokerAsFunction : public ITestInvoker {\n        void(*m_testAsFunction)();\n    public:\n        TestInvokerAsFunction( void(*testAsFunction)() ) noexcept;\n\n        void invoke() const override;\n    };\n\n    std::string extractClassName( std::string const& classOrQualifiedMethodName );\n\n    ///////////////////////////////////////////////////////////////////////////\n\n} // end namespace Catch\n\n// end catch_test_case_registry_impl.h\n// start catch_reporter_registry.h\n\n#include <map>\n\nnamespace Catch {\n\n    class ReporterRegistry : public IReporterRegistry {\n\n    public:\n\n        ~ReporterRegistry() override;\n\n        IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override;\n\n        void registerReporter( std::string const& name, IReporterFactoryPtr const& factory );\n        void registerListener( IReporterFactoryPtr const& factory );\n\n        FactoryMap const& getFactories() const override;\n        Listeners const& getListeners() const override;\n\n    private:\n        FactoryMap m_factories;\n        Listeners m_listeners;\n    };\n}\n\n// end catch_reporter_registry.h\n// start catch_tag_alias_registry.h\n\n// start catch_tag_alias.h\n\n#include <string>\n\nnamespace Catch {\n\n    struct TagAlias {\n        TagAlias(std::string const& _tag, SourceLineInfo _lineInfo);\n\n        std::string tag;\n        SourceLineInfo lineInfo;\n    };\n\n} // end namespace Catch\n\n// end catch_tag_alias.h\n#include <map>\n\nnamespace Catch {\n\n    class TagAliasRegistry : public ITagAliasRegistry {\n    public:\n        ~TagAliasRegistry() override;\n        TagAlias const* find( std::string const& alias ) const override;\n        std::string expandAliases( std::string const& unexpandedTestSpec ) const override;\n        void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo );\n\n    private:\n        std::map<std::string, TagAlias> m_registry;\n    };\n\n} // end namespace Catch\n\n// end catch_tag_alias_registry.h\n// start catch_startup_exception_registry.h\n\n#include <vector>\n#include <exception>\n\nnamespace Catch {\n\n    class StartupExceptionRegistry {\n    public:\n        void add(std::exception_ptr const& exception) noexcept;\n        std::vector<std::exception_ptr> const& getExceptions() const noexcept;\n    private:\n        std::vector<std::exception_ptr> m_exceptions;\n    };\n\n} // end namespace Catch\n\n// end catch_startup_exception_registry.h\nnamespace Catch {\n\n    namespace {\n\n        class RegistryHub : public IRegistryHub, public IMutableRegistryHub,\n                            private NonCopyable {\n\n        public: // IRegistryHub\n            RegistryHub() = default;\n            IReporterRegistry const& getReporterRegistry() const override {\n                return m_reporterRegistry;\n            }\n            ITestCaseRegistry const& getTestCaseRegistry() const override {\n                return m_testCaseRegistry;\n            }\n            IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() override {\n                return m_exceptionTranslatorRegistry;\n            }\n            ITagAliasRegistry const& getTagAliasRegistry() const override {\n                return m_tagAliasRegistry;\n            }\n            StartupExceptionRegistry const& getStartupExceptionRegistry() const override {\n                return m_exceptionRegistry;\n            }\n\n        public: // IMutableRegistryHub\n            void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override {\n                m_reporterRegistry.registerReporter( name, factory );\n            }\n            void registerListener( IReporterFactoryPtr const& factory ) override {\n                m_reporterRegistry.registerListener( factory );\n            }\n            void registerTest( TestCase const& testInfo ) override {\n                m_testCaseRegistry.registerTest( testInfo );\n            }\n            void registerTranslator( const IExceptionTranslator* translator ) override {\n                m_exceptionTranslatorRegistry.registerTranslator( translator );\n            }\n            void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {\n                m_tagAliasRegistry.add( alias, tag, lineInfo );\n            }\n            void registerStartupException() noexcept override {\n                m_exceptionRegistry.add(std::current_exception());\n            }\n\n        private:\n            TestRegistry m_testCaseRegistry;\n            ReporterRegistry m_reporterRegistry;\n            ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;\n            TagAliasRegistry m_tagAliasRegistry;\n            StartupExceptionRegistry m_exceptionRegistry;\n        };\n\n        // Single, global, instance\n        RegistryHub*& getTheRegistryHub() {\n            static RegistryHub* theRegistryHub = nullptr;\n            if( !theRegistryHub )\n                theRegistryHub = new RegistryHub();\n            return theRegistryHub;\n        }\n    }\n\n    IRegistryHub& getRegistryHub() {\n        return *getTheRegistryHub();\n    }\n    IMutableRegistryHub& getMutableRegistryHub() {\n        return *getTheRegistryHub();\n    }\n    void cleanUp() {\n        delete getTheRegistryHub();\n        getTheRegistryHub() = nullptr;\n        cleanUpContext();\n        ReusableStringStream::cleanup();\n    }\n    std::string translateActiveException() {\n        return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException();\n    }\n\n} // end namespace Catch\n// end catch_registry_hub.cpp\n// start catch_reporter_registry.cpp\n\nnamespace Catch {\n\n    ReporterRegistry::~ReporterRegistry() = default;\n\n    IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const {\n        auto it =  m_factories.find( name );\n        if( it == m_factories.end() )\n            return nullptr;\n        return it->second->create( ReporterConfig( config ) );\n    }\n\n    void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {\n        m_factories.emplace(name, factory);\n    }\n    void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) {\n        m_listeners.push_back( factory );\n    }\n\n    IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const {\n        return m_factories;\n    }\n    IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const {\n        return m_listeners;\n    }\n\n}\n// end catch_reporter_registry.cpp\n// start catch_result_type.cpp\n\nnamespace Catch {\n\n    bool isOk( ResultWas::OfType resultType ) {\n        return ( resultType & ResultWas::FailureBit ) == 0;\n    }\n    bool isJustInfo( int flags ) {\n        return flags == ResultWas::Info;\n    }\n\n    ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) {\n        return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) | static_cast<int>( rhs ) );\n    }\n\n    bool shouldContinueOnFailure( int flags )    { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; }\n    bool shouldSuppressFailure( int flags )      { return ( flags & ResultDisposition::SuppressFail ) != 0; }\n\n} // end namespace Catch\n// end catch_result_type.cpp\n// start catch_run_context.cpp\n\n#include <cassert>\n#include <algorithm>\n#include <sstream>\n\nnamespace Catch {\n\n    class RedirectedStream {\n        std::ostream& m_originalStream;\n        std::ostream& m_redirectionStream;\n        std::streambuf* m_prevBuf;\n\n    public:\n        RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream )\n        :   m_originalStream( originalStream ),\n            m_redirectionStream( redirectionStream ),\n            m_prevBuf( m_originalStream.rdbuf() )\n        {\n            m_originalStream.rdbuf( m_redirectionStream.rdbuf() );\n        }\n        ~RedirectedStream() {\n            m_originalStream.rdbuf( m_prevBuf );\n        }\n    };\n\n    class RedirectedStdOut {\n        ReusableStringStream m_rss;\n        RedirectedStream m_cout;\n    public:\n        RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {}\n        auto str() const -> std::string { return m_rss.str(); }\n    };\n\n    // StdErr has two constituent streams in C++, std::cerr and std::clog\n    // This means that we need to redirect 2 streams into 1 to keep proper\n    // order of writes\n    class RedirectedStdErr {\n        ReusableStringStream m_rss;\n        RedirectedStream m_cerr;\n        RedirectedStream m_clog;\n    public:\n        RedirectedStdErr()\n        :   m_cerr( Catch::cerr(), m_rss.get() ),\n            m_clog( Catch::clog(), m_rss.get() )\n        {}\n        auto str() const -> std::string { return m_rss.str(); }\n    };\n\n    RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter)\n    :   m_runInfo(_config->name()),\n        m_context(getCurrentMutableContext()),\n        m_config(_config),\n        m_reporter(std::move(reporter)),\n        m_lastAssertionInfo{ \"\", SourceLineInfo(\"\",0), \"\", ResultDisposition::Normal },\n        m_includeSuccessfulResults( m_config->includeSuccessfulResults() )\n    {\n        m_context.setRunner(this);\n        m_context.setConfig(m_config);\n        m_context.setResultCapture(this);\n        m_reporter->testRunStarting(m_runInfo);\n    }\n\n    RunContext::~RunContext() {\n        m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting()));\n    }\n\n    void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) {\n        m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount));\n    }\n\n    void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) {\n        m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting()));\n    }\n\n    Totals RunContext::runTest(TestCase const& testCase) {\n        Totals prevTotals = m_totals;\n\n        std::string redirectedCout;\n        std::string redirectedCerr;\n\n        TestCaseInfo testInfo = testCase.getTestCaseInfo();\n\n        m_reporter->testCaseStarting(testInfo);\n\n        m_activeTestCase = &testCase;\n\n        ITracker& rootTracker = m_trackerContext.startRun();\n        assert(rootTracker.isSectionTracker());\n        static_cast<SectionTracker&>(rootTracker).addInitialFilters(m_config->getSectionsToRun());\n        do {\n            m_trackerContext.startCycle();\n            m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo));\n            runCurrentTest(redirectedCout, redirectedCerr);\n        } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting());\n\n        Totals deltaTotals = m_totals.delta(prevTotals);\n        if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) {\n            deltaTotals.assertions.failed++;\n            deltaTotals.testCases.passed--;\n            deltaTotals.testCases.failed++;\n        }\n        m_totals.testCases += deltaTotals.testCases;\n        m_reporter->testCaseEnded(TestCaseStats(testInfo,\n                                  deltaTotals,\n                                  redirectedCout,\n                                  redirectedCerr,\n                                  aborting()));\n\n        m_activeTestCase = nullptr;\n        m_testCaseTracker = nullptr;\n\n        return deltaTotals;\n    }\n\n    IConfigPtr RunContext::config() const {\n        return m_config;\n    }\n\n    IStreamingReporter& RunContext::reporter() const {\n        return *m_reporter;\n    }\n\n    void RunContext::assertionEnded(AssertionResult const & result) {\n        if (result.getResultType() == ResultWas::Ok) {\n            m_totals.assertions.passed++;\n            m_lastAssertionPassed = true;\n        } else if (!result.isOk()) {\n            m_lastAssertionPassed = false;\n            if( m_activeTestCase->getTestCaseInfo().okToFail() )\n                m_totals.assertions.failedButOk++;\n            else\n                m_totals.assertions.failed++;\n        }\n        else {\n            m_lastAssertionPassed = true;\n        }\n\n        // We have no use for the return value (whether messages should be cleared), because messages were made scoped\n        // and should be let to clear themselves out.\n        static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)));\n\n        // Reset working state\n        resetAssertionInfo();\n        m_lastResult = result;\n    }\n    void RunContext::resetAssertionInfo() {\n        m_lastAssertionInfo.macroName = StringRef();\n        m_lastAssertionInfo.capturedExpression = \"{Unknown expression after the reported line}\"_sr;\n    }\n\n    bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) {\n        ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo));\n        if (!sectionTracker.isOpen())\n            return false;\n        m_activeSections.push_back(&sectionTracker);\n\n        m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo;\n\n        m_reporter->sectionStarting(sectionInfo);\n\n        assertions = m_totals.assertions;\n\n        return true;\n    }\n\n    bool RunContext::testForMissingAssertions(Counts& assertions) {\n        if (assertions.total() != 0)\n            return false;\n        if (!m_config->warnAboutMissingAssertions())\n            return false;\n        if (m_trackerContext.currentTracker().hasChildren())\n            return false;\n        m_totals.assertions.failed++;\n        assertions.failed++;\n        return true;\n    }\n\n    void RunContext::sectionEnded(SectionEndInfo const & endInfo) {\n        Counts assertions = m_totals.assertions - endInfo.prevAssertions;\n        bool missingAssertions = testForMissingAssertions(assertions);\n\n        if (!m_activeSections.empty()) {\n            m_activeSections.back()->close();\n            m_activeSections.pop_back();\n        }\n\n        m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions));\n        m_messages.clear();\n    }\n\n    void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) {\n        if (m_unfinishedSections.empty())\n            m_activeSections.back()->fail();\n        else\n            m_activeSections.back()->close();\n        m_activeSections.pop_back();\n\n        m_unfinishedSections.push_back(endInfo);\n    }\n    void RunContext::benchmarkStarting( BenchmarkInfo const& info ) {\n        m_reporter->benchmarkStarting( info );\n    }\n    void RunContext::benchmarkEnded( BenchmarkStats const& stats ) {\n        m_reporter->benchmarkEnded( stats );\n    }\n\n    void RunContext::pushScopedMessage(MessageInfo const & message) {\n        m_messages.push_back(message);\n    }\n\n    void RunContext::popScopedMessage(MessageInfo const & message) {\n        m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end());\n    }\n\n    std::string RunContext::getCurrentTestName() const {\n        return m_activeTestCase\n            ? m_activeTestCase->getTestCaseInfo().name\n            : std::string();\n    }\n\n    const AssertionResult * RunContext::getLastResult() const {\n        return &(*m_lastResult);\n    }\n\n    void RunContext::exceptionEarlyReported() {\n        m_shouldReportUnexpected = false;\n    }\n\n    void RunContext::handleFatalErrorCondition( StringRef message ) {\n        // First notify reporter that bad things happened\n        m_reporter->fatalErrorEncountered(message);\n\n        // Don't rebuild the result -- the stringification itself can cause more fatal errors\n        // Instead, fake a result data.\n        AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } );\n        tempResult.message = message;\n        AssertionResult result(m_lastAssertionInfo, tempResult);\n\n        assertionEnded(result);\n\n        handleUnfinishedSections();\n\n        // Recreate section for test case (as we will lose the one that was in scope)\n        auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();\n        SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);\n\n        Counts assertions;\n        assertions.failed = 1;\n        SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false);\n        m_reporter->sectionEnded(testCaseSectionStats);\n\n        auto const& testInfo = m_activeTestCase->getTestCaseInfo();\n\n        Totals deltaTotals;\n        deltaTotals.testCases.failed = 1;\n        deltaTotals.assertions.failed = 1;\n        m_reporter->testCaseEnded(TestCaseStats(testInfo,\n                                  deltaTotals,\n                                  std::string(),\n                                  std::string(),\n                                  false));\n        m_totals.testCases.failed++;\n        testGroupEnded(std::string(), m_totals, 1, 1);\n        m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false));\n    }\n\n    bool RunContext::lastAssertionPassed() {\n         return m_lastAssertionPassed;\n    }\n\n    void RunContext::assertionPassed() {\n        m_lastAssertionPassed = true;\n        ++m_totals.assertions.passed;\n        resetAssertionInfo();\n    }\n\n    bool RunContext::aborting() const {\n        return m_totals.assertions.failed == static_cast<std::size_t>(m_config->abortAfter());\n    }\n\n    void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) {\n        auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();\n        SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description);\n        m_reporter->sectionStarting(testCaseSection);\n        Counts prevAssertions = m_totals.assertions;\n        double duration = 0;\n        m_shouldReportUnexpected = true;\n        m_lastAssertionInfo = { \"TEST_CASE\", testCaseInfo.lineInfo, \"\", ResultDisposition::Normal };\n\n        seedRng(*m_config);\n\n        Timer timer;\n        try {\n            if (m_reporter->getPreferences().shouldRedirectStdOut) {\n                RedirectedStdOut redirectedStdOut;\n                RedirectedStdErr redirectedStdErr;\n                timer.start();\n                invokeActiveTestCase();\n                redirectedCout += redirectedStdOut.str();\n                redirectedCerr += redirectedStdErr.str();\n\n            } else {\n                timer.start();\n                invokeActiveTestCase();\n            }\n            duration = timer.getElapsedSeconds();\n        } catch (TestFailureException&) {\n            // This just means the test was aborted due to failure\n        } catch (...) {\n            // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions\n            // are reported without translation at the point of origin.\n            if( m_shouldReportUnexpected ) {\n                AssertionReaction dummyReaction;\n                handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction );\n            }\n        }\n        m_testCaseTracker->close();\n        handleUnfinishedSections();\n        m_messages.clear();\n\n        Counts assertions = m_totals.assertions - prevAssertions;\n        bool missingAssertions = testForMissingAssertions(assertions);\n        SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions);\n        m_reporter->sectionEnded(testCaseSectionStats);\n    }\n\n    void RunContext::invokeActiveTestCase() {\n        FatalConditionHandler fatalConditionHandler; // Handle signals\n        m_activeTestCase->invoke();\n        fatalConditionHandler.reset();\n    }\n\n    void RunContext::handleUnfinishedSections() {\n        // If sections ended prematurely due to an exception we stored their\n        // infos here so we can tear them down outside the unwind process.\n        for (auto it = m_unfinishedSections.rbegin(),\n             itEnd = m_unfinishedSections.rend();\n             it != itEnd;\n             ++it)\n            sectionEnded(*it);\n        m_unfinishedSections.clear();\n    }\n\n    void RunContext::handleExpr(\n        AssertionInfo const& info,\n        ITransientExpression const& expr,\n        AssertionReaction& reaction\n    ) {\n        m_reporter->assertionStarting( info );\n\n        bool negated = isFalseTest( info.resultDisposition );\n        bool result = expr.getResult() != negated;\n\n        if( result ) {\n            if (!m_includeSuccessfulResults) {\n                assertionPassed();\n            }\n            else {\n                reportExpr(info, ResultWas::Ok, &expr, negated);\n            }\n        }\n        else {\n            reportExpr(info, ResultWas::ExpressionFailed, &expr, negated );\n            populateReaction( reaction );\n        }\n    }\n    void RunContext::reportExpr(\n            AssertionInfo const &info,\n            ResultWas::OfType resultType,\n            ITransientExpression const *expr,\n            bool negated ) {\n\n        m_lastAssertionInfo = info;\n        AssertionResultData data( resultType, LazyExpression( negated ) );\n\n        AssertionResult assertionResult{ info, data };\n        assertionResult.m_resultData.lazyExpression.m_transientExpression = expr;\n\n        assertionEnded( assertionResult );\n    }\n\n    void RunContext::handleMessage(\n            AssertionInfo const& info,\n            ResultWas::OfType resultType,\n            StringRef const& message,\n            AssertionReaction& reaction\n    ) {\n        m_reporter->assertionStarting( info );\n\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( resultType, LazyExpression( false ) );\n        data.message = message;\n        AssertionResult assertionResult{ m_lastAssertionInfo, data };\n        assertionEnded( assertionResult );\n        if( !assertionResult.isOk() )\n            populateReaction( reaction );\n    }\n    void RunContext::handleUnexpectedExceptionNotThrown(\n            AssertionInfo const& info,\n            AssertionReaction& reaction\n    ) {\n        handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction);\n    }\n\n    void RunContext::handleUnexpectedInflightException(\n            AssertionInfo const& info,\n            std::string const& message,\n            AssertionReaction& reaction\n    ) {\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );\n        data.message = message;\n        AssertionResult assertionResult{ info, data };\n        assertionEnded( assertionResult );\n        populateReaction( reaction );\n    }\n\n    void RunContext::populateReaction( AssertionReaction& reaction ) {\n        reaction.shouldDebugBreak = m_config->shouldDebugBreak();\n        reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal);\n    }\n\n    void RunContext::handleIncomplete(\n            AssertionInfo const& info\n    ) {\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );\n        data.message = \"Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE\";\n        AssertionResult assertionResult{ info, data };\n        assertionEnded( assertionResult );\n    }\n    void RunContext::handleNonExpr(\n            AssertionInfo const &info,\n            ResultWas::OfType resultType,\n            AssertionReaction &reaction\n    ) {\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( resultType, LazyExpression( false ) );\n        AssertionResult assertionResult{ info, data };\n        assertionEnded( assertionResult );\n\n        if( !assertionResult.isOk() )\n            populateReaction( reaction );\n    }\n\n    IResultCapture& getResultCapture() {\n        if (auto* capture = getCurrentContext().getResultCapture())\n            return *capture;\n        else\n            CATCH_INTERNAL_ERROR(\"No result capture instance\");\n    }\n}\n// end catch_run_context.cpp\n// start catch_section.cpp\n\nnamespace Catch {\n\n    Section::Section( SectionInfo const& info )\n    :   m_info( info ),\n        m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) )\n    {\n        m_timer.start();\n    }\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4996) // std::uncaught_exception is deprecated in C++17\n#endif\n    Section::~Section() {\n        if( m_sectionIncluded ) {\n            SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() );\n            if( std::uncaught_exception() )\n                getResultCapture().sectionEndedEarly( endInfo );\n            else\n                getResultCapture().sectionEnded( endInfo );\n        }\n    }\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n\n    // This indicates whether the section should be executed or not\n    Section::operator bool() const {\n        return m_sectionIncluded;\n    }\n\n} // end namespace Catch\n// end catch_section.cpp\n// start catch_section_info.cpp\n\nnamespace Catch {\n\n    SectionInfo::SectionInfo\n        (   SourceLineInfo const& _lineInfo,\n            std::string const& _name,\n            std::string const& _description )\n    :   name( _name ),\n        description( _description ),\n        lineInfo( _lineInfo )\n    {}\n\n    SectionEndInfo::SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds )\n    : sectionInfo( _sectionInfo ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds )\n    {}\n\n} // end namespace Catch\n// end catch_section_info.cpp\n// start catch_session.cpp\n\n// start catch_session.h\n\n#include <memory>\n\nnamespace Catch {\n\n    class Session : NonCopyable {\n    public:\n\n        Session();\n        ~Session() override;\n\n        void showHelp() const;\n        void libIdentify();\n\n        int applyCommandLine( int argc, char* argv[] );\n\n        void useConfigData( ConfigData const& configData );\n\n        int run( int argc, char* argv[] );\n    #if defined(WIN32) && defined(UNICODE)\n        int run( int argc, wchar_t* const argv[] );\n    #endif\n        int run();\n\n        clara::Parser const& cli() const;\n        void cli( clara::Parser const& newParser );\n        ConfigData& configData();\n        Config& config();\n    private:\n        int runInternal();\n\n        clara::Parser m_cli;\n        ConfigData m_configData;\n        std::shared_ptr<Config> m_config;\n        bool m_startupExceptions = false;\n    };\n\n} // end namespace Catch\n\n// end catch_session.h\n// start catch_version.h\n\n#include <iosfwd>\n\nnamespace Catch {\n\n    // Versioning information\n    struct Version {\n        Version( Version const& ) = delete;\n        Version& operator=( Version const& ) = delete;\n        Version(    unsigned int _majorVersion,\n                    unsigned int _minorVersion,\n                    unsigned int _patchNumber,\n                    char const * const _branchName,\n                    unsigned int _buildNumber );\n\n        unsigned int const majorVersion;\n        unsigned int const minorVersion;\n        unsigned int const patchNumber;\n\n        // buildNumber is only used if branchName is not null\n        char const * const branchName;\n        unsigned int const buildNumber;\n\n        friend std::ostream& operator << ( std::ostream& os, Version const& version );\n    };\n\n    Version const& libraryVersion();\n}\n\n// end catch_version.h\n#include <cstdlib>\n#include <iomanip>\n\nnamespace Catch {\n\n    namespace {\n        const int MaxExitCode = 255;\n\n        IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) {\n            auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config);\n            CATCH_ENFORCE(reporter, \"No reporter registered with name: '\" << reporterName << \"'\");\n\n            return reporter;\n        }\n\n#ifndef CATCH_CONFIG_DEFAULT_REPORTER\n#define CATCH_CONFIG_DEFAULT_REPORTER \"console\"\n#endif\n\n        IStreamingReporterPtr makeReporter(std::shared_ptr<Config> const& config) {\n            auto const& reporterNames = config->getReporterNames();\n            if (reporterNames.empty())\n                return createReporter(CATCH_CONFIG_DEFAULT_REPORTER, config);\n\n            IStreamingReporterPtr reporter;\n            for (auto const& name : reporterNames)\n                addReporter(reporter, createReporter(name, config));\n            return reporter;\n        }\n\n#undef CATCH_CONFIG_DEFAULT_REPORTER\n\n        void addListeners(IStreamingReporterPtr& reporters, IConfigPtr const& config) {\n            auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();\n            for (auto const& listener : listeners)\n                addReporter(reporters, listener->create(Catch::ReporterConfig(config)));\n        }\n\n        Catch::Totals runTests(std::shared_ptr<Config> const& config) {\n            IStreamingReporterPtr reporter = makeReporter(config);\n            addListeners(reporter, config);\n\n            RunContext context(config, std::move(reporter));\n\n            Totals totals;\n\n            context.testGroupStarting(config->name(), 1, 1);\n\n            TestSpec testSpec = config->testSpec();\n            if (!testSpec.hasFilters())\n                testSpec = TestSpecParser(ITagAliasRegistry::get()).parse(\"~[.]\").testSpec(); // All not hidden tests\n\n            auto const& allTestCases = getAllTestCasesSorted(*config);\n            for (auto const& testCase : allTestCases) {\n                if (!context.aborting() && matchTest(testCase, testSpec, *config))\n                    totals += context.runTest(testCase);\n                else\n                    context.reporter().skipTest(testCase);\n            }\n\n            context.testGroupEnded(config->name(), totals, 1, 1);\n            return totals;\n        }\n\n        void applyFilenamesAsTags(Catch::IConfig const& config) {\n            auto& tests = const_cast<std::vector<TestCase>&>(getAllTestCasesSorted(config));\n            for (auto& testCase : tests) {\n                auto tags = testCase.tags;\n\n                std::string filename = testCase.lineInfo.file;\n                auto lastSlash = filename.find_last_of(\"\\\\/\");\n                if (lastSlash != std::string::npos) {\n                    filename.erase(0, lastSlash);\n                    filename[0] = '#';\n                }\n\n                auto lastDot = filename.find_last_of('.');\n                if (lastDot != std::string::npos) {\n                    filename.erase(lastDot);\n                }\n\n                tags.push_back(std::move(filename));\n                setTags(testCase, tags);\n            }\n        }\n\n    } // anon namespace\n\n    Session::Session() {\n        static bool alreadyInstantiated = false;\n        if( alreadyInstantiated ) {\n            try         { CATCH_INTERNAL_ERROR( \"Only one instance of Catch::Session can ever be used\" ); }\n            catch(...)  { getMutableRegistryHub().registerStartupException(); }\n        }\n\n        const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions();\n        if ( !exceptions.empty() ) {\n            m_startupExceptions = true;\n            Colour colourGuard( Colour::Red );\n            Catch::cerr() << \"Errors occured during startup!\" << '\\n';\n            // iterate over all exceptions and notify user\n            for ( const auto& ex_ptr : exceptions ) {\n                try {\n                    std::rethrow_exception(ex_ptr);\n                } catch ( std::exception const& ex ) {\n                    Catch::cerr() << Column( ex.what() ).indent(2) << '\\n';\n                }\n            }\n        }\n\n        alreadyInstantiated = true;\n        m_cli = makeCommandLineParser( m_configData );\n    }\n    Session::~Session() {\n        Catch::cleanUp();\n    }\n\n    void Session::showHelp() const {\n        Catch::cout()\n                << \"\\nCatch v\" << libraryVersion() << \"\\n\"\n                << m_cli << std::endl\n                << \"For more detailed usage please see the project docs\\n\" << std::endl;\n    }\n    void Session::libIdentify() {\n        Catch::cout()\n                << std::left << std::setw(16) << \"description: \" << \"A Catch test executable\\n\"\n                << std::left << std::setw(16) << \"category: \" << \"testframework\\n\"\n                << std::left << std::setw(16) << \"framework: \" << \"Catch Test\\n\"\n                << std::left << std::setw(16) << \"version: \" << libraryVersion() << std::endl;\n    }\n\n    int Session::applyCommandLine( int argc, char* argv[] ) {\n        if( m_startupExceptions )\n            return 1;\n\n        auto result = m_cli.parse( clara::Args( argc, argv ) );\n        if( !result ) {\n            Catch::cerr()\n                << Colour( Colour::Red )\n                << \"\\nError(s) in input:\\n\"\n                << Column( result.errorMessage() ).indent( 2 )\n                << \"\\n\\n\";\n            Catch::cerr() << \"Run with -? for usage\\n\" << std::endl;\n            return MaxExitCode;\n        }\n\n        if( m_configData.showHelp )\n            showHelp();\n        if( m_configData.libIdentify )\n            libIdentify();\n        m_config.reset();\n        return 0;\n    }\n\n    void Session::useConfigData( ConfigData const& configData ) {\n        m_configData = configData;\n        m_config.reset();\n    }\n\n    int Session::run( int argc, char* argv[] ) {\n        if( m_startupExceptions )\n            return 1;\n        int returnCode = applyCommandLine( argc, argv );\n        if( returnCode == 0 )\n            returnCode = run();\n        return returnCode;\n    }\n\n#if defined(WIN32) && defined(UNICODE)\n    int Session::run( int argc, wchar_t* const argv[] ) {\n\n        char **utf8Argv = new char *[ argc ];\n\n        for ( int i = 0; i < argc; ++i ) {\n            int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL );\n\n            utf8Argv[ i ] = new char[ bufSize ];\n\n            WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL );\n        }\n\n        int returnCode = run( argc, utf8Argv );\n\n        for ( int i = 0; i < argc; ++i )\n            delete [] utf8Argv[ i ];\n\n        delete [] utf8Argv;\n\n        return returnCode;\n    }\n#endif\n    int Session::run() {\n        if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {\n            Catch::cout() << \"...waiting for enter/ return before starting\" << std::endl;\n            static_cast<void>(std::getchar());\n        }\n        int exitCode = runInternal();\n        if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {\n            Catch::cout() << \"...waiting for enter/ return before exiting, with code: \" << exitCode << std::endl;\n            static_cast<void>(std::getchar());\n        }\n        return exitCode;\n    }\n\n    clara::Parser const& Session::cli() const {\n        return m_cli;\n    }\n    void Session::cli( clara::Parser const& newParser ) {\n        m_cli = newParser;\n    }\n    ConfigData& Session::configData() {\n        return m_configData;\n    }\n    Config& Session::config() {\n        if( !m_config )\n            m_config = std::make_shared<Config>( m_configData );\n        return *m_config;\n    }\n\n    int Session::runInternal() {\n        if( m_startupExceptions )\n            return 1;\n\n        if( m_configData.showHelp || m_configData.libIdentify )\n            return 0;\n\n        try\n        {\n            config(); // Force config to be constructed\n\n            seedRng( *m_config );\n\n            if( m_configData.filenamesAsTags )\n                applyFilenamesAsTags( *m_config );\n\n            // Handle list request\n            if( Option<std::size_t> listed = list( config() ) )\n                return static_cast<int>( *listed );\n\n            return (std::min)( MaxExitCode, static_cast<int>( runTests( m_config ).assertions.failed ) );\n        }\n        catch( std::exception& ex ) {\n            Catch::cerr() << ex.what() << std::endl;\n            return MaxExitCode;\n        }\n    }\n\n} // end namespace Catch\n// end catch_session.cpp\n// start catch_startup_exception_registry.cpp\n\nnamespace Catch {\n    void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {\n        try {\n            m_exceptions.push_back(exception);\n        }\n        catch(...) {\n            // If we run out of memory during start-up there's really not a lot more we can do about it\n            std::terminate();\n        }\n    }\n\n    std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept {\n        return m_exceptions;\n    }\n\n} // end namespace Catch\n// end catch_startup_exception_registry.cpp\n// start catch_stream.cpp\n\n#include <cstdio>\n#include <iostream>\n#include <fstream>\n#include <sstream>\n#include <vector>\n#include <memory>\n\n#if defined(__clang__)\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#endif\n\nnamespace Catch {\n\n    Catch::IStream::~IStream() = default;\n\n    namespace detail { namespace {\n        template<typename WriterF, std::size_t bufferSize=256>\n        class StreamBufImpl : public std::streambuf {\n            char data[bufferSize];\n            WriterF m_writer;\n\n        public:\n            StreamBufImpl() {\n                setp( data, data + sizeof(data) );\n            }\n\n            ~StreamBufImpl() noexcept {\n                StreamBufImpl::sync();\n            }\n\n        private:\n            int overflow( int c ) override {\n                sync();\n\n                if( c != EOF ) {\n                    if( pbase() == epptr() )\n                        m_writer( std::string( 1, static_cast<char>( c ) ) );\n                    else\n                        sputc( static_cast<char>( c ) );\n                }\n                return 0;\n            }\n\n            int sync() override {\n                if( pbase() != pptr() ) {\n                    m_writer( std::string( pbase(), static_cast<std::string::size_type>( pptr() - pbase() ) ) );\n                    setp( pbase(), epptr() );\n                }\n                return 0;\n            }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        struct OutputDebugWriter {\n\n            void operator()( std::string const&str ) {\n                writeToDebugConsole( str );\n            }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        class FileStream : public IStream {\n            mutable std::ofstream m_ofs;\n        public:\n            FileStream( StringRef filename ) {\n                m_ofs.open( filename.c_str() );\n                CATCH_ENFORCE( !m_ofs.fail(), \"Unable to open file: '\" << filename << \"'\" );\n            }\n            ~FileStream() override = default;\n        public: // IStream\n            std::ostream& stream() const override {\n                return m_ofs;\n            }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        class CoutStream : public IStream {\n            mutable std::ostream m_os;\n        public:\n            // Store the streambuf from cout up-front because\n            // cout may get redirected when running tests\n            CoutStream() : m_os( Catch::cout().rdbuf() ) {}\n            ~CoutStream() override = default;\n\n        public: // IStream\n            std::ostream& stream() const override { return m_os; }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        class DebugOutStream : public IStream {\n            std::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf;\n            mutable std::ostream m_os;\n        public:\n            DebugOutStream()\n            :   m_streamBuf( new StreamBufImpl<OutputDebugWriter>() ),\n                m_os( m_streamBuf.get() )\n            {}\n\n            ~DebugOutStream() override = default;\n\n        public: // IStream\n            std::ostream& stream() const override { return m_os; }\n        };\n\n    }} // namespace anon::detail\n\n    ///////////////////////////////////////////////////////////////////////////\n\n    auto makeStream( StringRef const &filename ) -> IStream const* {\n        if( filename.empty() )\n            return new detail::CoutStream();\n        else if( filename[0] == '%' ) {\n            if( filename == \"%debug\" )\n                return new detail::DebugOutStream();\n            else\n                CATCH_ERROR( \"Unrecognised stream: '\" << filename << \"'\" );\n        }\n        else\n            return new detail::FileStream( filename );\n    }\n\n    // This class encapsulates the idea of a pool of ostringstreams that can be reused.\n    struct StringStreams {\n        std::vector<std::unique_ptr<std::ostringstream>> m_streams;\n        std::vector<std::size_t> m_unused;\n        std::ostringstream m_referenceStream; // Used for copy state/ flags from\n        static StringStreams* s_instance;\n\n        auto add() -> std::size_t {\n            if( m_unused.empty() ) {\n                m_streams.push_back( std::unique_ptr<std::ostringstream>( new std::ostringstream ) );\n                return m_streams.size()-1;\n            }\n            else {\n                auto index = m_unused.back();\n                m_unused.pop_back();\n                return index;\n            }\n        }\n\n        void release( std::size_t index ) {\n            m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state\n            m_unused.push_back(index);\n        }\n\n        // !TBD: put in TLS\n        static auto instance() -> StringStreams& {\n            if( !s_instance )\n                s_instance = new StringStreams();\n            return *s_instance;\n        }\n        static void cleanup() {\n            delete s_instance;\n            s_instance = nullptr;\n        }\n    };\n\n    StringStreams* StringStreams::s_instance = nullptr;\n\n    void ReusableStringStream::cleanup() {\n        StringStreams::cleanup();\n    }\n\n    ReusableStringStream::ReusableStringStream()\n    :   m_index( StringStreams::instance().add() ),\n        m_oss( StringStreams::instance().m_streams[m_index].get() )\n    {}\n\n    ReusableStringStream::~ReusableStringStream() {\n        static_cast<std::ostringstream*>( m_oss )->str(\"\");\n        m_oss->clear();\n        StringStreams::instance().release( m_index );\n    }\n\n    auto ReusableStringStream::str() const -> std::string {\n        return static_cast<std::ostringstream*>( m_oss )->str();\n    }\n\n    ///////////////////////////////////////////////////////////////////////////\n\n#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions\n    std::ostream& cout() { return std::cout; }\n    std::ostream& cerr() { return std::cerr; }\n    std::ostream& clog() { return std::clog; }\n#endif\n}\n\n#if defined(__clang__)\n#    pragma clang diagnostic pop\n#endif\n// end catch_stream.cpp\n// start catch_string_manip.cpp\n\n#include <algorithm>\n#include <ostream>\n#include <cstring>\n#include <cctype>\n\nnamespace Catch {\n\n    bool startsWith( std::string const& s, std::string const& prefix ) {\n        return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());\n    }\n    bool startsWith( std::string const& s, char prefix ) {\n        return !s.empty() && s[0] == prefix;\n    }\n    bool endsWith( std::string const& s, std::string const& suffix ) {\n        return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin());\n    }\n    bool endsWith( std::string const& s, char suffix ) {\n        return !s.empty() && s[s.size()-1] == suffix;\n    }\n    bool contains( std::string const& s, std::string const& infix ) {\n        return s.find( infix ) != std::string::npos;\n    }\n    char toLowerCh(char c) {\n        return static_cast<char>( std::tolower( c ) );\n    }\n    void toLowerInPlace( std::string& s ) {\n        std::transform( s.begin(), s.end(), s.begin(), toLowerCh );\n    }\n    std::string toLower( std::string const& s ) {\n        std::string lc = s;\n        toLowerInPlace( lc );\n        return lc;\n    }\n    std::string trim( std::string const& str ) {\n        static char const* whitespaceChars = \"\\n\\r\\t \";\n        std::string::size_type start = str.find_first_not_of( whitespaceChars );\n        std::string::size_type end = str.find_last_not_of( whitespaceChars );\n\n        return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string();\n    }\n\n    bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {\n        bool replaced = false;\n        std::size_t i = str.find( replaceThis );\n        while( i != std::string::npos ) {\n            replaced = true;\n            str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() );\n            if( i < str.size()-withThis.size() )\n                i = str.find( replaceThis, i+withThis.size() );\n            else\n                i = std::string::npos;\n        }\n        return replaced;\n    }\n\n    pluralise::pluralise( std::size_t count, std::string const& label )\n    :   m_count( count ),\n        m_label( label )\n    {}\n\n    std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {\n        os << pluraliser.m_count << ' ' << pluraliser.m_label;\n        if( pluraliser.m_count != 1 )\n            os << 's';\n        return os;\n    }\n\n}\n// end catch_string_manip.cpp\n// start catch_stringref.cpp\n\n#if defined(__clang__)\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#endif\n\n#include <ostream>\n#include <cstring>\n\nnamespace Catch {\n    StringRef::StringRef( char const* rawChars ) noexcept\n    : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) )\n    {}\n\n    StringRef::operator std::string() const {\n        return std::string( m_start, m_size );\n    }\n\n    void StringRef::swap( StringRef& other ) noexcept {\n        std::swap( m_start, other.m_start );\n        std::swap( m_size, other.m_size );\n        std::swap( m_data, other.m_data );\n    }\n\n    auto StringRef::c_str() const -> char const* {\n        if( isSubstring() )\n           const_cast<StringRef*>( this )->takeOwnership();\n        return m_start;\n    }\n    auto StringRef::data() const noexcept -> char const* {\n        return m_start;\n    }\n\n    auto StringRef::isOwned() const noexcept -> bool {\n        return m_data != nullptr;\n    }\n    auto StringRef::isSubstring() const noexcept -> bool {\n        return m_start[m_size] != '\\0';\n    }\n\n    void StringRef::takeOwnership() {\n        if( !isOwned() ) {\n            m_data = new char[m_size+1];\n            memcpy( m_data, m_start, m_size );\n            m_data[m_size] = '\\0';\n            m_start = m_data;\n        }\n    }\n    auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef {\n        if( start < m_size )\n            return StringRef( m_start+start, size );\n        else\n            return StringRef();\n    }\n    auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool {\n        return\n            size() == other.size() &&\n            (std::strncmp( m_start, other.m_start, size() ) == 0);\n    }\n    auto StringRef::operator != ( StringRef const& other ) const noexcept -> bool {\n        return !operator==( other );\n    }\n\n    auto StringRef::operator[](size_type index) const noexcept -> char {\n        return m_start[index];\n    }\n\n    auto StringRef::numberOfCharacters() const noexcept -> size_type {\n        size_type noChars = m_size;\n        // Make adjustments for uft encodings\n        for( size_type i=0; i < m_size; ++i ) {\n            char c = m_start[i];\n            if( ( c & 0b11000000 ) == 0b11000000 ) {\n                if( ( c & 0b11100000 ) == 0b11000000 )\n                    noChars--;\n                else if( ( c & 0b11110000 ) == 0b11100000 )\n                    noChars-=2;\n                else if( ( c & 0b11111000 ) == 0b11110000 )\n                    noChars-=3;\n            }\n        }\n        return noChars;\n    }\n\n    auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string {\n        std::string str;\n        str.reserve( lhs.size() + rhs.size() );\n        str += lhs;\n        str += rhs;\n        return str;\n    }\n    auto operator + ( StringRef const& lhs, const char* rhs ) -> std::string {\n        return std::string( lhs ) + std::string( rhs );\n    }\n    auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string {\n        return std::string( lhs ) + std::string( rhs );\n    }\n\n    auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& {\n        return os << str.c_str();\n    }\n\n} // namespace Catch\n\n#if defined(__clang__)\n#    pragma clang diagnostic pop\n#endif\n// end catch_stringref.cpp\n// start catch_tag_alias.cpp\n\nnamespace Catch {\n    TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {}\n}\n// end catch_tag_alias.cpp\n// start catch_tag_alias_autoregistrar.cpp\n\nnamespace Catch {\n\n    RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) {\n        try {\n            getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo);\n        } catch (...) {\n            // Do not throw when constructing global objects, instead register the exception to be processed later\n            getMutableRegistryHub().registerStartupException();\n        }\n    }\n\n}\n// end catch_tag_alias_autoregistrar.cpp\n// start catch_tag_alias_registry.cpp\n\n#include <sstream>\n\nnamespace Catch {\n\n    TagAliasRegistry::~TagAliasRegistry() {}\n\n    TagAlias const* TagAliasRegistry::find( std::string const& alias ) const {\n        auto it = m_registry.find( alias );\n        if( it != m_registry.end() )\n            return &(it->second);\n        else\n            return nullptr;\n    }\n\n    std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const {\n        std::string expandedTestSpec = unexpandedTestSpec;\n        for( auto const& registryKvp : m_registry ) {\n            std::size_t pos = expandedTestSpec.find( registryKvp.first );\n            if( pos != std::string::npos ) {\n                expandedTestSpec =  expandedTestSpec.substr( 0, pos ) +\n                                    registryKvp.second.tag +\n                                    expandedTestSpec.substr( pos + registryKvp.first.size() );\n            }\n        }\n        return expandedTestSpec;\n    }\n\n    void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) {\n        CATCH_ENFORCE( startsWith(alias, \"[@\") && endsWith(alias, ']'),\n                      \"error: tag alias, '\" << alias << \"' is not of the form [@alias name].\\n\" << lineInfo );\n\n        CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second,\n                      \"error: tag alias, '\" << alias << \"' already registered.\\n\"\n                      << \"\\tFirst seen at: \" << find(alias)->lineInfo << \"\\n\"\n                      << \"\\tRedefined at: \" << lineInfo );\n    }\n\n    ITagAliasRegistry::~ITagAliasRegistry() {}\n\n    ITagAliasRegistry const& ITagAliasRegistry::get() {\n        return getRegistryHub().getTagAliasRegistry();\n    }\n\n} // end namespace Catch\n// end catch_tag_alias_registry.cpp\n// start catch_test_case_info.cpp\n\n#include <cctype>\n#include <exception>\n#include <algorithm>\n#include <sstream>\n\nnamespace Catch {\n\n    TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) {\n        if( startsWith( tag, '.' ) ||\n            tag == \"!hide\" )\n            return TestCaseInfo::IsHidden;\n        else if( tag == \"!throws\" )\n            return TestCaseInfo::Throws;\n        else if( tag == \"!shouldfail\" )\n            return TestCaseInfo::ShouldFail;\n        else if( tag == \"!mayfail\" )\n            return TestCaseInfo::MayFail;\n        else if( tag == \"!nonportable\" )\n            return TestCaseInfo::NonPortable;\n        else if( tag == \"!benchmark\" )\n            return static_cast<TestCaseInfo::SpecialProperties>( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden );\n        else\n            return TestCaseInfo::None;\n    }\n    bool isReservedTag( std::string const& tag ) {\n        return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( tag[0] );\n    }\n    void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {\n        CATCH_ENFORCE( !isReservedTag(tag),\n                      \"Tag name: [\" << tag << \"] is not allowed.\\n\"\n                      << \"Tag names starting with non alpha-numeric characters are reserved\\n\"\n                      << _lineInfo );\n    }\n\n    TestCase makeTestCase(  ITestInvoker* _testCase,\n                            std::string const& _className,\n                            std::string const& _name,\n                            std::string const& _descOrTags,\n                            SourceLineInfo const& _lineInfo )\n    {\n        bool isHidden = false;\n\n        // Parse out tags\n        std::vector<std::string> tags;\n        std::string desc, tag;\n        bool inTag = false;\n        for (char c : _descOrTags) {\n            if( !inTag ) {\n                if( c == '[' )\n                    inTag = true;\n                else\n                    desc += c;\n            }\n            else {\n                if( c == ']' ) {\n                    TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag );\n                    if( ( prop & TestCaseInfo::IsHidden ) != 0 )\n                        isHidden = true;\n                    else if( prop == TestCaseInfo::None )\n                        enforceNotReservedTag( tag, _lineInfo );\n\n                    tags.push_back( tag );\n                    tag.clear();\n                    inTag = false;\n                }\n                else\n                    tag += c;\n            }\n        }\n        if( isHidden ) {\n            tags.push_back( \".\" );\n        }\n\n        TestCaseInfo info( _name, _className, desc, tags, _lineInfo );\n        return TestCase( _testCase, info );\n    }\n\n    void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) {\n        std::sort(begin(tags), end(tags));\n        tags.erase(std::unique(begin(tags), end(tags)), end(tags));\n        testCaseInfo.lcaseTags.clear();\n\n        for( auto const& tag : tags ) {\n            std::string lcaseTag = toLower( tag );\n            testCaseInfo.properties = static_cast<TestCaseInfo::SpecialProperties>( testCaseInfo.properties | parseSpecialTag( lcaseTag ) );\n            testCaseInfo.lcaseTags.push_back( lcaseTag );\n        }\n        testCaseInfo.tags = std::move(tags);\n    }\n\n    TestCaseInfo::TestCaseInfo( std::string const& _name,\n                                std::string const& _className,\n                                std::string const& _description,\n                                std::vector<std::string> const& _tags,\n                                SourceLineInfo const& _lineInfo )\n    :   name( _name ),\n        className( _className ),\n        description( _description ),\n        lineInfo( _lineInfo ),\n        properties( None )\n    {\n        setTags( *this, _tags );\n    }\n\n    bool TestCaseInfo::isHidden() const {\n        return ( properties & IsHidden ) != 0;\n    }\n    bool TestCaseInfo::throws() const {\n        return ( properties & Throws ) != 0;\n    }\n    bool TestCaseInfo::okToFail() const {\n        return ( properties & (ShouldFail | MayFail ) ) != 0;\n    }\n    bool TestCaseInfo::expectedToFail() const {\n        return ( properties & (ShouldFail ) ) != 0;\n    }\n\n    std::string TestCaseInfo::tagsAsString() const {\n        std::string ret;\n        // '[' and ']' per tag\n        std::size_t full_size = 2 * tags.size();\n        for (const auto& tag : tags) {\n            full_size += tag.size();\n        }\n        ret.reserve(full_size);\n        for (const auto& tag : tags) {\n            ret.push_back('[');\n            ret.append(tag);\n            ret.push_back(']');\n        }\n\n        return ret;\n    }\n\n    TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo const& info ) : TestCaseInfo( info ), test( testCase ) {}\n\n    TestCase TestCase::withName( std::string const& _newName ) const {\n        TestCase other( *this );\n        other.name = _newName;\n        return other;\n    }\n\n    void TestCase::invoke() const {\n        test->invoke();\n    }\n\n    bool TestCase::operator == ( TestCase const& other ) const {\n        return  test.get() == other.test.get() &&\n                name == other.name &&\n                className == other.className;\n    }\n\n    bool TestCase::operator < ( TestCase const& other ) const {\n        return name < other.name;\n    }\n\n    TestCaseInfo const& TestCase::getTestCaseInfo() const\n    {\n        return *this;\n    }\n\n} // end namespace Catch\n// end catch_test_case_info.cpp\n// start catch_test_case_registry_impl.cpp\n\n#include <sstream>\n\nnamespace Catch {\n\n    std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {\n\n        std::vector<TestCase> sorted = unsortedTestCases;\n\n        switch( config.runOrder() ) {\n            case RunTests::InLexicographicalOrder:\n                std::sort( sorted.begin(), sorted.end() );\n                break;\n            case RunTests::InRandomOrder:\n                seedRng( config );\n                RandomNumberGenerator::shuffle( sorted );\n                break;\n            case RunTests::InDeclarationOrder:\n                // already in declaration order\n                break;\n        }\n        return sorted;\n    }\n    bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) {\n        return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() );\n    }\n\n    void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions ) {\n        std::set<TestCase> seenFunctions;\n        for( auto const& function : functions ) {\n            auto prev = seenFunctions.insert( function );\n            CATCH_ENFORCE( prev.second,\n                    \"error: TEST_CASE( \\\"\" << function.name << \"\\\" ) already defined.\\n\"\n                    << \"\\tFirst seen at \" << prev.first->getTestCaseInfo().lineInfo << \"\\n\"\n                    << \"\\tRedefined at \" << function.getTestCaseInfo().lineInfo );\n        }\n    }\n\n    std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {\n        std::vector<TestCase> filtered;\n        filtered.reserve( testCases.size() );\n        for( auto const& testCase : testCases )\n            if( matchTest( testCase, testSpec, config ) )\n                filtered.push_back( testCase );\n        return filtered;\n    }\n    std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {\n        return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );\n    }\n\n    void TestRegistry::registerTest( TestCase const& testCase ) {\n        std::string name = testCase.getTestCaseInfo().name;\n        if( name.empty() ) {\n            ReusableStringStream rss;\n            rss << \"Anonymous test case \" << ++m_unnamedCount;\n            return registerTest( testCase.withName( rss.str() ) );\n        }\n        m_functions.push_back( testCase );\n    }\n\n    std::vector<TestCase> const& TestRegistry::getAllTests() const {\n        return m_functions;\n    }\n    std::vector<TestCase> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const {\n        if( m_sortedFunctions.empty() )\n            enforceNoDuplicateTestCases( m_functions );\n\n        if(  m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) {\n            m_sortedFunctions = sortTests( config, m_functions );\n            m_currentSortOrder = config.runOrder();\n        }\n        return m_sortedFunctions;\n    }\n\n    ///////////////////////////////////////////////////////////////////////////\n    TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {}\n\n    void TestInvokerAsFunction::invoke() const {\n        m_testAsFunction();\n    }\n\n    std::string extractClassName( std::string const& classOrQualifiedMethodName ) {\n        std::string className = classOrQualifiedMethodName;\n        if( startsWith( className, '&' ) )\n        {\n            std::size_t lastColons = className.rfind( \"::\" );\n            std::size_t penultimateColons = className.rfind( \"::\", lastColons-1 );\n            if( penultimateColons == std::string::npos )\n                penultimateColons = 1;\n            className = className.substr( penultimateColons, lastColons-penultimateColons );\n        }\n        return className;\n    }\n\n} // end namespace Catch\n// end catch_test_case_registry_impl.cpp\n// start catch_test_case_tracker.cpp\n\n#include <algorithm>\n#include <assert.h>\n#include <stdexcept>\n#include <memory>\n#include <sstream>\n\n#if defined(__clang__)\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#endif\n\nnamespace Catch {\nnamespace TestCaseTracking {\n\n    NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location )\n    :   name( _name ),\n        location( _location )\n    {}\n\n    ITracker::~ITracker() = default;\n\n    TrackerContext& TrackerContext::instance() {\n        static TrackerContext s_instance;\n        return s_instance;\n    }\n\n    ITracker& TrackerContext::startRun() {\n        m_rootTracker = std::make_shared<SectionTracker>( NameAndLocation( \"{root}\", CATCH_INTERNAL_LINEINFO ), *this, nullptr );\n        m_currentTracker = nullptr;\n        m_runState = Executing;\n        return *m_rootTracker;\n    }\n\n    void TrackerContext::endRun() {\n        m_rootTracker.reset();\n        m_currentTracker = nullptr;\n        m_runState = NotStarted;\n    }\n\n    void TrackerContext::startCycle() {\n        m_currentTracker = m_rootTracker.get();\n        m_runState = Executing;\n    }\n    void TrackerContext::completeCycle() {\n        m_runState = CompletedCycle;\n    }\n\n    bool TrackerContext::completedCycle() const {\n        return m_runState == CompletedCycle;\n    }\n    ITracker& TrackerContext::currentTracker() {\n        return *m_currentTracker;\n    }\n    void TrackerContext::setCurrentTracker( ITracker* tracker ) {\n        m_currentTracker = tracker;\n    }\n\n    TrackerBase::TrackerHasName::TrackerHasName( NameAndLocation const& nameAndLocation ) : m_nameAndLocation( nameAndLocation ) {}\n    bool TrackerBase::TrackerHasName::operator ()( ITrackerPtr const& tracker ) const {\n        return\n            tracker->nameAndLocation().name == m_nameAndLocation.name &&\n            tracker->nameAndLocation().location == m_nameAndLocation.location;\n    }\n\n    TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )\n    :   m_nameAndLocation( nameAndLocation ),\n        m_ctx( ctx ),\n        m_parent( parent )\n    {}\n\n    NameAndLocation const& TrackerBase::nameAndLocation() const {\n        return m_nameAndLocation;\n    }\n    bool TrackerBase::isComplete() const {\n        return m_runState == CompletedSuccessfully || m_runState == Failed;\n    }\n    bool TrackerBase::isSuccessfullyCompleted() const {\n        return m_runState == CompletedSuccessfully;\n    }\n    bool TrackerBase::isOpen() const {\n        return m_runState != NotStarted && !isComplete();\n    }\n    bool TrackerBase::hasChildren() const {\n        return !m_children.empty();\n    }\n\n    void TrackerBase::addChild( ITrackerPtr const& child ) {\n        m_children.push_back( child );\n    }\n\n    ITrackerPtr TrackerBase::findChild( NameAndLocation const& nameAndLocation ) {\n        auto it = std::find_if( m_children.begin(), m_children.end(), TrackerHasName( nameAndLocation ) );\n        return( it != m_children.end() )\n            ? *it\n            : nullptr;\n    }\n    ITracker& TrackerBase::parent() {\n        assert( m_parent ); // Should always be non-null except for root\n        return *m_parent;\n    }\n\n    void TrackerBase::openChild() {\n        if( m_runState != ExecutingChildren ) {\n            m_runState = ExecutingChildren;\n            if( m_parent )\n                m_parent->openChild();\n        }\n    }\n\n    bool TrackerBase::isSectionTracker() const { return false; }\n    bool TrackerBase::isIndexTracker() const { return false; }\n\n    void TrackerBase::open() {\n        m_runState = Executing;\n        moveToThis();\n        if( m_parent )\n            m_parent->openChild();\n    }\n\n    void TrackerBase::close() {\n\n        // Close any still open children (e.g. generators)\n        while( &m_ctx.currentTracker() != this )\n            m_ctx.currentTracker().close();\n\n        switch( m_runState ) {\n            case NeedsAnotherRun:\n                break;\n\n            case Executing:\n                m_runState = CompletedSuccessfully;\n                break;\n            case ExecutingChildren:\n                if( m_children.empty() || m_children.back()->isComplete() )\n                    m_runState = CompletedSuccessfully;\n                break;\n\n            case NotStarted:\n            case CompletedSuccessfully:\n            case Failed:\n                CATCH_INTERNAL_ERROR( \"Illogical state: \" << m_runState );\n\n            default:\n                CATCH_INTERNAL_ERROR( \"Unknown state: \" << m_runState );\n        }\n        moveToParent();\n        m_ctx.completeCycle();\n    }\n    void TrackerBase::fail() {\n        m_runState = Failed;\n        if( m_parent )\n            m_parent->markAsNeedingAnotherRun();\n        moveToParent();\n        m_ctx.completeCycle();\n    }\n    void TrackerBase::markAsNeedingAnotherRun() {\n        m_runState = NeedsAnotherRun;\n    }\n\n    void TrackerBase::moveToParent() {\n        assert( m_parent );\n        m_ctx.setCurrentTracker( m_parent );\n    }\n    void TrackerBase::moveToThis() {\n        m_ctx.setCurrentTracker( this );\n    }\n\n    SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )\n    :   TrackerBase( nameAndLocation, ctx, parent )\n    {\n        if( parent ) {\n            while( !parent->isSectionTracker() )\n                parent = &parent->parent();\n\n            SectionTracker& parentSection = static_cast<SectionTracker&>( *parent );\n            addNextFilters( parentSection.m_filters );\n        }\n    }\n\n    bool SectionTracker::isSectionTracker() const { return true; }\n\n    SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) {\n        std::shared_ptr<SectionTracker> section;\n\n        ITracker& currentTracker = ctx.currentTracker();\n        if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {\n            assert( childTracker );\n            assert( childTracker->isSectionTracker() );\n            section = std::static_pointer_cast<SectionTracker>( childTracker );\n        }\n        else {\n            section = std::make_shared<SectionTracker>( nameAndLocation, ctx, &currentTracker );\n            currentTracker.addChild( section );\n        }\n        if( !ctx.completedCycle() )\n            section->tryOpen();\n        return *section;\n    }\n\n    void SectionTracker::tryOpen() {\n        if( !isComplete() && (m_filters.empty() || m_filters[0].empty() ||  m_filters[0] == m_nameAndLocation.name ) )\n            open();\n    }\n\n    void SectionTracker::addInitialFilters( std::vector<std::string> const& filters ) {\n        if( !filters.empty() ) {\n            m_filters.push_back(\"\"); // Root - should never be consulted\n            m_filters.push_back(\"\"); // Test Case - not a section filter\n            m_filters.insert( m_filters.end(), filters.begin(), filters.end() );\n        }\n    }\n    void SectionTracker::addNextFilters( std::vector<std::string> const& filters ) {\n        if( filters.size() > 1 )\n            m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() );\n    }\n\n    IndexTracker::IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size )\n    :   TrackerBase( nameAndLocation, ctx, parent ),\n        m_size( size )\n    {}\n\n    bool IndexTracker::isIndexTracker() const { return true; }\n\n    IndexTracker& IndexTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ) {\n        std::shared_ptr<IndexTracker> tracker;\n\n        ITracker& currentTracker = ctx.currentTracker();\n        if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {\n            assert( childTracker );\n            assert( childTracker->isIndexTracker() );\n            tracker = std::static_pointer_cast<IndexTracker>( childTracker );\n        }\n        else {\n            tracker = std::make_shared<IndexTracker>( nameAndLocation, ctx, &currentTracker, size );\n            currentTracker.addChild( tracker );\n        }\n\n        if( !ctx.completedCycle() && !tracker->isComplete() ) {\n            if( tracker->m_runState != ExecutingChildren && tracker->m_runState != NeedsAnotherRun )\n                tracker->moveNext();\n            tracker->open();\n        }\n\n        return *tracker;\n    }\n\n    int IndexTracker::index() const { return m_index; }\n\n    void IndexTracker::moveNext() {\n        m_index++;\n        m_children.clear();\n    }\n\n    void IndexTracker::close() {\n        TrackerBase::close();\n        if( m_runState == CompletedSuccessfully && m_index < m_size-1 )\n            m_runState = Executing;\n    }\n\n} // namespace TestCaseTracking\n\nusing TestCaseTracking::ITracker;\nusing TestCaseTracking::TrackerContext;\nusing TestCaseTracking::SectionTracker;\nusing TestCaseTracking::IndexTracker;\n\n} // namespace Catch\n\n#if defined(__clang__)\n#    pragma clang diagnostic pop\n#endif\n// end catch_test_case_tracker.cpp\n// start catch_test_registry.cpp\n\nnamespace Catch {\n\n    auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* {\n        return new(std::nothrow) TestInvokerAsFunction( testAsFunction );\n    }\n\n    NameAndTags::NameAndTags( StringRef name_ , StringRef tags_ ) noexcept : name( name_ ), tags( tags_ ) {}\n\n    AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept {\n        try {\n            getMutableRegistryHub()\n                    .registerTest(\n                        makeTestCase(\n                            invoker,\n                            extractClassName( classOrMethod ),\n                            nameAndTags.name,\n                            nameAndTags.tags,\n                            lineInfo));\n        } catch (...) {\n            // Do not throw when constructing global objects, instead register the exception to be processed later\n            getMutableRegistryHub().registerStartupException();\n        }\n    }\n\n    AutoReg::~AutoReg() = default;\n}\n// end catch_test_registry.cpp\n// start catch_test_spec.cpp\n\n#include <algorithm>\n#include <string>\n#include <vector>\n#include <memory>\n\nnamespace Catch {\n\n    TestSpec::Pattern::~Pattern() = default;\n    TestSpec::NamePattern::~NamePattern() = default;\n    TestSpec::TagPattern::~TagPattern() = default;\n    TestSpec::ExcludedPattern::~ExcludedPattern() = default;\n\n    TestSpec::NamePattern::NamePattern( std::string const& name )\n    : m_wildcardPattern( toLower( name ), CaseSensitive::No )\n    {}\n    bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const {\n        return m_wildcardPattern.matches( toLower( testCase.name ) );\n    }\n\n    TestSpec::TagPattern::TagPattern( std::string const& tag ) : m_tag( toLower( tag ) ) {}\n    bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const {\n        return std::find(begin(testCase.lcaseTags),\n                         end(testCase.lcaseTags),\n                         m_tag) != end(testCase.lcaseTags);\n    }\n\n    TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr const& underlyingPattern ) : m_underlyingPattern( underlyingPattern ) {}\n    bool TestSpec::ExcludedPattern::matches( TestCaseInfo const& testCase ) const { return !m_underlyingPattern->matches( testCase ); }\n\n    bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const {\n        // All patterns in a filter must match for the filter to be a match\n        for( auto const& pattern : m_patterns ) {\n            if( !pattern->matches( testCase ) )\n                return false;\n        }\n        return true;\n    }\n\n    bool TestSpec::hasFilters() const {\n        return !m_filters.empty();\n    }\n    bool TestSpec::matches( TestCaseInfo const& testCase ) const {\n        // A TestSpec matches if any filter matches\n        for( auto const& filter : m_filters )\n            if( filter.matches( testCase ) )\n                return true;\n        return false;\n    }\n}\n// end catch_test_spec.cpp\n// start catch_test_spec_parser.cpp\n\nnamespace Catch {\n\n    TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {}\n\n    TestSpecParser& TestSpecParser::parse( std::string const& arg ) {\n        m_mode = None;\n        m_exclusion = false;\n        m_start = std::string::npos;\n        m_arg = m_tagAliases->expandAliases( arg );\n        m_escapeChars.clear();\n        for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )\n            visitChar( m_arg[m_pos] );\n        if( m_mode == Name )\n            addPattern<TestSpec::NamePattern>();\n        return *this;\n    }\n    TestSpec TestSpecParser::testSpec() {\n        addFilter();\n        return m_testSpec;\n    }\n\n    void TestSpecParser::visitChar( char c ) {\n        if( m_mode == None ) {\n            switch( c ) {\n            case ' ': return;\n            case '~': m_exclusion = true; return;\n            case '[': return startNewMode( Tag, ++m_pos );\n            case '\"': return startNewMode( QuotedName, ++m_pos );\n            case '\\\\': return escape();\n            default: startNewMode( Name, m_pos ); break;\n            }\n        }\n        if( m_mode == Name ) {\n            if( c == ',' ) {\n                addPattern<TestSpec::NamePattern>();\n                addFilter();\n            }\n            else if( c == '[' ) {\n                if( subString() == \"exclude:\" )\n                    m_exclusion = true;\n                else\n                    addPattern<TestSpec::NamePattern>();\n                startNewMode( Tag, ++m_pos );\n            }\n            else if( c == '\\\\' )\n                escape();\n        }\n        else if( m_mode == EscapedName )\n            m_mode = Name;\n        else if( m_mode == QuotedName && c == '\"' )\n            addPattern<TestSpec::NamePattern>();\n        else if( m_mode == Tag && c == ']' )\n            addPattern<TestSpec::TagPattern>();\n    }\n    void TestSpecParser::startNewMode( Mode mode, std::size_t start ) {\n        m_mode = mode;\n        m_start = start;\n    }\n    void TestSpecParser::escape() {\n        if( m_mode == None )\n            m_start = m_pos;\n        m_mode = EscapedName;\n        m_escapeChars.push_back( m_pos );\n    }\n    std::string TestSpecParser::subString() const { return m_arg.substr( m_start, m_pos - m_start ); }\n\n    void TestSpecParser::addFilter() {\n        if( !m_currentFilter.m_patterns.empty() ) {\n            m_testSpec.m_filters.push_back( m_currentFilter );\n            m_currentFilter = TestSpec::Filter();\n        }\n    }\n\n    TestSpec parseTestSpec( std::string const& arg ) {\n        return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec();\n    }\n\n} // namespace Catch\n// end catch_test_spec_parser.cpp\n// start catch_timer.cpp\n\n#include <chrono>\n\nnamespace Catch {\n\n    auto getCurrentNanosecondsSinceEpoch() -> uint64_t {\n        return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();\n    }\n\n    auto estimateClockResolution() -> uint64_t {\n        uint64_t sum = 0;\n        static const uint64_t iterations = 1000000;\n\n        for( std::size_t i = 0; i < iterations; ++i ) {\n\n            uint64_t ticks;\n            uint64_t baseTicks = getCurrentNanosecondsSinceEpoch();\n            do {\n                ticks = getCurrentNanosecondsSinceEpoch();\n            }\n            while( ticks == baseTicks );\n\n            auto delta = ticks - baseTicks;\n            sum += delta;\n        }\n\n        // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers\n        // - and potentially do more iterations if there's a high variance.\n        return sum/iterations;\n    }\n    auto getEstimatedClockResolution() -> uint64_t {\n        static auto s_resolution = estimateClockResolution();\n        return s_resolution;\n    }\n\n    void Timer::start() {\n       m_nanoseconds = getCurrentNanosecondsSinceEpoch();\n    }\n    auto Timer::getElapsedNanoseconds() const -> uint64_t {\n        return getCurrentNanosecondsSinceEpoch() - m_nanoseconds;\n    }\n    auto Timer::getElapsedMicroseconds() const -> uint64_t {\n        return getElapsedNanoseconds()/1000;\n    }\n    auto Timer::getElapsedMilliseconds() const -> unsigned int {\n        return static_cast<unsigned int>(getElapsedMicroseconds()/1000);\n    }\n    auto Timer::getElapsedSeconds() const -> double {\n        return getElapsedMicroseconds()/1000000.0;\n    }\n\n} // namespace Catch\n// end catch_timer.cpp\n// start catch_tostring.cpp\n\n#if defined(__clang__)\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#    pragma clang diagnostic ignored \"-Wglobal-constructors\"\n#endif\n\n// Enable specific decls locally\n#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)\n#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER\n#endif\n\n#include <cmath>\n#include <iomanip>\n\nnamespace Catch {\n\nnamespace Detail {\n\n    const std::string unprintableString = \"{?}\";\n\n    namespace {\n        const int hexThreshold = 255;\n\n        struct Endianness {\n            enum Arch { Big, Little };\n\n            static Arch which() {\n                union _{\n                    int asInt;\n                    char asChar[sizeof (int)];\n                } u;\n\n                u.asInt = 1;\n                return ( u.asChar[sizeof(int)-1] == 1 ) ? Big : Little;\n            }\n        };\n    }\n\n    std::string rawMemoryToString( const void *object, std::size_t size ) {\n        // Reverse order for little endian architectures\n        int i = 0, end = static_cast<int>( size ), inc = 1;\n        if( Endianness::which() == Endianness::Little ) {\n            i = end-1;\n            end = inc = -1;\n        }\n\n        unsigned char const *bytes = static_cast<unsigned char const *>(object);\n        ReusableStringStream rss;\n        rss << \"0x\" << std::setfill('0') << std::hex;\n        for( ; i != end; i += inc )\n             rss << std::setw(2) << static_cast<unsigned>(bytes[i]);\n       return rss.str();\n    }\n}\n\ntemplate<typename T>\nstd::string fpToString( T value, int precision ) {\n    if (std::isnan(value)) {\n        return \"nan\";\n    }\n\n    ReusableStringStream rss;\n    rss << std::setprecision( precision )\n        << std::fixed\n        << value;\n    std::string d = rss.str();\n    std::size_t i = d.find_last_not_of( '0' );\n    if( i != std::string::npos && i != d.size()-1 ) {\n        if( d[i] == '.' )\n            i++;\n        d = d.substr( 0, i+1 );\n    }\n    return d;\n}\n\n//// ======================================================= ////\n//\n//   Out-of-line defs for full specialization of StringMaker\n//\n//// ======================================================= ////\n\nstd::string StringMaker<std::string>::convert(const std::string& str) {\n    if (!getCurrentContext().getConfig()->showInvisibles()) {\n        return '\"' + str + '\"';\n    }\n\n    std::string s(\"\\\"\");\n    for (char c : str) {\n        switch (c) {\n        case '\\n':\n            s.append(\"\\\\n\");\n            break;\n        case '\\t':\n            s.append(\"\\\\t\");\n            break;\n        default:\n            s.push_back(c);\n            break;\n        }\n    }\n    s.append(\"\\\"\");\n    return s;\n}\n\nstd::string StringMaker<std::wstring>::convert(const std::wstring& wstr) {\n    std::string s;\n    s.reserve(wstr.size());\n    for (auto c : wstr) {\n        s += (c <= 0xff) ? static_cast<char>(c) : '?';\n    }\n    return ::Catch::Detail::stringify(s);\n}\n\nstd::string StringMaker<char const*>::convert(char const* str) {\n    if (str) {\n        return ::Catch::Detail::stringify(std::string{ str });\n    } else {\n        return{ \"{null string}\" };\n    }\n}\nstd::string StringMaker<char*>::convert(char* str) {\n    if (str) {\n        return ::Catch::Detail::stringify(std::string{ str });\n    } else {\n        return{ \"{null string}\" };\n    }\n}\nstd::string StringMaker<wchar_t const*>::convert(wchar_t const * str) {\n    if (str) {\n        return ::Catch::Detail::stringify(std::wstring{ str });\n    } else {\n        return{ \"{null string}\" };\n    }\n}\nstd::string StringMaker<wchar_t *>::convert(wchar_t * str) {\n    if (str) {\n        return ::Catch::Detail::stringify(std::wstring{ str });\n    } else {\n        return{ \"{null string}\" };\n    }\n}\n\nstd::string StringMaker<int>::convert(int value) {\n    return ::Catch::Detail::stringify(static_cast<long long>(value));\n}\nstd::string StringMaker<long>::convert(long value) {\n    return ::Catch::Detail::stringify(static_cast<long long>(value));\n}\nstd::string StringMaker<long long>::convert(long long value) {\n    ReusableStringStream rss;\n    rss << value;\n    if (value > Detail::hexThreshold) {\n        rss << \" (0x\" << std::hex << value << ')';\n    }\n    return rss.str();\n}\n\nstd::string StringMaker<unsigned int>::convert(unsigned int value) {\n    return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));\n}\nstd::string StringMaker<unsigned long>::convert(unsigned long value) {\n    return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));\n}\nstd::string StringMaker<unsigned long long>::convert(unsigned long long value) {\n    ReusableStringStream rss;\n    rss << value;\n    if (value > Detail::hexThreshold) {\n        rss << \" (0x\" << std::hex << value << ')';\n    }\n    return rss.str();\n}\n\nstd::string StringMaker<bool>::convert(bool b) {\n    return b ? \"true\" : \"false\";\n}\n\nstd::string StringMaker<char>::convert(char value) {\n    if (value == '\\r') {\n        return \"'\\\\r'\";\n    } else if (value == '\\f') {\n        return \"'\\\\f'\";\n    } else if (value == '\\n') {\n        return \"'\\\\n'\";\n    } else if (value == '\\t') {\n        return \"'\\\\t'\";\n    } else if ('\\0' <= value && value < ' ') {\n        return ::Catch::Detail::stringify(static_cast<unsigned int>(value));\n    } else {\n        char chstr[] = \"' '\";\n        chstr[1] = value;\n        return chstr;\n    }\n}\nstd::string StringMaker<signed char>::convert(signed char c) {\n    return ::Catch::Detail::stringify(static_cast<char>(c));\n}\nstd::string StringMaker<unsigned char>::convert(unsigned char c) {\n    return ::Catch::Detail::stringify(static_cast<char>(c));\n}\n\nstd::string StringMaker<std::nullptr_t>::convert(std::nullptr_t) {\n    return \"nullptr\";\n}\n\nstd::string StringMaker<float>::convert(float value) {\n    return fpToString(value, 5) + 'f';\n}\nstd::string StringMaker<double>::convert(double value) {\n    return fpToString(value, 10);\n}\n\nstd::string ratio_string<std::atto>::symbol() { return \"a\"; }\nstd::string ratio_string<std::femto>::symbol() { return \"f\"; }\nstd::string  ratio_string<std::pico>::symbol() { return \"p\"; }\nstd::string  ratio_string<std::nano>::symbol() { return \"n\"; }\nstd::string ratio_string<std::micro>::symbol() { return \"u\"; }\nstd::string ratio_string<std::milli>::symbol() { return \"m\"; }\n\n} // end namespace Catch\n\n#if defined(__clang__)\n#    pragma clang diagnostic pop\n#endif\n\n// end catch_tostring.cpp\n// start catch_totals.cpp\n\nnamespace Catch {\n\n    Counts Counts::operator - ( Counts const& other ) const {\n        Counts diff;\n        diff.passed = passed - other.passed;\n        diff.failed = failed - other.failed;\n        diff.failedButOk = failedButOk - other.failedButOk;\n        return diff;\n    }\n\n    Counts& Counts::operator += ( Counts const& other ) {\n        passed += other.passed;\n        failed += other.failed;\n        failedButOk += other.failedButOk;\n        return *this;\n    }\n\n    std::size_t Counts::total() const {\n        return passed + failed + failedButOk;\n    }\n    bool Counts::allPassed() const {\n        return failed == 0 && failedButOk == 0;\n    }\n    bool Counts::allOk() const {\n        return failed == 0;\n    }\n\n    Totals Totals::operator - ( Totals const& other ) const {\n        Totals diff;\n        diff.assertions = assertions - other.assertions;\n        diff.testCases = testCases - other.testCases;\n        return diff;\n    }\n\n    Totals& Totals::operator += ( Totals const& other ) {\n        assertions += other.assertions;\n        testCases += other.testCases;\n        return *this;\n    }\n\n    Totals Totals::delta( Totals const& prevTotals ) const {\n        Totals diff = *this - prevTotals;\n        if( diff.assertions.failed > 0 )\n            ++diff.testCases.failed;\n        else if( diff.assertions.failedButOk > 0 )\n            ++diff.testCases.failedButOk;\n        else\n            ++diff.testCases.passed;\n        return diff;\n    }\n\n}\n// end catch_totals.cpp\n// start catch_version.cpp\n\n#include <ostream>\n\nnamespace Catch {\n\n    Version::Version\n        (   unsigned int _majorVersion,\n            unsigned int _minorVersion,\n            unsigned int _patchNumber,\n            char const * const _branchName,\n            unsigned int _buildNumber )\n    :   majorVersion( _majorVersion ),\n        minorVersion( _minorVersion ),\n        patchNumber( _patchNumber ),\n        branchName( _branchName ),\n        buildNumber( _buildNumber )\n    {}\n\n    std::ostream& operator << ( std::ostream& os, Version const& version ) {\n        os  << version.majorVersion << '.'\n            << version.minorVersion << '.'\n            << version.patchNumber;\n        // branchName is never null -> 0th char is \\0 if it is empty\n        if (version.branchName[0]) {\n            os << '-' << version.branchName\n               << '.' << version.buildNumber;\n        }\n        return os;\n    }\n\n    Version const& libraryVersion() {\n        static Version version( 2, 1, 0, \"\", 0 );\n        return version;\n    }\n\n}\n// end catch_version.cpp\n// start catch_wildcard_pattern.cpp\n\n#include <sstream>\n\nnamespace Catch {\n\n    WildcardPattern::WildcardPattern( std::string const& pattern,\n                                      CaseSensitive::Choice caseSensitivity )\n    :   m_caseSensitivity( caseSensitivity ),\n        m_pattern( adjustCase( pattern ) )\n    {\n        if( startsWith( m_pattern, '*' ) ) {\n            m_pattern = m_pattern.substr( 1 );\n            m_wildcard = WildcardAtStart;\n        }\n        if( endsWith( m_pattern, '*' ) ) {\n            m_pattern = m_pattern.substr( 0, m_pattern.size()-1 );\n            m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd );\n        }\n    }\n\n    bool WildcardPattern::matches( std::string const& str ) const {\n        switch( m_wildcard ) {\n            case NoWildcard:\n                return m_pattern == adjustCase( str );\n            case WildcardAtStart:\n                return endsWith( adjustCase( str ), m_pattern );\n            case WildcardAtEnd:\n                return startsWith( adjustCase( str ), m_pattern );\n            case WildcardAtBothEnds:\n                return contains( adjustCase( str ), m_pattern );\n            default:\n                CATCH_INTERNAL_ERROR( \"Unknown enum\" );\n        }\n    }\n\n    std::string WildcardPattern::adjustCase( std::string const& str ) const {\n        return m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str;\n    }\n}\n// end catch_wildcard_pattern.cpp\n// start catch_xmlwriter.cpp\n\n#include <iomanip>\n\nnamespace Catch {\n\n    XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat )\n    :   m_str( str ),\n        m_forWhat( forWhat )\n    {}\n\n    void XmlEncode::encodeTo( std::ostream& os ) const {\n\n        // Apostrophe escaping not necessary if we always use \" to write attributes\n        // (see: http://www.w3.org/TR/xml/#syntax)\n\n        for( std::size_t i = 0; i < m_str.size(); ++ i ) {\n            char c = m_str[i];\n            switch( c ) {\n                case '<':   os << \"&lt;\"; break;\n                case '&':   os << \"&amp;\"; break;\n\n                case '>':\n                    // See: http://www.w3.org/TR/xml/#syntax\n                    if( i > 2 && m_str[i-1] == ']' && m_str[i-2] == ']' )\n                        os << \"&gt;\";\n                    else\n                        os << c;\n                    break;\n\n                case '\\\"':\n                    if( m_forWhat == ForAttributes )\n                        os << \"&quot;\";\n                    else\n                        os << c;\n                    break;\n\n                default:\n                    // Escape control chars - based on contribution by @espenalb in PR #465 and\n                    // by @mrpi PR #588\n                    if ( ( c >= 0 && c < '\\x09' ) || ( c > '\\x0D' && c < '\\x20') || c=='\\x7F' ) {\n                        // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0\n                        os << \"\\\\x\" << std::uppercase << std::hex << std::setfill('0') << std::setw(2)\n                           << static_cast<int>( c );\n                    }\n                    else\n                        os << c;\n            }\n        }\n    }\n\n    std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) {\n        xmlEncode.encodeTo( os );\n        return os;\n    }\n\n    XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer )\n    :   m_writer( writer )\n    {}\n\n    XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept\n    :   m_writer( other.m_writer ){\n        other.m_writer = nullptr;\n    }\n    XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept {\n        if ( m_writer ) {\n            m_writer->endElement();\n        }\n        m_writer = other.m_writer;\n        other.m_writer = nullptr;\n        return *this;\n    }\n\n    XmlWriter::ScopedElement::~ScopedElement() {\n        if( m_writer )\n            m_writer->endElement();\n    }\n\n    XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, bool indent ) {\n        m_writer->writeText( text, indent );\n        return *this;\n    }\n\n    XmlWriter::XmlWriter( std::ostream& os ) : m_os( os )\n    {\n        writeDeclaration();\n    }\n\n    XmlWriter::~XmlWriter() {\n        while( !m_tags.empty() )\n            endElement();\n    }\n\n    XmlWriter& XmlWriter::startElement( std::string const& name ) {\n        ensureTagClosed();\n        newlineIfNecessary();\n        m_os << m_indent << '<' << name;\n        m_tags.push_back( name );\n        m_indent += \"  \";\n        m_tagIsOpen = true;\n        return *this;\n    }\n\n    XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name ) {\n        ScopedElement scoped( this );\n        startElement( name );\n        return scoped;\n    }\n\n    XmlWriter& XmlWriter::endElement() {\n        newlineIfNecessary();\n        m_indent = m_indent.substr( 0, m_indent.size()-2 );\n        if( m_tagIsOpen ) {\n            m_os << \"/>\";\n            m_tagIsOpen = false;\n        }\n        else {\n            m_os << m_indent << \"</\" << m_tags.back() << \">\";\n        }\n        m_os << std::endl;\n        m_tags.pop_back();\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) {\n        if( !name.empty() && !attribute.empty() )\n            m_os << ' ' << name << \"=\\\"\" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '\"';\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) {\n        m_os << ' ' << name << \"=\\\"\" << ( attribute ? \"true\" : \"false\" ) << '\"';\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeText( std::string const& text, bool indent ) {\n        if( !text.empty() ){\n            bool tagWasOpen = m_tagIsOpen;\n            ensureTagClosed();\n            if( tagWasOpen && indent )\n                m_os << m_indent;\n            m_os << XmlEncode( text );\n            m_needsNewline = true;\n        }\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeComment( std::string const& text ) {\n        ensureTagClosed();\n        m_os << m_indent << \"<!--\" << text << \"-->\";\n        m_needsNewline = true;\n        return *this;\n    }\n\n    void XmlWriter::writeStylesheetRef( std::string const& url ) {\n        m_os << \"<?xml-stylesheet type=\\\"text/xsl\\\" href=\\\"\" << url << \"\\\"?>\\n\";\n    }\n\n    XmlWriter& XmlWriter::writeBlankLine() {\n        ensureTagClosed();\n        m_os << '\\n';\n        return *this;\n    }\n\n    void XmlWriter::ensureTagClosed() {\n        if( m_tagIsOpen ) {\n            m_os << \">\" << std::endl;\n            m_tagIsOpen = false;\n        }\n    }\n\n    void XmlWriter::writeDeclaration() {\n        m_os << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\";\n    }\n\n    void XmlWriter::newlineIfNecessary() {\n        if( m_needsNewline ) {\n            m_os << std::endl;\n            m_needsNewline = false;\n        }\n    }\n}\n// end catch_xmlwriter.cpp\n// start catch_reporter_bases.cpp\n\n#include <cstring>\n#include <cfloat>\n#include <cstdio>\n#include <assert.h>\n#include <memory>\n\nnamespace Catch {\n    void prepareExpandedExpression(AssertionResult& result) {\n        result.getExpandedExpression();\n    }\n\n    // Because formatting using c++ streams is stateful, drop down to C is required\n    // Alternatively we could use stringstream, but its performance is... not good.\n    std::string getFormattedDuration( double duration ) {\n        // Max exponent + 1 is required to represent the whole part\n        // + 1 for decimal point\n        // + 3 for the 3 decimal places\n        // + 1 for null terminator\n        const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;\n        char buffer[maxDoubleSize];\n\n        // Save previous errno, to prevent sprintf from overwriting it\n        ErrnoGuard guard;\n#ifdef _MSC_VER\n        sprintf_s(buffer, \"%.3f\", duration);\n#else\n        sprintf(buffer, \"%.3f\", duration);\n#endif\n        return std::string(buffer);\n    }\n\n    TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config)\n        :StreamingReporterBase(_config) {}\n\n    void TestEventListenerBase::assertionStarting(AssertionInfo const &) {}\n\n    bool TestEventListenerBase::assertionEnded(AssertionStats const &) {\n        return false;\n    }\n\n} // end namespace Catch\n// end catch_reporter_bases.cpp\n// start catch_reporter_compact.cpp\n\nnamespace {\n\n#ifdef CATCH_PLATFORM_MAC\n    const char* failedString() { return \"FAILED\"; }\n    const char* passedString() { return \"PASSED\"; }\n#else\n    const char* failedString() { return \"failed\"; }\n    const char* passedString() { return \"passed\"; }\n#endif\n\n    // Colour::LightGrey\n    Catch::Colour::Code dimColour() { return Catch::Colour::FileName; }\n\n    std::string bothOrAll( std::size_t count ) {\n        return count == 1 ? std::string() :\n               count == 2 ? \"both \" : \"all \" ;\n    }\n\n} // anon namespace\n\nnamespace Catch {\nnamespace {\n// Colour, message variants:\n// - white: No tests ran.\n// -   red: Failed [both/all] N test cases, failed [both/all] M assertions.\n// - white: Passed [both/all] N test cases (no assertions).\n// -   red: Failed N tests cases, failed M assertions.\n// - green: Passed [both/all] N tests cases with M assertions.\nvoid printTotals(std::ostream& out, const Totals& totals) {\n    if (totals.testCases.total() == 0) {\n        out << \"No tests ran.\";\n    } else if (totals.testCases.failed == totals.testCases.total()) {\n        Colour colour(Colour::ResultError);\n        const std::string qualify_assertions_failed =\n            totals.assertions.failed == totals.assertions.total() ?\n            bothOrAll(totals.assertions.failed) : std::string();\n        out <<\n            \"Failed \" << bothOrAll(totals.testCases.failed)\n            << pluralise(totals.testCases.failed, \"test case\") << \", \"\n            \"failed \" << qualify_assertions_failed <<\n            pluralise(totals.assertions.failed, \"assertion\") << '.';\n    } else if (totals.assertions.total() == 0) {\n        out <<\n            \"Passed \" << bothOrAll(totals.testCases.total())\n            << pluralise(totals.testCases.total(), \"test case\")\n            << \" (no assertions).\";\n    } else if (totals.assertions.failed) {\n        Colour colour(Colour::ResultError);\n        out <<\n            \"Failed \" << pluralise(totals.testCases.failed, \"test case\") << \", \"\n            \"failed \" << pluralise(totals.assertions.failed, \"assertion\") << '.';\n    } else {\n        Colour colour(Colour::ResultSuccess);\n        out <<\n            \"Passed \" << bothOrAll(totals.testCases.passed)\n            << pluralise(totals.testCases.passed, \"test case\") <<\n            \" with \" << pluralise(totals.assertions.passed, \"assertion\") << '.';\n    }\n}\n\n// Implementation of CompactReporter formatting\nclass AssertionPrinter {\npublic:\n    AssertionPrinter& operator= (AssertionPrinter const&) = delete;\n    AssertionPrinter(AssertionPrinter const&) = delete;\n    AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages)\n        : stream(_stream)\n        , result(_stats.assertionResult)\n        , messages(_stats.infoMessages)\n        , itMessage(_stats.infoMessages.begin())\n        , printInfoMessages(_printInfoMessages) {}\n\n    void print() {\n        printSourceInfo();\n\n        itMessage = messages.begin();\n\n        switch (result.getResultType()) {\n        case ResultWas::Ok:\n            printResultType(Colour::ResultSuccess, passedString());\n            printOriginalExpression();\n            printReconstructedExpression();\n            if (!result.hasExpression())\n                printRemainingMessages(Colour::None);\n            else\n                printRemainingMessages();\n            break;\n        case ResultWas::ExpressionFailed:\n            if (result.isOk())\n                printResultType(Colour::ResultSuccess, failedString() + std::string(\" - but was ok\"));\n            else\n                printResultType(Colour::Error, failedString());\n            printOriginalExpression();\n            printReconstructedExpression();\n            printRemainingMessages();\n            break;\n        case ResultWas::ThrewException:\n            printResultType(Colour::Error, failedString());\n            printIssue(\"unexpected exception with message:\");\n            printMessage();\n            printExpressionWas();\n            printRemainingMessages();\n            break;\n        case ResultWas::FatalErrorCondition:\n            printResultType(Colour::Error, failedString());\n            printIssue(\"fatal error condition with message:\");\n            printMessage();\n            printExpressionWas();\n            printRemainingMessages();\n            break;\n        case ResultWas::DidntThrowException:\n            printResultType(Colour::Error, failedString());\n            printIssue(\"expected exception, got none\");\n            printExpressionWas();\n            printRemainingMessages();\n            break;\n        case ResultWas::Info:\n            printResultType(Colour::None, \"info\");\n            printMessage();\n            printRemainingMessages();\n            break;\n        case ResultWas::Warning:\n            printResultType(Colour::None, \"warning\");\n            printMessage();\n            printRemainingMessages();\n            break;\n        case ResultWas::ExplicitFailure:\n            printResultType(Colour::Error, failedString());\n            printIssue(\"explicitly\");\n            printRemainingMessages(Colour::None);\n            break;\n            // These cases are here to prevent compiler warnings\n        case ResultWas::Unknown:\n        case ResultWas::FailureBit:\n        case ResultWas::Exception:\n            printResultType(Colour::Error, \"** internal error **\");\n            break;\n        }\n    }\n\nprivate:\n    void printSourceInfo() const {\n        Colour colourGuard(Colour::FileName);\n        stream << result.getSourceInfo() << ':';\n    }\n\n    void printResultType(Colour::Code colour, std::string const& passOrFail) const {\n        if (!passOrFail.empty()) {\n            {\n                Colour colourGuard(colour);\n                stream << ' ' << passOrFail;\n            }\n            stream << ':';\n        }\n    }\n\n    void printIssue(std::string const& issue) const {\n        stream << ' ' << issue;\n    }\n\n    void printExpressionWas() {\n        if (result.hasExpression()) {\n            stream << ';';\n            {\n                Colour colour(dimColour());\n                stream << \" expression was:\";\n            }\n            printOriginalExpression();\n        }\n    }\n\n    void printOriginalExpression() const {\n        if (result.hasExpression()) {\n            stream << ' ' << result.getExpression();\n        }\n    }\n\n    void printReconstructedExpression() const {\n        if (result.hasExpandedExpression()) {\n            {\n                Colour colour(dimColour());\n                stream << \" for: \";\n            }\n            stream << result.getExpandedExpression();\n        }\n    }\n\n    void printMessage() {\n        if (itMessage != messages.end()) {\n            stream << \" '\" << itMessage->message << '\\'';\n            ++itMessage;\n        }\n    }\n\n    void printRemainingMessages(Colour::Code colour = dimColour()) {\n        if (itMessage == messages.end())\n            return;\n\n        // using messages.end() directly yields (or auto) compilation error:\n        std::vector<MessageInfo>::const_iterator itEnd = messages.end();\n        const std::size_t N = static_cast<std::size_t>(std::distance(itMessage, itEnd));\n\n        {\n            Colour colourGuard(colour);\n            stream << \" with \" << pluralise(N, \"message\") << ':';\n        }\n\n        for (; itMessage != itEnd; ) {\n            // If this assertion is a warning ignore any INFO messages\n            if (printInfoMessages || itMessage->type != ResultWas::Info) {\n                stream << \" '\" << itMessage->message << '\\'';\n                if (++itMessage != itEnd) {\n                    Colour colourGuard(dimColour());\n                    stream << \" and\";\n                }\n            }\n        }\n    }\n\nprivate:\n    std::ostream& stream;\n    AssertionResult const& result;\n    std::vector<MessageInfo> messages;\n    std::vector<MessageInfo>::const_iterator itMessage;\n    bool printInfoMessages;\n};\n\n} // anon namespace\n\n        std::string CompactReporter::getDescription() {\n            return \"Reports test results on a single line, suitable for IDEs\";\n        }\n\n        ReporterPreferences CompactReporter::getPreferences() const {\n            ReporterPreferences prefs;\n            prefs.shouldRedirectStdOut = false;\n            return prefs;\n        }\n\n        void CompactReporter::noMatchingTestCases( std::string const& spec ) {\n            stream << \"No test cases matched '\" << spec << '\\'' << std::endl;\n        }\n\n        void CompactReporter::assertionStarting( AssertionInfo const& ) {}\n\n        bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) {\n            AssertionResult const& result = _assertionStats.assertionResult;\n\n            bool printInfoMessages = true;\n\n            // Drop out if result was successful and we're not printing those\n            if( !m_config->includeSuccessfulResults() && result.isOk() ) {\n                if( result.getResultType() != ResultWas::Warning )\n                    return false;\n                printInfoMessages = false;\n            }\n\n            AssertionPrinter printer( stream, _assertionStats, printInfoMessages );\n            printer.print();\n\n            stream << std::endl;\n            return true;\n        }\n\n        void CompactReporter::sectionEnded(SectionStats const& _sectionStats) {\n            if (m_config->showDurations() == ShowDurations::Always) {\n                stream << getFormattedDuration(_sectionStats.durationInSeconds) << \" s: \" << _sectionStats.sectionInfo.name << std::endl;\n            }\n        }\n\n        void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) {\n            printTotals( stream, _testRunStats.totals );\n            stream << '\\n' << std::endl;\n            StreamingReporterBase::testRunEnded( _testRunStats );\n        }\n\n        CompactReporter::~CompactReporter() {}\n\n    CATCH_REGISTER_REPORTER( \"compact\", CompactReporter )\n\n} // end namespace Catch\n// end catch_reporter_compact.cpp\n// start catch_reporter_console.cpp\n\n#include <cfloat>\n#include <cstdio>\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch\n // Note that 4062 (not all labels are handled\n // and default is missing) is enabled\n#endif\n\nnamespace Catch {\n\nnamespace {\n\n// Formatter impl for ConsoleReporter\nclass ConsoleAssertionPrinter {\npublic:\n    ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete;\n    ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete;\n    ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages)\n        : stream(_stream),\n        stats(_stats),\n        result(_stats.assertionResult),\n        colour(Colour::None),\n        message(result.getMessage()),\n        messages(_stats.infoMessages),\n        printInfoMessages(_printInfoMessages) {\n        switch (result.getResultType()) {\n        case ResultWas::Ok:\n            colour = Colour::Success;\n            passOrFail = \"PASSED\";\n            //if( result.hasMessage() )\n            if (_stats.infoMessages.size() == 1)\n                messageLabel = \"with message\";\n            if (_stats.infoMessages.size() > 1)\n                messageLabel = \"with messages\";\n            break;\n        case ResultWas::ExpressionFailed:\n            if (result.isOk()) {\n                colour = Colour::Success;\n                passOrFail = \"FAILED - but was ok\";\n            } else {\n                colour = Colour::Error;\n                passOrFail = \"FAILED\";\n            }\n            if (_stats.infoMessages.size() == 1)\n                messageLabel = \"with message\";\n            if (_stats.infoMessages.size() > 1)\n                messageLabel = \"with messages\";\n            break;\n        case ResultWas::ThrewException:\n            colour = Colour::Error;\n            passOrFail = \"FAILED\";\n            messageLabel = \"due to unexpected exception with \";\n            if (_stats.infoMessages.size() == 1)\n                messageLabel += \"message\";\n            if (_stats.infoMessages.size() > 1)\n                messageLabel += \"messages\";\n            break;\n        case ResultWas::FatalErrorCondition:\n            colour = Colour::Error;\n            passOrFail = \"FAILED\";\n            messageLabel = \"due to a fatal error condition\";\n            break;\n        case ResultWas::DidntThrowException:\n            colour = Colour::Error;\n            passOrFail = \"FAILED\";\n            messageLabel = \"because no exception was thrown where one was expected\";\n            break;\n        case ResultWas::Info:\n            messageLabel = \"info\";\n            break;\n        case ResultWas::Warning:\n            messageLabel = \"warning\";\n            break;\n        case ResultWas::ExplicitFailure:\n            passOrFail = \"FAILED\";\n            colour = Colour::Error;\n            if (_stats.infoMessages.size() == 1)\n                messageLabel = \"explicitly with message\";\n            if (_stats.infoMessages.size() > 1)\n                messageLabel = \"explicitly with messages\";\n            break;\n            // These cases are here to prevent compiler warnings\n        case ResultWas::Unknown:\n        case ResultWas::FailureBit:\n        case ResultWas::Exception:\n            passOrFail = \"** internal error **\";\n            colour = Colour::Error;\n            break;\n        }\n    }\n\n    void print() const {\n        printSourceInfo();\n        if (stats.totals.assertions.total() > 0) {\n            if (result.isOk())\n                stream << '\\n';\n            printResultType();\n            printOriginalExpression();\n            printReconstructedExpression();\n        } else {\n            stream << '\\n';\n        }\n        printMessage();\n    }\n\nprivate:\n    void printResultType() const {\n        if (!passOrFail.empty()) {\n            Colour colourGuard(colour);\n            stream << passOrFail << \":\\n\";\n        }\n    }\n    void printOriginalExpression() const {\n        if (result.hasExpression()) {\n            Colour colourGuard(Colour::OriginalExpression);\n            stream << \"  \";\n            stream << result.getExpressionInMacro();\n            stream << '\\n';\n        }\n    }\n    void printReconstructedExpression() const {\n        if (result.hasExpandedExpression()) {\n            stream << \"with expansion:\\n\";\n            Colour colourGuard(Colour::ReconstructedExpression);\n            stream << Column(result.getExpandedExpression()).indent(2) << '\\n';\n        }\n    }\n    void printMessage() const {\n        if (!messageLabel.empty())\n            stream << messageLabel << ':' << '\\n';\n        for (auto const& msg : messages) {\n            // If this assertion is a warning ignore any INFO messages\n            if (printInfoMessages || msg.type != ResultWas::Info)\n                stream << Column(msg.message).indent(2) << '\\n';\n        }\n    }\n    void printSourceInfo() const {\n        Colour colourGuard(Colour::FileName);\n        stream << result.getSourceInfo() << \": \";\n    }\n\n    std::ostream& stream;\n    AssertionStats const& stats;\n    AssertionResult const& result;\n    Colour::Code colour;\n    std::string passOrFail;\n    std::string messageLabel;\n    std::string message;\n    std::vector<MessageInfo> messages;\n    bool printInfoMessages;\n};\n\nstd::size_t makeRatio(std::size_t number, std::size_t total) {\n    std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0;\n    return (ratio == 0 && number > 0) ? 1 : ratio;\n}\n\nstd::size_t& findMax(std::size_t& i, std::size_t& j, std::size_t& k) {\n    if (i > j && i > k)\n        return i;\n    else if (j > k)\n        return j;\n    else\n        return k;\n}\n\nstruct ColumnInfo {\n    enum Justification { Left, Right };\n    std::string name;\n    int width;\n    Justification justification;\n};\nstruct ColumnBreak {};\nstruct RowBreak {};\n\nclass Duration {\n    enum class Unit {\n        Auto,\n        Nanoseconds,\n        Microseconds,\n        Milliseconds,\n        Seconds,\n        Minutes\n    };\n    static const uint64_t s_nanosecondsInAMicrosecond = 1000;\n    static const uint64_t s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond;\n    static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond;\n    static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond;\n\n    uint64_t m_inNanoseconds;\n    Unit m_units;\n\npublic:\n    explicit Duration(uint64_t inNanoseconds, Unit units = Unit::Auto)\n        : m_inNanoseconds(inNanoseconds),\n        m_units(units) {\n        if (m_units == Unit::Auto) {\n            if (m_inNanoseconds < s_nanosecondsInAMicrosecond)\n                m_units = Unit::Nanoseconds;\n            else if (m_inNanoseconds < s_nanosecondsInAMillisecond)\n                m_units = Unit::Microseconds;\n            else if (m_inNanoseconds < s_nanosecondsInASecond)\n                m_units = Unit::Milliseconds;\n            else if (m_inNanoseconds < s_nanosecondsInAMinute)\n                m_units = Unit::Seconds;\n            else\n                m_units = Unit::Minutes;\n        }\n\n    }\n\n    auto value() const -> double {\n        switch (m_units) {\n        case Unit::Microseconds:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMicrosecond);\n        case Unit::Milliseconds:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMillisecond);\n        case Unit::Seconds:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInASecond);\n        case Unit::Minutes:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMinute);\n        default:\n            return static_cast<double>(m_inNanoseconds);\n        }\n    }\n    auto unitsAsString() const -> std::string {\n        switch (m_units) {\n        case Unit::Nanoseconds:\n            return \"ns\";\n        case Unit::Microseconds:\n            return \"µs\";\n        case Unit::Milliseconds:\n            return \"ms\";\n        case Unit::Seconds:\n            return \"s\";\n        case Unit::Minutes:\n            return \"m\";\n        default:\n            return \"** internal error **\";\n        }\n\n    }\n    friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& {\n        return os << duration.value() << \" \" << duration.unitsAsString();\n    }\n};\n} // end anon namespace\n\nclass TablePrinter {\n    std::ostream& m_os;\n    std::vector<ColumnInfo> m_columnInfos;\n    std::ostringstream m_oss;\n    int m_currentColumn = -1;\n    bool m_isOpen = false;\n\npublic:\n    TablePrinter( std::ostream& os, std::vector<ColumnInfo> columnInfos )\n    :   m_os( os ),\n        m_columnInfos( std::move( columnInfos ) ) {}\n\n    auto columnInfos() const -> std::vector<ColumnInfo> const& {\n        return m_columnInfos;\n    }\n\n    void open() {\n        if (!m_isOpen) {\n            m_isOpen = true;\n            *this << RowBreak();\n            for (auto const& info : m_columnInfos)\n                *this << info.name << ColumnBreak();\n            *this << RowBreak();\n            m_os << Catch::getLineOfChars<'-'>() << \"\\n\";\n        }\n    }\n    void close() {\n        if (m_isOpen) {\n            *this << RowBreak();\n            m_os << std::endl;\n            m_isOpen = false;\n        }\n    }\n\n    template<typename T>\n    friend TablePrinter& operator << (TablePrinter& tp, T const& value) {\n        tp.m_oss << value;\n        return tp;\n    }\n\n    friend TablePrinter& operator << (TablePrinter& tp, ColumnBreak) {\n        auto colStr = tp.m_oss.str();\n        // This takes account of utf8 encodings\n        auto strSize = Catch::StringRef(colStr).numberOfCharacters();\n        tp.m_oss.str(\"\");\n        tp.open();\n        if (tp.m_currentColumn == static_cast<int>(tp.m_columnInfos.size() - 1)) {\n            tp.m_currentColumn = -1;\n            tp.m_os << \"\\n\";\n        }\n        tp.m_currentColumn++;\n\n        auto colInfo = tp.m_columnInfos[tp.m_currentColumn];\n        auto padding = (strSize + 2 < static_cast<std::size_t>(colInfo.width))\n            ? std::string(colInfo.width - (strSize + 2), ' ')\n            : std::string();\n        if (colInfo.justification == ColumnInfo::Left)\n            tp.m_os << colStr << padding << \" \";\n        else\n            tp.m_os << padding << colStr << \" \";\n        return tp;\n    }\n\n    friend TablePrinter& operator << (TablePrinter& tp, RowBreak) {\n        if (tp.m_currentColumn > 0) {\n            tp.m_os << \"\\n\";\n            tp.m_currentColumn = -1;\n        }\n        return tp;\n    }\n};\n\nConsoleReporter::ConsoleReporter(ReporterConfig const& config)\n    : StreamingReporterBase(config),\n    m_tablePrinter(new TablePrinter(config.stream(),\n    {\n        { \"benchmark name\", CATCH_CONFIG_CONSOLE_WIDTH - 32, ColumnInfo::Left },\n        { \"iters\", 8, ColumnInfo::Right },\n        { \"elapsed ns\", 14, ColumnInfo::Right },\n        { \"average\", 14, ColumnInfo::Right }\n    })) {}\nConsoleReporter::~ConsoleReporter() = default;\n\nstd::string ConsoleReporter::getDescription() {\n    return \"Reports test results as plain lines of text\";\n}\n\nvoid ConsoleReporter::noMatchingTestCases(std::string const& spec) {\n    stream << \"No test cases matched '\" << spec << '\\'' << std::endl;\n}\n\nvoid ConsoleReporter::assertionStarting(AssertionInfo const&) {}\n\nbool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) {\n    AssertionResult const& result = _assertionStats.assertionResult;\n\n    bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();\n\n    // Drop out if result was successful but we're not printing them.\n    if (!includeResults && result.getResultType() != ResultWas::Warning)\n        return false;\n\n    lazyPrint();\n\n    ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults);\n    printer.print();\n    stream << std::endl;\n    return true;\n}\n\nvoid ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) {\n    m_headerPrinted = false;\n    StreamingReporterBase::sectionStarting(_sectionInfo);\n}\nvoid ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {\n    m_tablePrinter->close();\n    if (_sectionStats.missingAssertions) {\n        lazyPrint();\n        Colour colour(Colour::ResultError);\n        if (m_sectionStack.size() > 1)\n            stream << \"\\nNo assertions in section\";\n        else\n            stream << \"\\nNo assertions in test case\";\n        stream << \" '\" << _sectionStats.sectionInfo.name << \"'\\n\" << std::endl;\n    }\n    if (m_config->showDurations() == ShowDurations::Always) {\n        stream << getFormattedDuration(_sectionStats.durationInSeconds) << \" s: \" << _sectionStats.sectionInfo.name << std::endl;\n    }\n    if (m_headerPrinted) {\n        m_headerPrinted = false;\n    }\n    StreamingReporterBase::sectionEnded(_sectionStats);\n}\n\nvoid ConsoleReporter::benchmarkStarting(BenchmarkInfo const& info) {\n    lazyPrintWithoutClosingBenchmarkTable();\n\n    auto nameCol = Column( info.name ).width( static_cast<std::size_t>( m_tablePrinter->columnInfos()[0].width - 2 ) );\n\n    bool firstLine = true;\n    for (auto line : nameCol) {\n        if (!firstLine)\n            (*m_tablePrinter) << ColumnBreak() << ColumnBreak() << ColumnBreak();\n        else\n            firstLine = false;\n\n        (*m_tablePrinter) << line << ColumnBreak();\n    }\n}\nvoid ConsoleReporter::benchmarkEnded(BenchmarkStats const& stats) {\n    Duration average(stats.elapsedTimeInNanoseconds / stats.iterations);\n    (*m_tablePrinter)\n        << stats.iterations << ColumnBreak()\n        << stats.elapsedTimeInNanoseconds << ColumnBreak()\n        << average << ColumnBreak();\n}\n\nvoid ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) {\n    m_tablePrinter->close();\n    StreamingReporterBase::testCaseEnded(_testCaseStats);\n    m_headerPrinted = false;\n}\nvoid ConsoleReporter::testGroupEnded(TestGroupStats const& _testGroupStats) {\n    if (currentGroupInfo.used) {\n        printSummaryDivider();\n        stream << \"Summary for group '\" << _testGroupStats.groupInfo.name << \"':\\n\";\n        printTotals(_testGroupStats.totals);\n        stream << '\\n' << std::endl;\n    }\n    StreamingReporterBase::testGroupEnded(_testGroupStats);\n}\nvoid ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {\n    printTotalsDivider(_testRunStats.totals);\n    printTotals(_testRunStats.totals);\n    stream << std::endl;\n    StreamingReporterBase::testRunEnded(_testRunStats);\n}\n\nvoid ConsoleReporter::lazyPrint() {\n\n    m_tablePrinter->close();\n    lazyPrintWithoutClosingBenchmarkTable();\n}\n\nvoid ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() {\n\n    if (!currentTestRunInfo.used)\n        lazyPrintRunInfo();\n    if (!currentGroupInfo.used)\n        lazyPrintGroupInfo();\n\n    if (!m_headerPrinted) {\n        printTestCaseAndSectionHeader();\n        m_headerPrinted = true;\n    }\n}\nvoid ConsoleReporter::lazyPrintRunInfo() {\n    stream << '\\n' << getLineOfChars<'~'>() << '\\n';\n    Colour colour(Colour::SecondaryText);\n    stream << currentTestRunInfo->name\n        << \" is a Catch v\" << libraryVersion() << \" host application.\\n\"\n        << \"Run with -? for options\\n\\n\";\n\n    if (m_config->rngSeed() != 0)\n        stream << \"Randomness seeded to: \" << m_config->rngSeed() << \"\\n\\n\";\n\n    currentTestRunInfo.used = true;\n}\nvoid ConsoleReporter::lazyPrintGroupInfo() {\n    if (!currentGroupInfo->name.empty() && currentGroupInfo->groupsCounts > 1) {\n        printClosedHeader(\"Group: \" + currentGroupInfo->name);\n        currentGroupInfo.used = true;\n    }\n}\nvoid ConsoleReporter::printTestCaseAndSectionHeader() {\n    assert(!m_sectionStack.empty());\n    printOpenHeader(currentTestCaseInfo->name);\n\n    if (m_sectionStack.size() > 1) {\n        Colour colourGuard(Colour::Headers);\n\n        auto\n            it = m_sectionStack.begin() + 1, // Skip first section (test case)\n            itEnd = m_sectionStack.end();\n        for (; it != itEnd; ++it)\n            printHeaderString(it->name, 2);\n    }\n\n    SourceLineInfo lineInfo = m_sectionStack.back().lineInfo;\n\n    if (!lineInfo.empty()) {\n        stream << getLineOfChars<'-'>() << '\\n';\n        Colour colourGuard(Colour::FileName);\n        stream << lineInfo << '\\n';\n    }\n    stream << getLineOfChars<'.'>() << '\\n' << std::endl;\n}\n\nvoid ConsoleReporter::printClosedHeader(std::string const& _name) {\n    printOpenHeader(_name);\n    stream << getLineOfChars<'.'>() << '\\n';\n}\nvoid ConsoleReporter::printOpenHeader(std::string const& _name) {\n    stream << getLineOfChars<'-'>() << '\\n';\n    {\n        Colour colourGuard(Colour::Headers);\n        printHeaderString(_name);\n    }\n}\n\n// if string has a : in first line will set indent to follow it on\n// subsequent lines\nvoid ConsoleReporter::printHeaderString(std::string const& _string, std::size_t indent) {\n    std::size_t i = _string.find(\": \");\n    if (i != std::string::npos)\n        i += 2;\n    else\n        i = 0;\n    stream << Column(_string).indent(indent + i).initialIndent(indent) << '\\n';\n}\n\nstruct SummaryColumn {\n\n    SummaryColumn( std::string _label, Colour::Code _colour )\n    :   label( std::move( _label ) ),\n        colour( _colour ) {}\n    SummaryColumn addRow( std::size_t count ) {\n        ReusableStringStream rss;\n        rss << count;\n        std::string row = rss.str();\n        for (auto& oldRow : rows) {\n            while (oldRow.size() < row.size())\n                oldRow = ' ' + oldRow;\n            while (oldRow.size() > row.size())\n                row = ' ' + row;\n        }\n        rows.push_back(row);\n        return *this;\n    }\n\n    std::string label;\n    Colour::Code colour;\n    std::vector<std::string> rows;\n\n};\n\nvoid ConsoleReporter::printTotals( Totals const& totals ) {\n    if (totals.testCases.total() == 0) {\n        stream << Colour(Colour::Warning) << \"No tests ran\\n\";\n    } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) {\n        stream << Colour(Colour::ResultSuccess) << \"All tests passed\";\n        stream << \" (\"\n            << pluralise(totals.assertions.passed, \"assertion\") << \" in \"\n            << pluralise(totals.testCases.passed, \"test case\") << ')'\n            << '\\n';\n    } else {\n\n        std::vector<SummaryColumn> columns;\n        columns.push_back(SummaryColumn(\"\", Colour::None)\n                          .addRow(totals.testCases.total())\n                          .addRow(totals.assertions.total()));\n        columns.push_back(SummaryColumn(\"passed\", Colour::Success)\n                          .addRow(totals.testCases.passed)\n                          .addRow(totals.assertions.passed));\n        columns.push_back(SummaryColumn(\"failed\", Colour::ResultError)\n                          .addRow(totals.testCases.failed)\n                          .addRow(totals.assertions.failed));\n        columns.push_back(SummaryColumn(\"failed as expected\", Colour::ResultExpectedFailure)\n                          .addRow(totals.testCases.failedButOk)\n                          .addRow(totals.assertions.failedButOk));\n\n        printSummaryRow(\"test cases\", columns, 0);\n        printSummaryRow(\"assertions\", columns, 1);\n    }\n}\nvoid ConsoleReporter::printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row) {\n    for (auto col : cols) {\n        std::string value = col.rows[row];\n        if (col.label.empty()) {\n            stream << label << \": \";\n            if (value != \"0\")\n                stream << value;\n            else\n                stream << Colour(Colour::Warning) << \"- none -\";\n        } else if (value != \"0\") {\n            stream << Colour(Colour::LightGrey) << \" | \";\n            stream << Colour(col.colour)\n                << value << ' ' << col.label;\n        }\n    }\n    stream << '\\n';\n}\n\nvoid ConsoleReporter::printTotalsDivider(Totals const& totals) {\n    if (totals.testCases.total() > 0) {\n        std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total());\n        std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total());\n        std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total());\n        while (failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1)\n            findMax(failedRatio, failedButOkRatio, passedRatio)++;\n        while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1)\n            findMax(failedRatio, failedButOkRatio, passedRatio)--;\n\n        stream << Colour(Colour::Error) << std::string(failedRatio, '=');\n        stream << Colour(Colour::ResultExpectedFailure) << std::string(failedButOkRatio, '=');\n        if (totals.testCases.allPassed())\n            stream << Colour(Colour::ResultSuccess) << std::string(passedRatio, '=');\n        else\n            stream << Colour(Colour::Success) << std::string(passedRatio, '=');\n    } else {\n        stream << Colour(Colour::Warning) << std::string(CATCH_CONFIG_CONSOLE_WIDTH - 1, '=');\n    }\n    stream << '\\n';\n}\nvoid ConsoleReporter::printSummaryDivider() {\n    stream << getLineOfChars<'-'>() << '\\n';\n}\n\nCATCH_REGISTER_REPORTER(\"console\", ConsoleReporter)\n\n} // end namespace Catch\n\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n// end catch_reporter_console.cpp\n// start catch_reporter_junit.cpp\n\n#include <assert.h>\n#include <sstream>\n#include <ctime>\n#include <algorithm>\n\nnamespace Catch {\n\n    namespace {\n        std::string getCurrentTimestamp() {\n            // Beware, this is not reentrant because of backward compatibility issues\n            // Also, UTC only, again because of backward compatibility (%z is C++11)\n            time_t rawtime;\n            std::time(&rawtime);\n            auto const timeStampSize = sizeof(\"2017-01-16T17:06:45Z\");\n\n#ifdef _MSC_VER\n            std::tm timeInfo = {};\n            gmtime_s(&timeInfo, &rawtime);\n#else\n            std::tm* timeInfo;\n            timeInfo = std::gmtime(&rawtime);\n#endif\n\n            char timeStamp[timeStampSize];\n            const char * const fmt = \"%Y-%m-%dT%H:%M:%SZ\";\n\n#ifdef _MSC_VER\n            std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);\n#else\n            std::strftime(timeStamp, timeStampSize, fmt, timeInfo);\n#endif\n            return std::string(timeStamp);\n        }\n\n        std::string fileNameTag(const std::vector<std::string> &tags) {\n            auto it = std::find_if(begin(tags),\n                                   end(tags),\n                                   [] (std::string const& tag) {return tag.front() == '#'; });\n            if (it != tags.end())\n                return it->substr(1);\n            return std::string();\n        }\n    } // anonymous namespace\n\n    JunitReporter::JunitReporter( ReporterConfig const& _config )\n        :   CumulativeReporterBase( _config ),\n            xml( _config.stream() )\n        {\n            m_reporterPrefs.shouldRedirectStdOut = true;\n        }\n\n    JunitReporter::~JunitReporter() {};\n\n    std::string JunitReporter::getDescription() {\n        return \"Reports test results in an XML format that looks like Ant's junitreport target\";\n    }\n\n    void JunitReporter::noMatchingTestCases( std::string const& /*spec*/ ) {}\n\n    void JunitReporter::testRunStarting( TestRunInfo const& runInfo )  {\n        CumulativeReporterBase::testRunStarting( runInfo );\n        xml.startElement( \"testsuites\" );\n    }\n\n    void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) {\n        suiteTimer.start();\n        stdOutForSuite.clear();\n        stdErrForSuite.clear();\n        unexpectedExceptions = 0;\n        CumulativeReporterBase::testGroupStarting( groupInfo );\n    }\n\n    void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) {\n        m_okToFail = testCaseInfo.okToFail();\n    }\n\n    bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) {\n        if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )\n            unexpectedExceptions++;\n        return CumulativeReporterBase::assertionEnded( assertionStats );\n    }\n\n    void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {\n        stdOutForSuite += testCaseStats.stdOut;\n        stdErrForSuite += testCaseStats.stdErr;\n        CumulativeReporterBase::testCaseEnded( testCaseStats );\n    }\n\n    void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {\n        double suiteTime = suiteTimer.getElapsedSeconds();\n        CumulativeReporterBase::testGroupEnded( testGroupStats );\n        writeGroup( *m_testGroups.back(), suiteTime );\n    }\n\n    void JunitReporter::testRunEndedCumulative() {\n        xml.endElement();\n    }\n\n    void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) {\n        XmlWriter::ScopedElement e = xml.scopedElement( \"testsuite\" );\n        TestGroupStats const& stats = groupNode.value;\n        xml.writeAttribute( \"name\", stats.groupInfo.name );\n        xml.writeAttribute( \"errors\", unexpectedExceptions );\n        xml.writeAttribute( \"failures\", stats.totals.assertions.failed-unexpectedExceptions );\n        xml.writeAttribute( \"tests\", stats.totals.assertions.total() );\n        xml.writeAttribute( \"hostname\", \"tbd\" ); // !TBD\n        if( m_config->showDurations() == ShowDurations::Never )\n            xml.writeAttribute( \"time\", \"\" );\n        else\n            xml.writeAttribute( \"time\", suiteTime );\n        xml.writeAttribute( \"timestamp\", getCurrentTimestamp() );\n\n        // Write test cases\n        for( auto const& child : groupNode.children )\n            writeTestCase( *child );\n\n        xml.scopedElement( \"system-out\" ).writeText( trim( stdOutForSuite ), false );\n        xml.scopedElement( \"system-err\" ).writeText( trim( stdErrForSuite ), false );\n    }\n\n    void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) {\n        TestCaseStats const& stats = testCaseNode.value;\n\n        // All test cases have exactly one section - which represents the\n        // test case itself. That section may have 0-n nested sections\n        assert( testCaseNode.children.size() == 1 );\n        SectionNode const& rootSection = *testCaseNode.children.front();\n\n        std::string className = stats.testInfo.className;\n\n        if( className.empty() ) {\n            className = fileNameTag(stats.testInfo.tags);\n            if ( className.empty() )\n                className = \"global\";\n        }\n\n        if ( !m_config->name().empty() )\n            className = m_config->name() + \".\" + className;\n\n        writeSection( className, \"\", rootSection );\n    }\n\n    void JunitReporter::writeSection(  std::string const& className,\n                        std::string const& rootName,\n                        SectionNode const& sectionNode ) {\n        std::string name = trim( sectionNode.stats.sectionInfo.name );\n        if( !rootName.empty() )\n            name = rootName + '/' + name;\n\n        if( !sectionNode.assertions.empty() ||\n            !sectionNode.stdOut.empty() ||\n            !sectionNode.stdErr.empty() ) {\n            XmlWriter::ScopedElement e = xml.scopedElement( \"testcase\" );\n            if( className.empty() ) {\n                xml.writeAttribute( \"classname\", name );\n                xml.writeAttribute( \"name\", \"root\" );\n            }\n            else {\n                xml.writeAttribute( \"classname\", className );\n                xml.writeAttribute( \"name\", name );\n            }\n            xml.writeAttribute( \"time\", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) );\n\n            writeAssertions( sectionNode );\n\n            if( !sectionNode.stdOut.empty() )\n                xml.scopedElement( \"system-out\" ).writeText( trim( sectionNode.stdOut ), false );\n            if( !sectionNode.stdErr.empty() )\n                xml.scopedElement( \"system-err\" ).writeText( trim( sectionNode.stdErr ), false );\n        }\n        for( auto const& childNode : sectionNode.childSections )\n            if( className.empty() )\n                writeSection( name, \"\", *childNode );\n            else\n                writeSection( className, name, *childNode );\n    }\n\n    void JunitReporter::writeAssertions( SectionNode const& sectionNode ) {\n        for( auto const& assertion : sectionNode.assertions )\n            writeAssertion( assertion );\n    }\n\n    void JunitReporter::writeAssertion( AssertionStats const& stats ) {\n        AssertionResult const& result = stats.assertionResult;\n        if( !result.isOk() ) {\n            std::string elementName;\n            switch( result.getResultType() ) {\n                case ResultWas::ThrewException:\n                case ResultWas::FatalErrorCondition:\n                    elementName = \"error\";\n                    break;\n                case ResultWas::ExplicitFailure:\n                    elementName = \"failure\";\n                    break;\n                case ResultWas::ExpressionFailed:\n                    elementName = \"failure\";\n                    break;\n                case ResultWas::DidntThrowException:\n                    elementName = \"failure\";\n                    break;\n\n                // We should never see these here:\n                case ResultWas::Info:\n                case ResultWas::Warning:\n                case ResultWas::Ok:\n                case ResultWas::Unknown:\n                case ResultWas::FailureBit:\n                case ResultWas::Exception:\n                    elementName = \"internalError\";\n                    break;\n            }\n\n            XmlWriter::ScopedElement e = xml.scopedElement( elementName );\n\n            xml.writeAttribute( \"message\", result.getExpandedExpression() );\n            xml.writeAttribute( \"type\", result.getTestMacroName() );\n\n            ReusableStringStream rss;\n            if( !result.getMessage().empty() )\n                rss << result.getMessage() << '\\n';\n            for( auto const& msg : stats.infoMessages )\n                if( msg.type == ResultWas::Info )\n                    rss << msg.message << '\\n';\n\n            rss << \"at \" << result.getSourceInfo();\n            xml.writeText( rss.str(), false );\n        }\n    }\n\n    CATCH_REGISTER_REPORTER( \"junit\", JunitReporter )\n\n} // end namespace Catch\n// end catch_reporter_junit.cpp\n// start catch_reporter_multi.cpp\n\nnamespace Catch {\n\n    void MultipleReporters::add( IStreamingReporterPtr&& reporter ) {\n        m_reporters.push_back( std::move( reporter ) );\n    }\n\n    ReporterPreferences MultipleReporters::getPreferences() const {\n        return m_reporters[0]->getPreferences();\n    }\n\n    std::set<Verbosity> MultipleReporters::getSupportedVerbosities() {\n        return std::set<Verbosity>{ };\n    }\n\n    void MultipleReporters::noMatchingTestCases( std::string const& spec ) {\n        for( auto const& reporter : m_reporters )\n            reporter->noMatchingTestCases( spec );\n    }\n\n    void MultipleReporters::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {\n        for( auto const& reporter : m_reporters )\n            reporter->benchmarkStarting( benchmarkInfo );\n    }\n    void MultipleReporters::benchmarkEnded( BenchmarkStats const& benchmarkStats ) {\n        for( auto const& reporter : m_reporters )\n            reporter->benchmarkEnded( benchmarkStats );\n    }\n\n    void MultipleReporters::testRunStarting( TestRunInfo const& testRunInfo ) {\n        for( auto const& reporter : m_reporters )\n            reporter->testRunStarting( testRunInfo );\n    }\n\n    void MultipleReporters::testGroupStarting( GroupInfo const& groupInfo ) {\n        for( auto const& reporter : m_reporters )\n            reporter->testGroupStarting( groupInfo );\n    }\n\n    void MultipleReporters::testCaseStarting( TestCaseInfo const& testInfo ) {\n        for( auto const& reporter : m_reporters )\n            reporter->testCaseStarting( testInfo );\n    }\n\n    void MultipleReporters::sectionStarting( SectionInfo const& sectionInfo ) {\n        for( auto const& reporter : m_reporters )\n            reporter->sectionStarting( sectionInfo );\n    }\n\n    void MultipleReporters::assertionStarting( AssertionInfo const& assertionInfo ) {\n        for( auto const& reporter : m_reporters )\n            reporter->assertionStarting( assertionInfo );\n    }\n\n    // The return value indicates if the messages buffer should be cleared:\n    bool MultipleReporters::assertionEnded( AssertionStats const& assertionStats ) {\n        bool clearBuffer = false;\n        for( auto const& reporter : m_reporters )\n            clearBuffer |= reporter->assertionEnded( assertionStats );\n        return clearBuffer;\n    }\n\n    void MultipleReporters::sectionEnded( SectionStats const& sectionStats ) {\n        for( auto const& reporter : m_reporters )\n            reporter->sectionEnded( sectionStats );\n    }\n\n    void MultipleReporters::testCaseEnded( TestCaseStats const& testCaseStats ) {\n        for( auto const& reporter : m_reporters )\n            reporter->testCaseEnded( testCaseStats );\n    }\n\n    void MultipleReporters::testGroupEnded( TestGroupStats const& testGroupStats ) {\n        for( auto const& reporter : m_reporters )\n            reporter->testGroupEnded( testGroupStats );\n    }\n\n    void MultipleReporters::testRunEnded( TestRunStats const& testRunStats ) {\n        for( auto const& reporter : m_reporters )\n            reporter->testRunEnded( testRunStats );\n    }\n\n    void MultipleReporters::skipTest( TestCaseInfo const& testInfo ) {\n        for( auto const& reporter : m_reporters )\n            reporter->skipTest( testInfo );\n    }\n\n    bool MultipleReporters::isMulti() const {\n        return true;\n    }\n\n} // end namespace Catch\n// end catch_reporter_multi.cpp\n// start catch_reporter_xml.cpp\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch\n                              // Note that 4062 (not all labels are handled\n                              // and default is missing) is enabled\n#endif\n\nnamespace Catch {\n    XmlReporter::XmlReporter( ReporterConfig const& _config )\n    :   StreamingReporterBase( _config ),\n        m_xml(_config.stream())\n    {\n        m_reporterPrefs.shouldRedirectStdOut = true;\n    }\n\n    XmlReporter::~XmlReporter() = default;\n\n    std::string XmlReporter::getDescription() {\n        return \"Reports test results as an XML document\";\n    }\n\n    std::string XmlReporter::getStylesheetRef() const {\n        return std::string();\n    }\n\n    void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) {\n        m_xml\n            .writeAttribute( \"filename\", sourceInfo.file )\n            .writeAttribute( \"line\", sourceInfo.line );\n    }\n\n    void XmlReporter::noMatchingTestCases( std::string const& s ) {\n        StreamingReporterBase::noMatchingTestCases( s );\n    }\n\n    void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) {\n        StreamingReporterBase::testRunStarting( testInfo );\n        std::string stylesheetRef = getStylesheetRef();\n        if( !stylesheetRef.empty() )\n            m_xml.writeStylesheetRef( stylesheetRef );\n        m_xml.startElement( \"Catch\" );\n        if( !m_config->name().empty() )\n            m_xml.writeAttribute( \"name\", m_config->name() );\n    }\n\n    void XmlReporter::testGroupStarting( GroupInfo const& groupInfo ) {\n        StreamingReporterBase::testGroupStarting( groupInfo );\n        m_xml.startElement( \"Group\" )\n            .writeAttribute( \"name\", groupInfo.name );\n    }\n\n    void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) {\n        StreamingReporterBase::testCaseStarting(testInfo);\n        m_xml.startElement( \"TestCase\" )\n            .writeAttribute( \"name\", trim( testInfo.name ) )\n            .writeAttribute( \"description\", testInfo.description )\n            .writeAttribute( \"tags\", testInfo.tagsAsString() );\n\n        writeSourceInfo( testInfo.lineInfo );\n\n        if ( m_config->showDurations() == ShowDurations::Always )\n            m_testCaseTimer.start();\n        m_xml.ensureTagClosed();\n    }\n\n    void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) {\n        StreamingReporterBase::sectionStarting( sectionInfo );\n        if( m_sectionDepth++ > 0 ) {\n            m_xml.startElement( \"Section\" )\n                .writeAttribute( \"name\", trim( sectionInfo.name ) )\n                .writeAttribute( \"description\", sectionInfo.description );\n            writeSourceInfo( sectionInfo.lineInfo );\n            m_xml.ensureTagClosed();\n        }\n    }\n\n    void XmlReporter::assertionStarting( AssertionInfo const& ) { }\n\n    bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) {\n\n        AssertionResult const& result = assertionStats.assertionResult;\n\n        bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();\n\n        if( includeResults || result.getResultType() == ResultWas::Warning ) {\n            // Print any info messages in <Info> tags.\n            for( auto const& msg : assertionStats.infoMessages ) {\n                if( msg.type == ResultWas::Info && includeResults ) {\n                    m_xml.scopedElement( \"Info\" )\n                            .writeText( msg.message );\n                } else if ( msg.type == ResultWas::Warning ) {\n                    m_xml.scopedElement( \"Warning\" )\n                            .writeText( msg.message );\n                }\n            }\n        }\n\n        // Drop out if result was successful but we're not printing them.\n        if( !includeResults && result.getResultType() != ResultWas::Warning )\n            return true;\n\n        // Print the expression if there is one.\n        if( result.hasExpression() ) {\n            m_xml.startElement( \"Expression\" )\n                .writeAttribute( \"success\", result.succeeded() )\n                .writeAttribute( \"type\", result.getTestMacroName() );\n\n            writeSourceInfo( result.getSourceInfo() );\n\n            m_xml.scopedElement( \"Original\" )\n                .writeText( result.getExpression() );\n            m_xml.scopedElement( \"Expanded\" )\n                .writeText( result.getExpandedExpression() );\n        }\n\n        // And... Print a result applicable to each result type.\n        switch( result.getResultType() ) {\n            case ResultWas::ThrewException:\n                m_xml.startElement( \"Exception\" );\n                writeSourceInfo( result.getSourceInfo() );\n                m_xml.writeText( result.getMessage() );\n                m_xml.endElement();\n                break;\n            case ResultWas::FatalErrorCondition:\n                m_xml.startElement( \"FatalErrorCondition\" );\n                writeSourceInfo( result.getSourceInfo() );\n                m_xml.writeText( result.getMessage() );\n                m_xml.endElement();\n                break;\n            case ResultWas::Info:\n                m_xml.scopedElement( \"Info\" )\n                    .writeText( result.getMessage() );\n                break;\n            case ResultWas::Warning:\n                // Warning will already have been written\n                break;\n            case ResultWas::ExplicitFailure:\n                m_xml.startElement( \"Failure\" );\n                writeSourceInfo( result.getSourceInfo() );\n                m_xml.writeText( result.getMessage() );\n                m_xml.endElement();\n                break;\n            default:\n                break;\n        }\n\n        if( result.hasExpression() )\n            m_xml.endElement();\n\n        return true;\n    }\n\n    void XmlReporter::sectionEnded( SectionStats const& sectionStats ) {\n        StreamingReporterBase::sectionEnded( sectionStats );\n        if( --m_sectionDepth > 0 ) {\n            XmlWriter::ScopedElement e = m_xml.scopedElement( \"OverallResults\" );\n            e.writeAttribute( \"successes\", sectionStats.assertions.passed );\n            e.writeAttribute( \"failures\", sectionStats.assertions.failed );\n            e.writeAttribute( \"expectedFailures\", sectionStats.assertions.failedButOk );\n\n            if ( m_config->showDurations() == ShowDurations::Always )\n                e.writeAttribute( \"durationInSeconds\", sectionStats.durationInSeconds );\n\n            m_xml.endElement();\n        }\n    }\n\n    void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {\n        StreamingReporterBase::testCaseEnded( testCaseStats );\n        XmlWriter::ScopedElement e = m_xml.scopedElement( \"OverallResult\" );\n        e.writeAttribute( \"success\", testCaseStats.totals.assertions.allOk() );\n\n        if ( m_config->showDurations() == ShowDurations::Always )\n            e.writeAttribute( \"durationInSeconds\", m_testCaseTimer.getElapsedSeconds() );\n\n        if( !testCaseStats.stdOut.empty() )\n            m_xml.scopedElement( \"StdOut\" ).writeText( trim( testCaseStats.stdOut ), false );\n        if( !testCaseStats.stdErr.empty() )\n            m_xml.scopedElement( \"StdErr\" ).writeText( trim( testCaseStats.stdErr ), false );\n\n        m_xml.endElement();\n    }\n\n    void XmlReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {\n        StreamingReporterBase::testGroupEnded( testGroupStats );\n        // TODO: Check testGroupStats.aborting and act accordingly.\n        m_xml.scopedElement( \"OverallResults\" )\n            .writeAttribute( \"successes\", testGroupStats.totals.assertions.passed )\n            .writeAttribute( \"failures\", testGroupStats.totals.assertions.failed )\n            .writeAttribute( \"expectedFailures\", testGroupStats.totals.assertions.failedButOk );\n        m_xml.endElement();\n    }\n\n    void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) {\n        StreamingReporterBase::testRunEnded( testRunStats );\n        m_xml.scopedElement( \"OverallResults\" )\n            .writeAttribute( \"successes\", testRunStats.totals.assertions.passed )\n            .writeAttribute( \"failures\", testRunStats.totals.assertions.failed )\n            .writeAttribute( \"expectedFailures\", testRunStats.totals.assertions.failedButOk );\n        m_xml.endElement();\n    }\n\n    CATCH_REGISTER_REPORTER( \"xml\", XmlReporter )\n\n} // end namespace Catch\n\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n// end catch_reporter_xml.cpp\n\nnamespace Catch {\n    LeakDetector leakDetector;\n}\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n// end catch_impl.hpp\n#endif\n\n#ifdef CATCH_CONFIG_MAIN\n// start catch_default_main.hpp\n\n#ifndef __OBJC__\n\n#if defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)\n// Standard C/C++ Win32 Unicode wmain entry point\nextern \"C\" int wmain (int argc, wchar_t * argv[], wchar_t * []) {\n#else\n// Standard C/C++ main entry point\nint main (int argc, char * argv[]) {\n#endif\n\n    return Catch::Session().run( argc, argv );\n}\n\n#else // __OBJC__\n\n// Objective-C entry point\nint main (int argc, char * const argv[]) {\n#if !CATCH_ARC_ENABLED\n    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];\n#endif\n\n    Catch::registerTestMethods();\n    int result = Catch::Session().run( argc, (char**)argv );\n\n#if !CATCH_ARC_ENABLED\n    [pool drain];\n#endif\n\n    return result;\n}\n\n#endif // __OBJC__\n\n// end catch_default_main.hpp\n#endif\n\n#if !defined(CATCH_CONFIG_IMPL_ONLY)\n\n#ifdef CLARA_CONFIG_MAIN_NOT_DEFINED\n#  undef CLARA_CONFIG_MAIN\n#endif\n\n#if !defined(CATCH_CONFIG_DISABLE)\n//////\n// If this config identifier is defined then all CATCH macros are prefixed with CATCH_\n#ifdef CATCH_CONFIG_PREFIX_ALL\n\n#define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( \"CATCH_REQUIRE\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n#define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( \"CATCH_REQUIRE_FALSE\", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n\n#define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( \"CATCH_REQUIRE_THROWS\", Catch::ResultDisposition::Normal, \"\", __VA_ARGS__ )\n#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"CATCH_REQUIRE_THROWS_AS\", exceptionType, Catch::ResultDisposition::Normal, expr )\n#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"CATCH_REQUIRE_THROWS_WITH\", Catch::ResultDisposition::Normal, matcher, expr )\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"CATCH_REQUIRE_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )\n#endif// CATCH_CONFIG_DISABLE_MATCHERS\n#define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"CATCH_REQUIRE_NOTHROW\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n\n#define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( \"CATCH_CHECK\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( \"CATCH_CHECK_FALSE\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n#define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( \"CATCH_CHECKED_IF\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( \"CATCH_CHECKED_ELSE\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( \"CATCH_CHECK_NOFAIL\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )\n\n#define CATCH_CHECK_THROWS( ... )  INTERNAL_CATCH_THROWS( \"CATCH_CHECK_THROWS\", Catch::ResultDisposition::ContinueOnFailure, \"\", __VA_ARGS__ )\n#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"CATCH_CHECK_THROWS_AS\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )\n#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"CATCH_CHECK_THROWS_WITH\", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"CATCH_CHECK_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"CATCH_CHECK_NOTHROW\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"CATCH_CHECK_THAT\", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )\n\n#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"CATCH_REQUIRE_THAT\", matcher, Catch::ResultDisposition::Normal, arg )\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n\n#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( \"CATCH_INFO\", msg )\n#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( \"CATCH_WARN\", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )\n#define CATCH_CAPTURE( msg ) INTERNAL_CATCH_INFO( \"CATCH_CAPTURE\", #msg \" := \" << ::Catch::Detail::stringify(msg) )\n\n#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )\n#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )\n#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )\n#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )\n#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( \"CATCH_FAIL\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )\n#define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( \"CATCH_FAIL_CHECK\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( \"CATCH_SUCCEED\", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n\n#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()\n\n// \"BDD-style\" convenience wrappers\n#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( \"Scenario: \" __VA_ARGS__ )\n#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, \"Scenario: \" __VA_ARGS__ )\n#define CATCH_GIVEN( desc )    CATCH_SECTION( std::string( \"Given: \") + desc )\n#define CATCH_WHEN( desc )     CATCH_SECTION( std::string( \" When: \") + desc )\n#define CATCH_AND_WHEN( desc ) CATCH_SECTION( std::string( \"  And: \") + desc )\n#define CATCH_THEN( desc )     CATCH_SECTION( std::string( \" Then: \") + desc )\n#define CATCH_AND_THEN( desc ) CATCH_SECTION( std::string( \"  And: \") + desc )\n\n// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required\n#else\n\n#define REQUIRE( ... ) INTERNAL_CATCH_TEST( \"REQUIRE\", Catch::ResultDisposition::Normal, __VA_ARGS__  )\n#define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( \"REQUIRE_FALSE\", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n\n#define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( \"REQUIRE_THROWS\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"REQUIRE_THROWS_AS\", exceptionType, Catch::ResultDisposition::Normal, expr )\n#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"REQUIRE_THROWS_WITH\", Catch::ResultDisposition::Normal, matcher, expr )\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"REQUIRE_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"REQUIRE_NOTHROW\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n\n#define CHECK( ... ) INTERNAL_CATCH_TEST( \"CHECK\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( \"CHECK_FALSE\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n#define CHECKED_IF( ... ) INTERNAL_CATCH_IF( \"CHECKED_IF\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( \"CHECKED_ELSE\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( \"CHECK_NOFAIL\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )\n\n#define CHECK_THROWS( ... )  INTERNAL_CATCH_THROWS( \"CHECK_THROWS\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"CHECK_THROWS_AS\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )\n#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"CHECK_THROWS_WITH\", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"CHECK_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"CHECK_NOTHROW\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"CHECK_THAT\", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )\n\n#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"REQUIRE_THAT\", matcher, Catch::ResultDisposition::Normal, arg )\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n\n#define INFO( msg ) INTERNAL_CATCH_INFO( \"INFO\", msg )\n#define WARN( msg ) INTERNAL_CATCH_MSG( \"WARN\", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )\n#define CAPTURE( msg ) INTERNAL_CATCH_INFO( \"CAPTURE\", #msg \" := \" << ::Catch::Detail::stringify(msg) )\n\n#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )\n#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )\n#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )\n#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )\n#define FAIL( ... ) INTERNAL_CATCH_MSG( \"FAIL\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )\n#define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( \"FAIL_CHECK\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define SUCCEED( ... ) INTERNAL_CATCH_MSG( \"SUCCEED\", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()\n\n#endif\n\n#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )\n\n// \"BDD-style\" convenience wrappers\n#define SCENARIO( ... ) TEST_CASE( \"Scenario: \" __VA_ARGS__ )\n#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, \"Scenario: \" __VA_ARGS__ )\n\n#define GIVEN( desc )    SECTION( std::string(\"   Given: \") + desc )\n#define WHEN( desc )     SECTION( std::string(\"    When: \") + desc )\n#define AND_WHEN( desc ) SECTION( std::string(\"And when: \") + desc )\n#define THEN( desc )     SECTION( std::string(\"    Then: \") + desc )\n#define AND_THEN( desc ) SECTION( std::string(\"     And: \") + desc )\n\nusing Catch::Detail::Approx;\n\n#else\n//////\n// If this config identifier is defined then all CATCH macros are prefixed with CATCH_\n#ifdef CATCH_CONFIG_PREFIX_ALL\n\n#define CATCH_REQUIRE( ... )        (void)(0)\n#define CATCH_REQUIRE_FALSE( ... )  (void)(0)\n\n#define CATCH_REQUIRE_THROWS( ... ) (void)(0)\n#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)\n#define CATCH_REQUIRE_THROWS_WITH( expr, matcher )     (void)(0)\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)\n#endif// CATCH_CONFIG_DISABLE_MATCHERS\n#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0)\n\n#define CATCH_CHECK( ... )         (void)(0)\n#define CATCH_CHECK_FALSE( ... )   (void)(0)\n#define CATCH_CHECKED_IF( ... )    if (__VA_ARGS__)\n#define CATCH_CHECKED_ELSE( ... )  if (!(__VA_ARGS__))\n#define CATCH_CHECK_NOFAIL( ... )  (void)(0)\n\n#define CATCH_CHECK_THROWS( ... )  (void)(0)\n#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0)\n#define CATCH_CHECK_THROWS_WITH( expr, matcher )     (void)(0)\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define CATCH_CHECK_NOTHROW( ... ) (void)(0)\n\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_CHECK_THAT( arg, matcher )   (void)(0)\n\n#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0)\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n\n#define CATCH_INFO( msg )    (void)(0)\n#define CATCH_WARN( msg )    (void)(0)\n#define CATCH_CAPTURE( msg ) (void)(0)\n\n#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))\n#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))\n#define CATCH_METHOD_AS_TEST_CASE( method, ... )\n#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)\n#define CATCH_SECTION( ... )\n#define CATCH_FAIL( ... ) (void)(0)\n#define CATCH_FAIL_CHECK( ... ) (void)(0)\n#define CATCH_SUCCEED( ... ) (void)(0)\n\n#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))\n\n// \"BDD-style\" convenience wrappers\n#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))\n#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )\n#define CATCH_GIVEN( desc )\n#define CATCH_WHEN( desc )\n#define CATCH_AND_WHEN( desc )\n#define CATCH_THEN( desc )\n#define CATCH_AND_THEN( desc )\n\n// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required\n#else\n\n#define REQUIRE( ... )       (void)(0)\n#define REQUIRE_FALSE( ... ) (void)(0)\n\n#define REQUIRE_THROWS( ... ) (void)(0)\n#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)\n#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define REQUIRE_NOTHROW( ... ) (void)(0)\n\n#define CHECK( ... ) (void)(0)\n#define CHECK_FALSE( ... ) (void)(0)\n#define CHECKED_IF( ... ) if (__VA_ARGS__)\n#define CHECKED_ELSE( ... ) if (!(__VA_ARGS__))\n#define CHECK_NOFAIL( ... ) (void)(0)\n\n#define CHECK_THROWS( ... )  (void)(0)\n#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0)\n#define CHECK_THROWS_WITH( expr, matcher ) (void)(0)\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define CHECK_NOTHROW( ... ) (void)(0)\n\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CHECK_THAT( arg, matcher ) (void)(0)\n\n#define REQUIRE_THAT( arg, matcher ) (void)(0)\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n\n#define INFO( msg ) (void)(0)\n#define WARN( msg ) (void)(0)\n#define CAPTURE( msg ) (void)(0)\n\n#define TEST_CASE( ... )  INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))\n#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))\n#define METHOD_AS_TEST_CASE( method, ... )\n#define REGISTER_TEST_CASE( Function, ... ) (void)(0)\n#define SECTION( ... )\n#define FAIL( ... ) (void)(0)\n#define FAIL_CHECK( ... ) (void)(0)\n#define SUCCEED( ... ) (void)(0)\n#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))\n\n#endif\n\n#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )\n\n// \"BDD-style\" convenience wrappers\n#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) )\n#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className )\n\n#define GIVEN( desc )\n#define WHEN( desc )\n#define AND_WHEN( desc )\n#define THEN( desc )\n#define AND_THEN( desc )\n\nusing Catch::Detail::Approx;\n\n#endif\n\n#endif // ! CATCH_CONFIG_IMPL_ONLY\n\n// start catch_reenable_warnings.h\n\n\n#ifdef __clang__\n#    ifdef __ICC // icpc defines the __clang__ macro\n#        pragma warning(pop)\n#    else\n#        pragma clang diagnostic pop\n#    endif\n#elif defined __GNUC__\n#    pragma GCC diagnostic pop\n#endif\n\n// end catch_reenable_warnings.h\n// end catch.hpp\n#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n"
  }
]