mirror of
https://github.com/BlackMATov/invoke.hpp.git
synced 2025-12-13 05:56:31 +07:00
Merge branch 'dev' into main
This commit is contained in:
@@ -7,34 +7,17 @@ platform:
|
||||
- x64
|
||||
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
|
||||
for:
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- platform: x86
|
||||
configuration: Debug
|
||||
build_script:
|
||||
- scripts\build_debug_x86.bat
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- platform: x64
|
||||
configuration: Debug
|
||||
build_script:
|
||||
- scripts\build_debug_x64.bat
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- platform: x86
|
||||
configuration: Release
|
||||
build_script:
|
||||
- scripts\build_release_x86.bat
|
||||
- .ci\build_windows_x86.bat
|
||||
|
||||
-
|
||||
matrix:
|
||||
@@ -42,4 +25,4 @@ for:
|
||||
- platform: x64
|
||||
configuration: Release
|
||||
build_script:
|
||||
- scripts\build_release_x64.bat
|
||||
- .ci\build_windows_x64.bat
|
||||
|
||||
19
.ci/build_coverage.sh
Executable file
19
.ci/build_coverage.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE}" )" && pwd )"
|
||||
|
||||
ROOT_DIR="${DIR}/.."
|
||||
BUILD_DIR="${ROOT_DIR}/build/coverage"
|
||||
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
(cd "${BUILD_DIR}" && cmake "${ROOT_DIR}" -DCMAKE_BUILD_TYPE=Debug -DBUILD_WITH_COVERAGE=ON)
|
||||
(cd "${BUILD_DIR}" && cmake --build .)
|
||||
|
||||
(cd "${BUILD_DIR}" && lcov -d . -z)
|
||||
(cd "${BUILD_DIR}" && ctest --verbose)
|
||||
|
||||
(cd "${BUILD_DIR}" && lcov -d . -c -o "coverage.info")
|
||||
(cd "${BUILD_DIR}" && lcov -r "coverage.info" "*/usr/*" "*/untests/*" -o "coverage.info")
|
||||
(cd "${BUILD_DIR}" && lcov -l "coverage.info")
|
||||
|
||||
bash <(curl -s https://codecov.io/bash) -f "${BUILD_DIR}/coverage.info" || echo "Codecov did not collect coverage reports"
|
||||
11
.ci/build_darwin.sh
Executable file
11
.ci/build_darwin.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE}" )" && pwd )"
|
||||
|
||||
ROOT_DIR="${DIR}/.."
|
||||
BUILD_DIR="${ROOT_DIR}/build/darwin_release"
|
||||
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
(cd "${BUILD_DIR}" && cmake "${ROOT_DIR}" -DCMAKE_BUILD_TYPE=Release)
|
||||
(cd "${BUILD_DIR}" && cmake --build .)
|
||||
(cd "${BUILD_DIR}" && ctest --verbose)
|
||||
11
.ci/build_linux.sh
Executable file
11
.ci/build_linux.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE}" )" && pwd )"
|
||||
|
||||
ROOT_DIR="${DIR}/.."
|
||||
BUILD_DIR="${ROOT_DIR}/build/linux_release"
|
||||
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
(cd "${BUILD_DIR}" && cmake "${ROOT_DIR}" -DCMAKE_BUILD_TYPE=Release)
|
||||
(cd "${BUILD_DIR}" && cmake --build .)
|
||||
(cd "${BUILD_DIR}" && ctest --verbose)
|
||||
19
.ci/build_windows_x64.bat
Normal file
19
.ci/build_windows_x64.bat
Normal file
@@ -0,0 +1,19 @@
|
||||
@echo off
|
||||
set DIR=%~dp0
|
||||
|
||||
set ROOT_DIR=%DIR%..\
|
||||
set BUILD_DIR=%ROOT_DIR%build\windows_release_x64\
|
||||
|
||||
if not exist %BUILD_DIR% mkdir %BUILD_DIR% || goto :error
|
||||
|
||||
pushd %BUILD_DIR% || goto :error
|
||||
cmake %ROOT_DIR% -A x64 || goto :error
|
||||
cmake --build . --config Release || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
19
.ci/build_windows_x86.bat
Normal file
19
.ci/build_windows_x86.bat
Normal file
@@ -0,0 +1,19 @@
|
||||
@echo off
|
||||
set DIR=%~dp0
|
||||
|
||||
set ROOT_DIR=%DIR%..\
|
||||
set BUILD_DIR=%ROOT_DIR%build\windows_release_x86\
|
||||
|
||||
if not exist %BUILD_DIR% mkdir %BUILD_DIR% || goto :error
|
||||
|
||||
pushd %BUILD_DIR% || goto :error
|
||||
cmake %ROOT_DIR% -A Win32 || goto :error
|
||||
cmake --build . --config Release || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,4 +0,0 @@
|
||||
ignore:
|
||||
- "catch.hpp"
|
||||
- "catch_main.hpp"
|
||||
- "*_tests.cpp"
|
||||
140
.travis.yml
140
.travis.yml
@@ -1,159 +1,75 @@
|
||||
git:
|
||||
depth: false
|
||||
quiet: true
|
||||
|
||||
language: cpp
|
||||
|
||||
matrix:
|
||||
jobs:
|
||||
include:
|
||||
|
||||
#
|
||||
# windows (MSVC 2017)
|
||||
#
|
||||
|
||||
- os: windows
|
||||
stage: windows
|
||||
name: debug, MSVC 2017, x86
|
||||
script: ./scripts/build_debug_x86.bat
|
||||
|
||||
- os: windows
|
||||
stage: windows
|
||||
name: release, MSVC 2017, x86
|
||||
script: ./scripts/build_release_x86.bat
|
||||
|
||||
- os: windows
|
||||
stage: windows
|
||||
name: debug, MSVC 2017, x64
|
||||
script: ./scripts/build_debug_x64.bat
|
||||
|
||||
- os: windows
|
||||
stage: windows
|
||||
name: release, MSVC 2017, x64
|
||||
script: ./scripts/build_release_x64.bat
|
||||
|
||||
#
|
||||
# linux (g++-4.9)
|
||||
# linux (g++)
|
||||
#
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: debug, g++-4.9
|
||||
name: g++-4.9
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-4.9"] } }
|
||||
env: CC=gcc-4.9 CXX=g++-4.9
|
||||
script: ./scripts/build_debug.sh
|
||||
script: .ci/build_linux.sh
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: release, g++-4.9
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-4.9"] } }
|
||||
env: CC=gcc-4.9 CXX=g++-4.9
|
||||
script: ./scripts/build_release.sh
|
||||
|
||||
#
|
||||
# linux (g++-5)
|
||||
#
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: debug, g++-5
|
||||
name: g++-5
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-5"] } }
|
||||
env: CC=gcc-5 CXX=g++-5
|
||||
script: ./scripts/build_debug.sh
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: release, g++-5
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-5"] } }
|
||||
env: CC=gcc-5 CXX=g++-5
|
||||
script: ./scripts/build_release.sh
|
||||
script: .ci/build_linux.sh
|
||||
|
||||
#
|
||||
# linux (clang++-3.8)
|
||||
# linux (clang++)
|
||||
#
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: debug, clang++-3.8
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-3.8"], packages: ["g++-4.9", "clang-3.8"] } }
|
||||
name: clang++-3.8
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["clang-3.8"] } }
|
||||
env: CC=clang-3.8 CXX=clang++-3.8
|
||||
script: ./scripts/build_debug.sh
|
||||
script: .ci/build_linux.sh
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: release, clang++-3.8
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-3.8"], packages: ["g++-4.9", "clang-3.8"] } }
|
||||
env: CC=clang-3.8 CXX=clang++-3.8
|
||||
script: ./scripts/build_release.sh
|
||||
|
||||
#
|
||||
# linux (clang++-4.0)
|
||||
#
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: debug, clang++-4.0
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-4.0"], packages: ["g++-4.9", "clang-4.0"] } }
|
||||
name: clang++-4.0
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["clang-4.0"] } }
|
||||
env: CC=clang-4.0 CXX=clang++-4.0
|
||||
script: ./scripts/build_debug.sh
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: release, clang++-4.0
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-4.0"], packages: ["g++-4.9", "clang-4.0"] } }
|
||||
env: CC=clang-4.0 CXX=clang++-4.0
|
||||
script: ./scripts/build_release.sh
|
||||
script: .ci/build_linux.sh
|
||||
|
||||
#
|
||||
# macosx (xcode10)
|
||||
# darwin
|
||||
#
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode10
|
||||
stage: macosx
|
||||
name: debug, xcode10
|
||||
script: ./scripts/build_debug.sh
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode10
|
||||
stage: macosx
|
||||
name: release, xcode10
|
||||
script: ./scripts/build_release.sh
|
||||
|
||||
#
|
||||
# macosx (xcode11)
|
||||
#
|
||||
stage: darwin
|
||||
name: xcode10
|
||||
script: .ci/build_darwin.sh
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode11
|
||||
stage: macosx
|
||||
name: debug, xcode11
|
||||
script: ./scripts/build_debug.sh
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode11
|
||||
stage: macosx
|
||||
name: release, xcode11
|
||||
script: ./scripts/build_release.sh
|
||||
stage: darwin
|
||||
name: xcode11
|
||||
script: .ci/build_darwin.sh
|
||||
|
||||
#
|
||||
# coverage
|
||||
#
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode11
|
||||
osx_image: xcode10
|
||||
stage: coverage
|
||||
name: coverage, xcode11
|
||||
addons: { homebrew: { packages: ["lcov"] } }
|
||||
script: ./scripts/upload_coverage.sh
|
||||
|
||||
before_install:
|
||||
- if [ "$TRAVIS_OS_NAME" == 'linux' ]; then
|
||||
mkdir $HOME/cmake;
|
||||
export PATH="$HOME/cmake/bin:$PATH";
|
||||
travis_retry wget -q https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.sh;
|
||||
sh cmake-3.11.4-Linux-x86_64.sh --prefix=$HOME/cmake --exclude-subdir --skip-license;
|
||||
fi
|
||||
name: coverage
|
||||
addons: { homebrew: { packages: ["lcov"], update: true } }
|
||||
script: .ci/build_coverage.sh
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
Copyright (C) 2018-2021, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/invoke.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2018-2021, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
@echo off
|
||||
set SCRIPT_DIR=%~dp0%
|
||||
call %SCRIPT_DIR%\build_debug_x86.bat || goto :error
|
||||
call %SCRIPT_DIR%\build_debug_x64.bat || goto :error
|
||||
call %SCRIPT_DIR%\build_release_x86.bat || goto :error
|
||||
call %SCRIPT_DIR%\build_release_x64.bat || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
SCRIPT_DIR=`dirname "$BASH_SOURCE"`
|
||||
$SCRIPT_DIR/build_debug.sh
|
||||
$SCRIPT_DIR/build_release.sh
|
||||
@@ -1,9 +0,0 @@
|
||||
@echo off
|
||||
set BUILD_DIR=%~dp0%\..\build
|
||||
rmdir /s /q %BUILD_DIR% || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
|
||||
rm -rf $BUILD_DIR
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
|
||||
mkdir -p $BUILD_DIR/Debug
|
||||
pushd $BUILD_DIR/Debug
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ../..
|
||||
cmake --build .
|
||||
ctest --verbose
|
||||
popd
|
||||
@@ -1,14 +0,0 @@
|
||||
@echo off
|
||||
set BUILD_DIR=%~dp0%\..\build
|
||||
mkdir %BUILD_DIR%\Debug\x64 || goto :error
|
||||
pushd %BUILD_DIR%\Debug\x64 || goto :error
|
||||
cmake ..\..\.. -A x64 || goto :error
|
||||
cmake --build . --config Debug || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,14 +0,0 @@
|
||||
@echo off
|
||||
set BUILD_DIR=%~dp0%\..\build
|
||||
mkdir %BUILD_DIR%\Debug\x86 || goto :error
|
||||
pushd %BUILD_DIR%\Debug\x86 || goto :error
|
||||
cmake ..\..\.. -A Win32 || goto :error
|
||||
cmake --build . --config Debug || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
|
||||
mkdir -p $BUILD_DIR/Release
|
||||
pushd $BUILD_DIR/Release
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ../..
|
||||
cmake --build .
|
||||
ctest --verbose
|
||||
popd
|
||||
@@ -1,14 +0,0 @@
|
||||
@echo off
|
||||
set BUILD_DIR=%~dp0%\..\build
|
||||
mkdir %BUILD_DIR%\Release\x64 || goto :error
|
||||
pushd %BUILD_DIR%\Release\x64 || goto :error
|
||||
cmake ..\..\.. -A x64 || goto :error
|
||||
cmake --build . --config Release || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,14 +0,0 @@
|
||||
@echo off
|
||||
set BUILD_DIR=%~dp0%\..\build
|
||||
mkdir %BUILD_DIR%\Release\x86 || goto :error
|
||||
pushd %BUILD_DIR%\Release\x86 || goto :error
|
||||
cmake ..\..\.. -A Win32 || goto :error
|
||||
cmake --build . --config Release || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
|
||||
mkdir -p $BUILD_DIR/coverage
|
||||
cd $BUILD_DIR/coverage
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_WITH_COVERAGE=ON ../..
|
||||
cmake --build .
|
||||
|
||||
lcov -d . -z
|
||||
ctest --verbose
|
||||
|
||||
lcov -d . -c -o "coverage.info"
|
||||
lcov -r "coverage.info" "*/usr/*" "*/catch.hpp" "*/catch_main.cpp" "*_tests.cpp" "*_examples.cpp" -o "coverage.info"
|
||||
lcov -l "coverage.info"
|
||||
|
||||
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
|
||||
@@ -1,6 +1,3 @@
|
||||
# 3.11 version is required for `FetchContent`
|
||||
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
|
||||
|
||||
project(invoke.hpp.untests)
|
||||
|
||||
#
|
||||
@@ -19,7 +16,7 @@ endif()
|
||||
# executable
|
||||
#
|
||||
|
||||
file(GLOB UNTESTS_SOURCES "*.cpp" "*.hpp")
|
||||
file(GLOB_RECURSE UNTESTS_SOURCES "*.cpp" "*.hpp")
|
||||
add_executable(${PROJECT_NAME} ${UNTESTS_SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} invoke.hpp)
|
||||
|
||||
@@ -32,20 +29,3 @@ target_compile_options(${PROJECT_NAME}
|
||||
-Wall -Wextra -Wpedantic>)
|
||||
|
||||
add_test(${PROJECT_NAME} ${PROJECT_NAME})
|
||||
|
||||
#
|
||||
# catchorg/catch2
|
||||
#
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
catchorg_catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/catch2
|
||||
GIT_TAG v2.13.2)
|
||||
|
||||
FetchContent_GetProperties(catchorg_catch2)
|
||||
if(NOT catchorg_catch2_POPULATED)
|
||||
FetchContent_Populate(catchorg_catch2)
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PRIVATE ${catchorg_catch2_SOURCE_DIR}/single_include)
|
||||
endif()
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/invoke.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#define CATCH_CONFIG_FAST_COMPILE
|
||||
#include <catch2/catch.hpp>
|
||||
2
untests/doctest/doctest.cpp
Normal file
2
untests/doctest/doctest.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
#include "doctest.h"
|
||||
6260
untests/doctest/doctest.h
Normal file
6260
untests/doctest/doctest.h
Normal file
File diff suppressed because it is too large
Load Diff
11
untests/doctest/doctest.hpp
Normal file
11
untests/doctest/doctest.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "doctest.h"
|
||||
|
||||
#define STATIC_REQUIRE(...)\
|
||||
static_assert(__VA_ARGS__, #__VA_ARGS__);\
|
||||
REQUIRE(__VA_ARGS__);
|
||||
|
||||
#define STATIC_REQUIRE_FALSE(...)\
|
||||
static_assert(!(__VA_ARGS__), "!(" #__VA_ARGS__ ")");\
|
||||
REQUIRE(!(__VA_ARGS__));
|
||||
@@ -1,13 +1,12 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/invoke.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2018-2021, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#define CATCH_CONFIG_FAST_COMPILE
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <invoke.hpp/invoke.hpp>
|
||||
#include "doctest/doctest.h"
|
||||
|
||||
namespace inv = invoke_hpp;
|
||||
|
||||
namespace
|
||||
@@ -53,7 +52,7 @@ namespace
|
||||
}
|
||||
|
||||
TEST_CASE("invoke"){
|
||||
SECTION("invoke_functions"){
|
||||
SUBCASE("invoke_functions"){
|
||||
inv::invoke(simple_static_function);
|
||||
REQUIRE(inv::invoke(simple_static_function_r) == 42);
|
||||
REQUIRE(inv::invoke(simple_static_function_r_with_arg, 42) == 42);
|
||||
@@ -62,7 +61,7 @@ TEST_CASE("invoke"){
|
||||
REQUIRE(&inv::invoke(simple_static_function_r_with_ref_arg, v) == &v);
|
||||
}
|
||||
}
|
||||
SECTION("invoke_members"){
|
||||
SUBCASE("invoke_members"){
|
||||
obj_t o;
|
||||
|
||||
inv::invoke(&obj_t::member, o);
|
||||
@@ -84,7 +83,7 @@ TEST_CASE("invoke"){
|
||||
REQUIRE(&inv::invoke(&obj_t::member_r_with_ref_arg, std::ref(o), std::ref(v)) == &v);
|
||||
}
|
||||
}
|
||||
SECTION("invoke_member_objects"){
|
||||
SUBCASE("invoke_member_objects"){
|
||||
obj_t o;
|
||||
|
||||
REQUIRE(inv::invoke(&obj_t::value, o) == 42);
|
||||
@@ -98,7 +97,7 @@ TEST_CASE("invoke"){
|
||||
}
|
||||
|
||||
TEST_CASE("invoke_result"){
|
||||
SECTION("invoke_result_functions"){
|
||||
SUBCASE("invoke_result_functions"){
|
||||
static_assert(
|
||||
std::is_same<
|
||||
void,
|
||||
@@ -120,7 +119,7 @@ TEST_CASE("invoke_result"){
|
||||
inv::invoke_result_t<decltype(simple_static_function_r_with_ref_arg), const int&>>::value,
|
||||
"unit test fail");
|
||||
}
|
||||
SECTION("invoke_result_members"){
|
||||
SUBCASE("invoke_result_members"){
|
||||
static_assert(
|
||||
std::is_same<void,
|
||||
inv::invoke_result_t<decltype(&obj_t::member), obj_t>>::value,
|
||||
@@ -176,7 +175,7 @@ TEST_CASE("invoke_result"){
|
||||
}
|
||||
|
||||
TEST_CASE("is_invocable"){
|
||||
SECTION("is_invocable_functions"){
|
||||
SUBCASE("is_invocable_functions"){
|
||||
static_assert(
|
||||
inv::is_invocable<decltype(simple_static_function)>::value,
|
||||
"unit test fail");
|
||||
@@ -187,7 +186,7 @@ TEST_CASE("is_invocable"){
|
||||
inv::is_invocable<decltype(simple_static_function_r_with_arg), int>::value,
|
||||
"unit test fail");
|
||||
}
|
||||
SECTION("is_not_invocable_functions"){
|
||||
SUBCASE("is_not_invocable_functions"){
|
||||
static_assert(
|
||||
!inv::is_invocable<decltype(simple_static_function), int>::value,
|
||||
"unit test fail");
|
||||
@@ -198,7 +197,7 @@ TEST_CASE("is_invocable"){
|
||||
!inv::is_invocable<decltype(simple_static_function_r_with_arg)>::value,
|
||||
"unit test fail");
|
||||
}
|
||||
SECTION("is_invocable_members"){
|
||||
SUBCASE("is_invocable_members"){
|
||||
static_assert(
|
||||
inv::is_invocable<decltype(&obj_t::member), obj_t>::value,
|
||||
"unit test fail");
|
||||
@@ -229,7 +228,7 @@ TEST_CASE("is_invocable"){
|
||||
inv::is_invocable<decltype(&obj_t::member_r_with_arg), std::reference_wrapper<obj_t>, int>::value,
|
||||
"unit test fail");
|
||||
}
|
||||
SECTION("is_not_invocable_members"){
|
||||
SUBCASE("is_not_invocable_members"){
|
||||
static_assert(
|
||||
!inv::is_invocable<decltype(&obj_t::member)>::value,
|
||||
"unit test fail");
|
||||
@@ -260,7 +259,7 @@ TEST_CASE("is_invocable"){
|
||||
!inv::is_invocable<decltype(&obj_t::member_r_with_arg), std::reference_wrapper<obj2_t>, int>::value,
|
||||
"unit test fail");
|
||||
}
|
||||
SECTION("is_invocable_objects"){
|
||||
SUBCASE("is_invocable_objects"){
|
||||
static_assert(
|
||||
inv::is_invocable<decltype(&obj_t::value), obj_t>::value,
|
||||
"unit test fail");
|
||||
@@ -281,7 +280,7 @@ TEST_CASE("is_invocable"){
|
||||
inv::is_invocable<decltype(&obj_t::value_c), std::reference_wrapper<obj_t>>::value,
|
||||
"unit test fail");
|
||||
}
|
||||
SECTION("is_not_invocable_objects"){
|
||||
SUBCASE("is_not_invocable_objects"){
|
||||
static_assert(
|
||||
!inv::is_invocable<decltype(&obj_t::value)>::value,
|
||||
"unit test fail");
|
||||
@@ -305,7 +304,7 @@ TEST_CASE("is_invocable"){
|
||||
}
|
||||
|
||||
TEST_CASE("is_invocable_r"){
|
||||
SECTION("is_invocable_r_functions"){
|
||||
SUBCASE("is_invocable_r_functions"){
|
||||
static_assert(
|
||||
inv::is_invocable_r<void, decltype(simple_static_function)>::value,
|
||||
"unit test fail");
|
||||
@@ -319,7 +318,7 @@ TEST_CASE("is_invocable_r"){
|
||||
inv::is_invocable_r<const int&, decltype(simple_static_function_r_with_arg), const int&>::value,
|
||||
"unit test fail");
|
||||
}
|
||||
SECTION("is_not_invocable_r_functions"){
|
||||
SUBCASE("is_not_invocable_r_functions"){
|
||||
static_assert(
|
||||
!inv::is_invocable_r<void, decltype(simple_static_function), int>::value,
|
||||
"unit test fail");
|
||||
@@ -340,7 +339,7 @@ TEST_CASE("is_invocable_r"){
|
||||
!inv::is_invocable_r<obj_t, decltype(simple_static_function_r_with_arg), const int&>::value,
|
||||
"unit test fail");
|
||||
}
|
||||
SECTION("is_invocable_r_members"){
|
||||
SUBCASE("is_invocable_r_members"){
|
||||
static_assert(
|
||||
inv::is_invocable_r<void, decltype(&obj_t::member), obj_t>::value,
|
||||
"unit test fail");
|
||||
@@ -377,7 +376,7 @@ TEST_CASE("is_invocable_r"){
|
||||
inv::is_invocable_r<void, decltype(&obj_t::member_r_with_arg), std::reference_wrapper<obj_t>, int>::value,
|
||||
"unit test fail");
|
||||
}
|
||||
SECTION("is_not_invocable_r_members"){
|
||||
SUBCASE("is_not_invocable_r_members"){
|
||||
static_assert(
|
||||
!inv::is_invocable_r<int, decltype(&obj_t::member), obj_t>::value,
|
||||
"unit test fail");
|
||||
@@ -408,7 +407,7 @@ TEST_CASE("is_invocable_r"){
|
||||
!inv::is_invocable_r<int, decltype(&obj_t::member_r_with_arg), std::reference_wrapper<obj_t>, obj2_t>::value,
|
||||
"unit test fail");
|
||||
}
|
||||
SECTION("is_invocable_r_objects"){
|
||||
SUBCASE("is_invocable_r_objects"){
|
||||
static_assert(
|
||||
inv::is_invocable_r<int, decltype(&obj_t::value), obj_t>::value,
|
||||
"unit test fail");
|
||||
@@ -435,7 +434,7 @@ TEST_CASE("is_invocable_r"){
|
||||
inv::is_invocable_r<void, decltype(&obj_t::value_c), std::reference_wrapper<obj_t>>::value,
|
||||
"unit test fail");
|
||||
}
|
||||
SECTION("is_not_invocable_r_objects"){
|
||||
SUBCASE("is_not_invocable_r_objects"){
|
||||
static_assert(
|
||||
!inv::is_invocable_r<obj_t, decltype(&obj_t::value), obj_t>::value,
|
||||
"unit test fail");
|
||||
@@ -465,7 +464,7 @@ TEST_CASE("is_invocable_r"){
|
||||
}
|
||||
|
||||
TEST_CASE("apply"){
|
||||
SECTION("apply_functions"){
|
||||
SUBCASE("apply_functions"){
|
||||
inv::apply(simple_static_function, std::make_tuple());
|
||||
REQUIRE(inv::apply(simple_static_function_r, std::make_tuple()) == 42);
|
||||
REQUIRE(inv::apply(simple_static_function_r_with_arg, std::make_tuple(42)) == 42);
|
||||
@@ -474,7 +473,7 @@ TEST_CASE("apply"){
|
||||
REQUIRE(&inv::apply(simple_static_function_r_with_ref_arg, std::make_tuple(std::ref(v))) == &v);
|
||||
}
|
||||
}
|
||||
SECTION("apply_members"){
|
||||
SUBCASE("apply_members"){
|
||||
obj_t o;
|
||||
|
||||
inv::apply(&obj_t::member, std::make_tuple(o));
|
||||
@@ -496,7 +495,7 @@ TEST_CASE("apply"){
|
||||
REQUIRE(&inv::apply(&obj_t::member_r_with_ref_arg, std::make_tuple(std::ref(o), std::ref(v))) == &v);
|
||||
}
|
||||
}
|
||||
SECTION("apply_member_objects"){
|
||||
SUBCASE("apply_member_objects"){
|
||||
obj_t o;
|
||||
|
||||
REQUIRE(inv::apply(&obj_t::value, std::make_tuple(o)) == 42);
|
||||
|
||||
Reference in New Issue
Block a user