aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2023-06-07 16:41:32 +0200
committerFelix Morgner <felix.morgner@gmail.com>2023-06-07 16:41:32 +0200
commitaa7c021962f529f3ed2f482fd6f02e5497532a8a (patch)
treec8a3eff796c94f757cc8ae7d3b2324f53038e0c3
parent741b6d177865f20908b1b290c5170025964d3d9a (diff)
downloadnewtype-aa7c021962f529f3ed2f482fd6f02e5497532a8a.tar.xz
newtype-aa7c021962f529f3ed2f482fd6f02e5497532a8a.zip
project: begin restructuring
-rw-r--r--.gitignore5
-rw-r--r--.travis.yml42
-rw-r--r--.vscode/settings.json6
-rw-r--r--CMakeLists.txt281
-rw-r--r--cmake/Modules/Conan.cmake554
-rw-r--r--cmake/Modules/DiscoverTests.cmake55
-rw-r--r--cmake/Modules/DiscoverTestsImpl.cmake39
-rw-r--r--cmake/config.cmake.in4
-rw-r--r--conanfile.py92
-rw-r--r--source/CMakeLists.txt88
-rw-r--r--source/examples/src/basic_usage.cpp (renamed from examples/src/basic_usage.cpp)0
-rw-r--r--source/examples/src/basic_usage_with_read.cpp (renamed from examples/src/basic_usage_with_read.cpp)0
-rw-r--r--source/examples/src/basic_usage_with_show.cpp (renamed from examples/src/basic_usage_with_show.cpp)0
-rw-r--r--source/include/newtype/derivable.hpp (renamed from include/newtype/derivable.hpp)0
-rw-r--r--source/include/newtype/derivation_clause.hpp (renamed from include/newtype/derivation_clause.hpp)0
-rw-r--r--source/include/newtype/deriving.hpp (renamed from include/newtype/deriving.hpp)0
-rw-r--r--source/include/newtype/impl/new_type_iterator_types.hpp (renamed from include/newtype/impl/new_type_iterator_types.hpp)0
-rw-r--r--source/include/newtype/impl/new_type_storage.hpp (renamed from include/newtype/impl/new_type_storage.hpp)0
-rw-r--r--source/include/newtype/impl/type_traits_extensions.hpp (renamed from include/newtype/impl/type_traits_extensions.hpp)0
-rw-r--r--source/include/newtype/newtype.hpp (renamed from include/newtype/newtype.hpp)0
-rw-r--r--source/include/newtype/version.hpp (renamed from include/newtype/version.hpp)0
-rw-r--r--source/test/src/arithmetic.cpp300
-rw-r--r--source/test/src/conversion_suite.cpp (renamed from test/src/conversion_suite.cpp)0
-rw-r--r--source/test/src/derivation_clause_suite.cpp (renamed from test/src/derivation_clause_suite.cpp)0
-rw-r--r--source/test/src/equality_comparison_suite.cpp (renamed from test/src/equality_comparison_suite.cpp)0
-rw-r--r--source/test/src/hash_suite.cpp (renamed from test/src/hash_suite.cpp)0
-rw-r--r--source/test/src/io_operators_suite.cpp (renamed from test/src/io_operators_suite.cpp)0
-rw-r--r--source/test/src/iterable_suite.cpp (renamed from test/src/iterable_suite.cpp)0
-rw-r--r--source/test/src/new_type_constructor_suite.cpp (renamed from test/src/new_type_constructor_suite.cpp)0
-rw-r--r--source/test/src/relational_operators_suite.cpp (renamed from test/src/relational_operators_suite.cpp)0
-rw-r--r--test/include/arithmetic_suite.hpp11
-rw-r--r--test/include/conversion_suite.hpp11
-rw-r--r--test/include/derivation_clause_suite.hpp11
-rw-r--r--test/include/equality_comparison_suite.hpp11
-rw-r--r--test/include/hash_suite.hpp11
-rw-r--r--test/include/io_operators_suite.hpp11
-rw-r--r--test/include/iterable_suite.hpp11
-rw-r--r--test/include/kawaii.hpp143
-rw-r--r--test/include/new_type_constructor_suite.hpp11
-rw-r--r--test/include/relational_operators_suite.hpp11
-rw-r--r--test/src/arithmetic_suite.cpp330
-rw-r--r--test/src/driver.cpp101
-rw-r--r--test_package/CMakeLists.txt13
-rw-r--r--test_package/conanfile.py16
-rw-r--r--test_package/main.cpp2
45 files changed, 473 insertions, 1697 deletions
diff --git a/.gitignore b/.gitignore
index 42afabf..cebfa4e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
-/build \ No newline at end of file
+/.cache
+/build
+/source/CMakeUserPresets.json
+/test_package/CMakeUserPresets.json
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index f523e70..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-os: linux
-language: python
-python: "3.7"
-dist: bionic
-
-addons:
- apt:
- sources:
- - sourceline: 'ppa:ubuntu-toolchain-r/test'
- - sourceline: 'deb https://apt.kitware.com/ubuntu/ bionic main'
- key_url: 'https://apt.kitware.com/keys/kitware-archive-latest.asc'
- packages:
- - g++-9
- - cmake
- - libperlio-gzip-perl
- - libjson-perl
-
-compiler:
- - gcc
-
-cache:
- directories:
- - $HOME/.conan/data
-
-before_install:
- - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 20
- - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 20
- - sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-9 20
- - sudo update-alternatives --config gcc
- - sudo update-alternatives --config g++
- - sudo update-alternatives --config gcov
-
-install:
- - pip install conan
- - conan user
- - git clone git://github.com/linux-test-project/lcov.git
- - cd lcov && sudo make install
- - cd ..
-
-script:
- - /usr/bin/cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=YES -DRUN_TESTS_AFTER_BUILD=YES -DENABLE_CODE_COVERAGE=YES -DPRINT_COVERAGE_REPORT=YES
- - /usr/bin/cmake --build build --target all --parallel $(nproc)
diff --git a/.vscode/settings.json b/.vscode/settings.json
index d237db4..24f5d88 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -11,5 +11,9 @@
"C_Cpp.autoAddFileAssociations": false,
// RST Configuration
- "restructuredtext.confPath": "${workspaceFolder}/doc/src"
+ "restructuredtext.confPath": "${workspaceFolder}/doc/src",
+ "[python]": {
+ "editor.defaultFormatter": "ms-python.black-formatter"
+ },
+ "python.formatting.provider": "none"
} \ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 3c29a76..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,281 +0,0 @@
-cmake_minimum_required(VERSION "3.9.0")
-
-project("newtype"
- VERSION "1.1.0"
- LANGUAGES CXX
- DESCRIPTION "A library of types and functions to create strong type aliases"
-)
-
-include("CMakePackageConfigHelpers")
-
-# Project Options
-
-option(RUN_TESTS_AFTER_BUILD "Automatically run the unit tests after building" ON)
-option(BUILD_TESTING "Build the unit tests" ON)
-option(ENABLE_CODE_COVERAGE "Enable building support for code coverage report generation" ON)
-option(PRINT_COVERAGE_REPORT "Print a coverage report after running the unit tests" ON)
-option(GENERATE_COVERAGE_REPORT "Generate an HTML coverage report after running the unit tests" OFF)
-
-# 'newtype' library
-
-add_library("${PROJECT_NAME}" INTERFACE)
-
-target_include_directories("${PROJECT_NAME}" INTERFACE
- $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
- $<INSTALL_INTERFACE:include>
-)
-
-target_compile_features("${PROJECT_NAME}" INTERFACE
- "cxx_std_20"
-)
-
-install(TARGETS "${PROJECT_NAME}"
- EXPORT "${PROJECT_NAME}Targets"
- PUBLIC_HEADER DESTINATION "include"
-)
-
-install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
- DESTINATION "include"
-)
-
-# 'newtype' tests
-
-if(BUILD_TESTING)
- enable_testing()
-
- if(PRINT_COVERAGE_REPORT)
- find_program(LCOV_EXE NAMES "lcov")
- mark_as_advanced(LCOV_EXE)
- if(NOT LCOV_EXE)
- message(FATAL_ERROR "lcov is required to generate code coverage reports")
- endif()
- endif()
-
- if(GENERATE_COVERAGE_REPORT)
- find_program(GENHTML_EXE NAMES "genhtml")
- mark_as_advanced(GENHTML_EXE)
- if(NOT GENHTML_EXE)
- message(FATAL_ERROR "genhtml is required to generate code coverage reports")
- endif()
- endif()
-
- include("${PROJECT_SOURCE_DIR}/cmake/Modules/DiscoverTests.cmake")
- include("${PROJECT_SOURCE_DIR}/cmake/Modules/Conan.cmake")
-
- conan_check(REQUIRED)
- conan_add_remote(NAME "fmorgner-public" URL "https://api.bintray.com/conan/fmorgner/conan-public")
- conan_cmake_run(CONANFILE "conanfile.py"
- OUTPUT_QUIET
- BASIC_SETUP
- CMAKE_TARGETS
- BUILD "missing"
- NO_OUTPUT_DIRS
- )
-
- add_executable("${PROJECT_NAME}_tests"
- "${PROJECT_SOURCE_DIR}/test/src/driver.cpp"
-
- "${PROJECT_SOURCE_DIR}/test/src/arithmetic_suite.cpp"
- "${PROJECT_SOURCE_DIR}/test/src/conversion_suite.cpp"
- "${PROJECT_SOURCE_DIR}/test/src/derivation_clause_suite.cpp"
- "${PROJECT_SOURCE_DIR}/test/src/equality_comparison_suite.cpp"
- "${PROJECT_SOURCE_DIR}/test/src/hash_suite.cpp"
- "${PROJECT_SOURCE_DIR}/test/src/io_operators_suite.cpp"
- "${PROJECT_SOURCE_DIR}/test/src/iterable_suite.cpp"
- "${PROJECT_SOURCE_DIR}/test/src/new_type_constructor_suite.cpp"
- "${PROJECT_SOURCE_DIR}/test/src/relational_operators_suite.cpp"
- )
-
- target_include_directories("${PROJECT_NAME}_tests" PRIVATE
- "${PROJECT_SOURCE_DIR}/test/include"
- )
-
- target_link_libraries("${PROJECT_NAME}_tests"
- "newtype"
- "CONAN_PKG::CUTE"
- "CONAN_PKG::lyra"
- )
-
- target_compile_options("${PROJECT_NAME}_tests" PRIVATE
- "-Wall"
- "-Wextra"
- "-Werror"
- "-pedantic-errors"
- $<$<BOOL:${ENABLE_CODE_COVERAGE}>:--coverage>
- )
-
- target_link_options("${PROJECT_NAME}_tests" PRIVATE
- $<$<BOOL:${ENABLE_CODE_COVERAGE}>:--coverage>
- )
-
- set_target_properties("${PROJECT_NAME}_tests" PROPERTIES
- CXX_EXTENSIONS OFF
- )
-
- discover_tests(TARGET "${PROJECT_NAME}_tests")
-
- if(RUN_TESTS_AFTER_BUILD)
- add_custom_command(TARGET "${PROJECT_NAME}_tests"
- POST_BUILD
- DEPENDS "${PROJECT_NAME}_tests"
- COMMAND "${CMAKE_CTEST_COMMAND}"
- ARGS
- "--output-on-failure"
- WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
- COMMENT "Running unit tests"
- )
- endif()
-
- if(ENABLE_CODE_COVERAGE AND RUN_TESTS_AFTER_BUILD)
- add_custom_command(TARGET "${PROJECT_NAME}_tests"
- POST_BUILD
- BYPRODUCTS "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.coverage.info"
- COMMAND "${LCOV_EXE}"
- ARGS
- "--capture"
- "--base-directory" "${PROJECT_SOURCE_DIR}"
- "--directory" "${PROJECT_BINARY_DIR}"
- "--output-file" "${PROJECT_NAME}.coverage.info"
- "--no-external"
- "--exclude" "${PROJECT_SOURCE_DIR}/test/\\*"
- ">/dev/null"
- WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
- COMMENT "Capturing code coverage data"
- )
-
- if(PRINT_COVERAGE_REPORT)
- add_custom_command(TARGET "${PROJECT_NAME}_tests"
- POST_BUILD
- COMMAND "${LCOV_EXE}"
- ARGS
- "--list"
- "${PROJECT_NAME}.coverage.info"
- WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
- COMMENT "Printing code coverage report"
- )
- endif()
-
- if(GENERATE_COVERAGE_REPORT)
- add_custom_command(TARGET "${PROJECT_NAME}_tests"
- POST_BUILD
- BYPRODUCTS "${PROJECT_BINARY_DIR}/coverage-report/index.html"
- COMMAND "${GENHTML_EXE}"
- ARGS
- "--demangle-cpp"
- "--highlight"
- "--missed"
- "--show-details"
- "--output" "coverage-report"
- "${PROJECT_NAME}.coverage.info"
- ">/dev/null"
- WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
- COMMENT "Generating code coverage report"
- )
- endif()
- endif()
-endif()
-
-# 'newtype' docs
-
-option(BUILD_DOCS "Build the library documentation" OFF)
-
-if(BUILD_DOCS)
- find_program(PIPENV_EXE NAMES "pipenv3" "pipenv")
- mark_as_advanced(PIPENV_EXE)
- if(NOT PIPENV_EXE)
- message(FATAL_ERROR "Could not find pipenv")
- endif()
-
- message(STATUS "Installing documentation dependencies via pipenv")
- execute_process(COMMAND "${PIPENV_EXE}" "install" "-r" "requirements.txt"
- WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/doc"
- OUTPUT_QUIET
- ERROR_QUIET
- )
-
- set(DOC_SOURCES
- "${PROJECT_SOURCE_DIR}/doc/src/index.rst"
- "${PROJECT_SOURCE_DIR}/doc/src/conf.py"
- "${PROJECT_SOURCE_DIR}/examples/src/basic_usage.cpp"
- "${PROJECT_SOURCE_DIR}/examples/src/basic_usage_with_show.cpp"
- "${PROJECT_SOURCE_DIR}/examples/src/basic_usage_with_read.cpp"
- )
-
- add_custom_target("docs"
- DEPENDS "${PROJECT_BINARY_DIR}/doc/html/index.html" "${PROJECT_BINARY_DIR}/doc/man/newtype.3"
- WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/doc"
- COMMENT "Building documentation"
- )
-
- add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/doc/html/index.html"
- COMMAND "${PIPENV_EXE}" "run" "sphinx-build" "-b" "singlehtml" "${PROJECT_SOURCE_DIR}/doc/src" "${PROJECT_BINARY_DIR}/doc/html" ">/dev/null"
- DEPENDS ${DOC_SOURCES}
- WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/doc"
- COMMENT "Compiling HTML documentation"
- )
-
- add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/doc/man/newtype.3"
- COMMAND "${PIPENV_EXE}" "run" "sphinx-build" "-b" "man" "${PROJECT_SOURCE_DIR}/doc/src" "${PROJECT_BINARY_DIR}/doc/man" ">/dev/null"
- DEPENDS ${DOC_SOURCES}
- WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/doc"
- COMMENT "Compiling man pages"
- )
-
- add_dependencies("${PROJECT_NAME}" "docs")
-
- install(DIRECTORY "${PROJECT_BINARY_DIR}/doc/html"
- DESTINATION "share/doc/${PROJECT_NAME}"
- PATTERN ".nojekyll" EXCLUDE
- PATTERN ".buildinfo" EXCLUDE
- PATTERN ".doctrees" EXCLUDE
- PATTERN "objects.inv" EXCLUDE
- )
-
- install(FILES "${PROJECT_BINARY_DIR}/doc/man/${PROJECT_NAME}.3"
- DESTINATION "share/man/man3"
- )
-endif()
-
-# 'newtype' examples
-
-option(BUILD_EXAMPLES "Build the library examples" OFF)
-
-if(BUILD_EXAMPLES)
- function(add_example NAME)
- add_executable("ex_${NAME}"
- "examples/src/${NAME}.cpp"
- )
- target_link_libraries("ex_${NAME}" "${PROJECT_NAME}")
- endfunction()
-
- add_example("basic_usage")
- add_example("basic_usage_with_show")
- add_example("basic_usage_with_read")
-endif()
-
-# CMake support files
-
-write_basic_package_version_file(
- "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
- COMPATIBILITY "AnyNewerVersion"
-)
-
-configure_package_config_file(
- "${PROJECT_SOURCE_DIR}/cmake/config.cmake.in"
- "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
- INSTALL_DESTINATION "lib/cmake/${PROJECT_NAME}"
-)
-
-install(FILES
- "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
- "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
- DESTINATION "lib/cmake/${PROJECT_NAME}"
-)
-
-install(DIRECTORY "${PROJECT_SOURCE_DIR}/doc/src/"
- DESTINATION "share/doc/newtype"
-)
-
-install(EXPORT "${PROJECT_NAME}Targets"
- DESTINATION "lib/cmake/${PROJECT_NAME}"
-)
diff --git a/cmake/Modules/Conan.cmake b/cmake/Modules/Conan.cmake
deleted file mode 100644
index aac3b9c..0000000
--- a/cmake/Modules/Conan.cmake
+++ /dev/null
@@ -1,554 +0,0 @@
-# The MIT License (MIT)
-
-# Copyright (c) 2018 JFrog
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in all
-# copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-
-
-# This file comes from: https://github.com/conan-io/cmake-conan. Please refer
-# to this repository for issues and documentation.
-
-# Its purpose is to wrap and launch Conan C/C++ Package Manager when cmake is called.
-# It will take CMake current settings (os, compiler, compiler version, architecture)
-# and translate them to conan settings for installing and retrieving dependencies.
-
-# It is intended to facilitate developers building projects that have conan dependencies,
-# but it is only necessary on the end-user side. It is not necessary to create conan
-# packages, in fact it shouldn't be use for that. Check the project documentation.
-
-
-include(CMakeParseArguments)
-
-function(_get_msvc_ide_version result)
- set(${result} "" PARENT_SCOPE)
- if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500)
- set(${result} 8 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600)
- set(${result} 9 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700)
- set(${result} 10 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800)
- set(${result} 11 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900)
- set(${result} 12 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910)
- set(${result} 14 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920)
- set(${result} 15 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1920 AND MSVC_VERSION VERSION_LESS 1930)
- set(${result} 16 PARENT_SCOPE)
- else()
- message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]")
- endif()
-endfunction()
-
-function(conan_cmake_settings result)
- #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER})
- #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER_ID})
- #message(STATUS "VERSION " ${CMAKE_CXX_COMPILER_VERSION})
- #message(STATUS "FLAGS " ${CMAKE_LANG_FLAGS})
- #message(STATUS "LIB ARCH " ${CMAKE_CXX_LIBRARY_ARCHITECTURE})
- #message(STATUS "BUILD TYPE " ${CMAKE_BUILD_TYPE})
- #message(STATUS "GENERATOR " ${CMAKE_GENERATOR})
- #message(STATUS "GENERATOR WIN64 " ${CMAKE_CL_64})
-
- message(STATUS "Conan: Automatic detection of conan settings from cmake")
-
- parse_arguments(${ARGV})
-
- if(ARGUMENTS_BUILD_TYPE)
- set(_CONAN_SETTING_BUILD_TYPE ${ARGUMENTS_BUILD_TYPE})
- elseif(CMAKE_BUILD_TYPE)
- set(_CONAN_SETTING_BUILD_TYPE ${CMAKE_BUILD_TYPE})
- else()
- message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)")
- endif()
-
- string(TOUPPER ${_CONAN_SETTING_BUILD_TYPE} _CONAN_SETTING_BUILD_TYPE_UPPER)
- if (_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "DEBUG")
- set(_CONAN_SETTING_BUILD_TYPE "Debug")
- elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELEASE")
- set(_CONAN_SETTING_BUILD_TYPE "Release")
- elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELWITHDEBINFO")
- set(_CONAN_SETTING_BUILD_TYPE "RelWithDebInfo")
- elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "MINSIZEREL")
- set(_CONAN_SETTING_BUILD_TYPE "MinSizeRel")
- endif()
-
- if(ARGUMENTS_ARCH)
- set(_CONAN_SETTING_ARCH ${ARGUMENTS_ARCH})
- endif()
- #handle -s os setting
- if(CMAKE_SYSTEM_NAME)
- #use default conan os setting if CMAKE_SYSTEM_NAME is not defined
- set(CONAN_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
- if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
- set(CONAN_SYSTEM_NAME Macos)
- endif()
- set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD WindowsStore)
- list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index)
- if (${_index} GREATER -1)
- #check if the cmake system is a conan supported one
- set(_CONAN_SETTING_OS ${CONAN_SYSTEM_NAME})
- else()
- message(FATAL_ERROR "cmake system ${CONAN_SYSTEM_NAME} is not supported by conan. Use one of ${CONAN_SUPPORTED_PLATFORMS}")
- endif()
- endif()
-
- get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
- if (";${_languages};" MATCHES ";CXX;")
- set(LANGUAGE CXX)
- set(USING_CXX 1)
- elseif (";${_languages};" MATCHES ";C;")
- set(LANGUAGE C)
- set(USING_CXX 0)
- else ()
- message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.")
- endif()
-
- if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU)
- # using GCC
- # TODO: Handle other params
- string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
- list(GET VERSION_LIST 0 MAJOR)
- list(GET VERSION_LIST 1 MINOR)
- set(COMPILER_VERSION ${MAJOR}.${MINOR})
- if(${MAJOR} GREATER 4)
- set(COMPILER_VERSION ${MAJOR})
- endif()
- set(_CONAN_SETTING_COMPILER gcc)
- set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION})
- if (USING_CXX)
- conan_cmake_detect_unix_libcxx(_LIBCXX)
- set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
- endif ()
- elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang)
- # using AppleClang
- string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
- list(GET VERSION_LIST 0 MAJOR)
- list(GET VERSION_LIST 1 MINOR)
- set(_CONAN_SETTING_COMPILER apple-clang)
- set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
- if (USING_CXX)
- conan_cmake_detect_unix_libcxx(_LIBCXX)
- set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
- endif ()
- elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang)
- string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
- list(GET VERSION_LIST 0 MAJOR)
- list(GET VERSION_LIST 1 MINOR)
- set(_CONAN_SETTING_COMPILER clang)
- set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
- if(APPLE)
- cmake_policy(GET CMP0025 APPLE_CLANG_POLICY_ENABLED)
- if(NOT APPLE_CLANG_POLICY_ENABLED)
- message(STATUS "Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it")
- set(_CONAN_SETTING_COMPILER apple-clang)
- endif()
- endif()
- if(${_CONAN_SETTING_COMPILER} STREQUAL clang AND ${MAJOR} GREATER 7)
- set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR})
- endif()
- if (USING_CXX)
- conan_cmake_detect_unix_libcxx(_LIBCXX)
- set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
- endif ()
- elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC)
- set(_VISUAL "Visual Studio")
- _get_msvc_ide_version(_VISUAL_VERSION)
- if("${_VISUAL_VERSION}" STREQUAL "")
- message(FATAL_ERROR "Conan: Visual Studio not recognized")
- else()
- set(_CONAN_SETTING_COMPILER ${_VISUAL})
- set(_CONAN_SETTING_COMPILER_VERSION ${_VISUAL_VERSION})
- endif()
-
- if(NOT _CONAN_SETTING_ARCH)
- if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64")
- set(_CONAN_SETTING_ARCH x86_64)
- elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM")
- message(STATUS "Conan: Using default ARM architecture from MSVC")
- set(_CONAN_SETTING_ARCH armv6)
- elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86")
- set(_CONAN_SETTING_ARCH x86)
- else ()
- message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]")
- endif()
- endif()
-
- conan_cmake_detect_vs_runtime(_vs_runtime)
- message(STATUS "Conan: Detected VS runtime: ${_vs_runtime}")
- set(_CONAN_SETTING_COMPILER_RUNTIME ${_vs_runtime})
-
- if (CMAKE_GENERATOR_TOOLSET)
- set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET})
- elseif(CMAKE_VS_PLATFORM_TOOLSET AND (CMAKE_GENERATOR STREQUAL "Ninja"))
- set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET})
- endif()
- else()
- message(FATAL_ERROR "Conan: compiler setup not recognized")
- endif()
-
- # If profile is defined it is used
- if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ARGUMENTS_DEBUG_PROFILE)
- set(_APPLIED_PROFILES ${ARGUMENTS_DEBUG_PROFILE})
- elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE)
- set(_APPLIED_PROFILES ${ARGUMENTS_RELEASE_PROFILE})
- elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND ARGUMENTS_RELWITHDEBINFO_PROFILE)
- set(_APPLIED_PROFILES ${ARGUMENTS_RELWITHDEBINFO_PROFILE})
- elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" AND ARGUMENTS_MINSIZEREL_PROFILE)
- set(_APPLIED_PROFILES ${ARGUMENTS_MINSIZEREL_PROFILE})
- elseif(ARGUMENTS_PROFILE)
- set(_APPLIED_PROFILES ${ARGUMENTS_PROFILE})
- endif()
-
- foreach(ARG ${_APPLIED_PROFILES})
- set(_SETTINGS ${_SETTINGS} -pr ${ARG})
- endforeach()
-
- if(NOT _SETTINGS OR ARGUMENTS_PROFILE_AUTO STREQUAL "ALL")
- set(ARGUMENTS_PROFILE_AUTO arch build_type compiler compiler.version
- compiler.runtime compiler.libcxx compiler.toolset)
- endif()
-
- # Automatic from CMake
- foreach(ARG ${ARGUMENTS_PROFILE_AUTO})
- string(TOUPPER ${ARG} _arg_name)
- string(REPLACE "." "_" _arg_name ${_arg_name})
- if(_CONAN_SETTING_${_arg_name})
- set(_SETTINGS ${_SETTINGS} -s ${ARG}=${_CONAN_SETTING_${_arg_name}})
- endif()
- endforeach()
-
- foreach(ARG ${ARGUMENTS_SETTINGS})
- set(_SETTINGS ${_SETTINGS} -s ${ARG})
- endforeach()
-
- message(STATUS "Conan: Settings= ${_SETTINGS}")
-
- set(${result} ${_SETTINGS} PARENT_SCOPE)
-endfunction()
-
-
-function(conan_cmake_detect_unix_libcxx result)
- # Take into account any -stdlib in compile options
- get_directory_property(compile_options DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_OPTIONS)
-
- # Take into account any _GLIBCXX_USE_CXX11_ABI in compile definitions
- get_directory_property(defines DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
- foreach(define ${defines})
- if(define MATCHES "_GLIBCXX_USE_CXX11_ABI")
- if(define MATCHES "^-D")
- set(compile_options ${compile_options} "${define}")
- else()
- set(compile_options ${compile_options} "-D${define}")
- endif()
- endif()
- endforeach()
-
- execute_process(
- COMMAND ${CMAKE_COMMAND} -E echo "#include <string>"
- COMMAND ${CMAKE_CXX_COMPILER} -x c++ ${compile_options} -E -dM -
- OUTPUT_VARIABLE string_defines
- )
-
- if(string_defines MATCHES "#define __GLIBCXX__")
- # Allow -D_GLIBCXX_USE_CXX11_ABI=ON/OFF as argument to cmake
- if(DEFINED _GLIBCXX_USE_CXX11_ABI)
- if(_GLIBCXX_USE_CXX11_ABI)
- set(${result} libstdc++11 PARENT_SCOPE)
- return()
- else()
- set(${result} libstdc++ PARENT_SCOPE)
- return()
- endif()
- endif()
-
- if(string_defines MATCHES "#define _GLIBCXX_USE_CXX11_ABI 1\n")
- set(${result} libstdc++11 PARENT_SCOPE)
- else()
- # Either the compiler is missing the define because it is old, and so
- # it can't use the new abi, or the compiler was configured to use the
- # old abi by the user or distro (e.g. devtoolset on RHEL/CentOS)
- set(${result} libstdc++ PARENT_SCOPE)
- endif()
- else()
- set(${result} libc++ PARENT_SCOPE)
- endif()
-endfunction()
-
-function(conan_cmake_detect_vs_runtime result)
- string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
- set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
- foreach(variable ${variables})
- string(REPLACE " " ";" flags ${${variable}})
- foreach (flag ${flags})
- if(${flag} STREQUAL "/MD" OR ${flag} STREQUAL "/MDd" OR ${flag} STREQUAL "/MT" OR ${flag} STREQUAL "/MTd")
- string(SUBSTRING ${flag} 1 -1 runtime)
- set(${result} ${runtime} PARENT_SCOPE)
- return()
- endif()
- endforeach()
- endforeach()
- if(${build_type} STREQUAL "DEBUG")
- set(${result} "MDd" PARENT_SCOPE)
- else()
- set(${result} "MD" PARENT_SCOPE)
- endif()
-endfunction()
-
-
-macro(parse_arguments)
- set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS)
- set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER CONAN_COMMAND)
- set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE
- PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO
- INSTALL_ARGS)
- cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-endmacro()
-
-function(conan_cmake_install)
- # Calls "conan install"
- # Argument BUILD is equivalant to --build={missing, PkgName,...} or
- # --build when argument is 'BUILD all' (which builds all packages from source)
- # Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source
- # cmake does not identify conan as command, even if it is +x and it is in the path
- parse_arguments(${ARGV})
-
- if(CONAN_CMAKE_MULTI)
- set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake_multi)
- else()
- set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake)
- endif()
-
- set(CONAN_BUILD_POLICY "")
- foreach(ARG ${ARGUMENTS_BUILD})
- if(${ARG} STREQUAL "all")
- set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build)
- break()
- else()
- set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build=${ARG})
- endif()
- endforeach()
- if(ARGUMENTS_CONAN_COMMAND)
- set(conan_command ${ARGUMENTS_CONAN_COMMAND})
- else()
- set(conan_command conan)
- endif()
- set(CONAN_OPTIONS "")
- if(ARGUMENTS_CONANFILE)
- set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE})
- # A conan file has been specified - apply specified options as well if provided
- foreach(ARG ${ARGUMENTS_OPTIONS})
- set(CONAN_OPTIONS ${CONAN_OPTIONS} -o=${ARG})
- endforeach()
- else()
- set(CONANFILE ".")
- endif()
- if(ARGUMENTS_UPDATE)
- set(CONAN_INSTALL_UPDATE --update)
- endif()
- if(ARGUMENTS_NO_IMPORTS)
- set(CONAN_INSTALL_NO_IMPORTS --no-imports)
- endif()
- set(CONAN_INSTALL_FOLDER "")
- if(ARGUMENTS_INSTALL_FOLDER)
- set(CONAN_INSTALL_FOLDER -if=${ARGUMENTS_INSTALL_FOLDER})
- endif()
- foreach(ARG ${ARGUMENTS_GENERATORS})
- set(CONAN_GENERATORS ${CONAN_GENERATORS} -g=${ARG})
- endforeach()
- foreach(ARG ${ARGUMENTS_ENV})
- set(CONAN_ENV_VARS ${CONAN_ENV_VARS} -e=${ARG})
- endforeach()
- set(conan_args install ${CONANFILE} ${settings} ${CONAN_ENV_VARS} ${CONAN_GENERATORS} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_INSTALL_NO_IMPORTS} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER} ${ARGUMENTS_INSTALL_ARGS})
-
- string (REPLACE ";" " " _conan_args "${conan_args}")
- message(STATUS "Conan executing: ${conan_command} ${_conan_args}")
-
- if(ARGUMENTS_OUTPUT_QUIET)
- execute_process(COMMAND ${conan_command} ${conan_args}
- RESULT_VARIABLE return_code
- OUTPUT_VARIABLE conan_output
- ERROR_VARIABLE conan_output
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- else()
- execute_process(COMMAND ${conan_command} ${conan_args}
- RESULT_VARIABLE return_code
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- endif()
-
- if(NOT "${return_code}" STREQUAL "0")
- message(FATAL_ERROR "Conan install failed='${return_code}'")
- endif()
-
-endfunction()
-
-
-function(conan_cmake_setup_conanfile)
- parse_arguments(${ARGV})
- if(ARGUMENTS_CONANFILE)
- get_filename_component(_CONANFILE_NAME ${ARGUMENTS_CONANFILE} NAME)
- # configure_file will make sure cmake re-runs when conanfile is updated
- configure_file(${ARGUMENTS_CONANFILE} ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk)
- file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk)
- else()
- conan_cmake_generate_conanfile(${ARGV})
- endif()
-endfunction()
-
-function(conan_cmake_generate_conanfile)
- # Generate, writing in disk a conanfile.txt with the requires, options, and imports
- # specified as arguments
- # This will be considered as temporary file, generated in CMAKE_CURRENT_BINARY_DIR)
- parse_arguments(${ARGV})
- set(_FN "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt")
-
- file(WRITE ${_FN} "[generators]\ncmake\n\n[requires]\n")
- foreach(ARG ${ARGUMENTS_REQUIRES})
- file(APPEND ${_FN} ${ARG} "\n")
- endforeach()
-
- file(APPEND ${_FN} ${ARG} "\n[options]\n")
- foreach(ARG ${ARGUMENTS_OPTIONS})
- file(APPEND ${_FN} ${ARG} "\n")
- endforeach()
-
- file(APPEND ${_FN} ${ARG} "\n[imports]\n")
- foreach(ARG ${ARGUMENTS_IMPORTS})
- file(APPEND ${_FN} ${ARG} "\n")
- endforeach()
-endfunction()
-
-
-macro(conan_load_buildinfo)
- if(CONAN_CMAKE_MULTI)
- set(_CONANBUILDINFO conanbuildinfo_multi.cmake)
- else()
- set(_CONANBUILDINFO conanbuildinfo.cmake)
- endif()
- if(ARGUMENTS_INSTALL_FOLDER)
- set(_CONANBUILDINFOFOLDER ${ARGUMENTS_INSTALL_FOLDER})
- else()
- set(_CONANBUILDINFOFOLDER ${CMAKE_CURRENT_BINARY_DIR})
- endif()
- # Checks for the existence of conanbuildinfo.cmake, and loads it
- # important that it is macro, so variables defined at parent scope
- if(EXISTS "${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}")
- message(STATUS "Conan: Loading ${_CONANBUILDINFO}")
- include(${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO})
- else()
- message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}")
- endif()
-endmacro()
-
-
-macro(conan_cmake_run)
- parse_arguments(${ARGV})
-
- if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE AND NOT CONAN_EXPORTED
- AND NOT ARGUMENTS_BUILD_TYPE)
- set(CONAN_CMAKE_MULTI ON)
- message(STATUS "Conan: Using cmake-multi generator")
- else()
- set(CONAN_CMAKE_MULTI OFF)
- endif()
-
- if(NOT CONAN_EXPORTED)
- conan_cmake_setup_conanfile(${ARGV})
- if(CONAN_CMAKE_MULTI)
- foreach(CMAKE_BUILD_TYPE "Release" "Debug")
- set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE})
- conan_cmake_settings(settings ${ARGV})
- conan_cmake_install(SETTINGS ${settings} ${ARGV})
- endforeach()
- set(CMAKE_BUILD_TYPE)
- else()
- conan_cmake_settings(settings ${ARGV})
- conan_cmake_install(SETTINGS ${settings} ${ARGV})
- endif()
- endif()
-
- if (NOT ARGUMENTS_NO_LOAD)
- conan_load_buildinfo()
- endif()
-
- if(ARGUMENTS_BASIC_SETUP)
- foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS)
- if(ARGUMENTS_${_option})
- if(${_option} STREQUAL "CMAKE_TARGETS")
- list(APPEND _setup_options "TARGETS")
- else()
- list(APPEND _setup_options ${_option})
- endif()
- endif()
- endforeach()
- conan_basic_setup(${_setup_options})
- endif()
-endmacro()
-
-macro(conan_check)
- # Checks conan availability in PATH
- # Arguments REQUIRED and VERSION are optional
- # Example usage:
- # conan_check(VERSION 1.0.0 REQUIRED)
- message(STATUS "Conan: checking conan executable in path")
- set(options REQUIRED)
- set(oneValueArgs VERSION)
- cmake_parse_arguments(CONAN "${options}" "${oneValueArgs}" "" ${ARGN})
-
- find_program(CONAN_CMD conan)
- if(NOT CONAN_CMD AND CONAN_REQUIRED)
- message(FATAL_ERROR "Conan executable not found!")
- endif()
- message(STATUS "Conan: Found program ${CONAN_CMD}")
- execute_process(COMMAND ${CONAN_CMD} --version
- OUTPUT_VARIABLE CONAN_VERSION_OUTPUT
- ERROR_VARIABLE CONAN_VERSION_OUTPUT)
- message(STATUS "Conan: Version found ${CONAN_VERSION_OUTPUT}")
-
- if(DEFINED CONAN_VERSION)
- string(REGEX MATCH ".*Conan version ([0-9]+\.[0-9]+\.[0-9]+)" FOO
- "${CONAN_VERSION_OUTPUT}")
- if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION})
- message(FATAL_ERROR "Conan outdated. Installed: ${CMAKE_MATCH_1}, \
- required: ${CONAN_VERSION}. Consider updating via 'pip \
- install conan==${CONAN_VERSION}'.")
- endif()
- endif()
-endmacro()
-
-macro(conan_add_remote)
- # Adds a remote
- # Arguments URL and NAME are required, INDEX is optional
- # Example usage:
- # conan_add_remote(NAME bincrafters INDEX 1
- # URL https://api.bintray.com/conan/bincrafters/public-conan)
- set(oneValueArgs URL NAME INDEX)
- cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN})
-
- if(DEFINED CONAN_INDEX)
- set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}")
- endif()
-
- message(STATUS "Conan: Adding ${CONAN_NAME} remote repositoy (${CONAN_URL})")
- execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_URL}
- ${CONAN_INDEX_ARG} -f)
-endmacro()
diff --git a/cmake/Modules/DiscoverTests.cmake b/cmake/Modules/DiscoverTests.cmake
deleted file mode 100644
index 882fbf8..0000000
--- a/cmake/Modules/DiscoverTests.cmake
+++ /dev/null
@@ -1,55 +0,0 @@
-#[=[
-Discover all tests in our test suites.
-
-This implementation is adapted vom GoogleTest.cmake
-#]=]
-
-function(discover_tests)
- set(OPTIONS "")
- set(SINGLE_VALUE_KEYWORDS "TARGET")
- set(MULTI_VALUE_KEYWORDS "")
-
- cmake_parse_arguments(DISCOVER_TESTS
- "${OPTIONS}"
- "${SINGLE_VALUE_KEYWORDS}"
- "${MULTI_VALUE_KEYWORDS}"
- ${ARGN}
- )
-
- if(NOT DISCOVER_TESTS_TARGET)
- message(FATAL_ERROR "Missing argument TARGET")
- endif()
-
- if(NOT TARGET "${DISCOVER_TESTS_TARGET}")
- message(FATAL_ERROR "${DISCOVER_TESTS_TARGET} does not name a target known to CMake")
- endif()
-
- set(CTEST_FILE_BASE "${CMAKE_CURRENT_BINARY_DIR}/${DISCOVER_TESTS_TARGET}")
- set(CTEST_INCLUDE_FILE "${CTEST_FILE_BASE}_include.cmake")
- set(CTEST_TESTS_FILE "${CTEST_FILE_BASE}_tests.cmake")
-
- add_custom_command(TARGET "${DISCOVER_TESTS_TARGET}"
- POST_BUILD
- BYPRODUCTS "${CTEST_TESTS_FILE}"
- COMMAND "${CMAKE_COMMAND}"
- "-D" "TEST_TARGET=${DISCOVER_TESTS_TARGET}"
- "-D" "TEST_EXECUTABLE=$<TARGET_FILE:${DISCOVER_TESTS_TARGET}>"
- "-D" "TEST_WORKING_DIR=${CMAKE_CURRENT_BINARY_DIR}"
- "-D" "CTEST_FILE=${CTEST_TESTS_FILE}"
- "-P" "${PROJECT_SOURCE_DIR}/cmake/Modules/DiscoverTestsImpl.cmake"
- VERBATIM
- )
-
- file(WRITE "${CTEST_INCLUDE_FILE}"
- "if(EXISTS \"${CTEST_TESTS_FILE}\")\n"
- " include(\"${CTEST_TESTS_FILE}\")\n"
- "else()\n"
- " add_test(${TARGET}_NOT_BUILT ${TARGET}_NOT_BUILT)\n"
- "endif()\n"
- )
-
- set_property(DIRECTORY
- APPEND
- PROPERTY TEST_INCLUDE_FILES "${CTEST_INCLUDE_FILE}"
- )
-endfunction() \ No newline at end of file
diff --git a/cmake/Modules/DiscoverTestsImpl.cmake b/cmake/Modules/DiscoverTestsImpl.cmake
deleted file mode 100644
index 893d998..0000000
--- a/cmake/Modules/DiscoverTestsImpl.cmake
+++ /dev/null
@@ -1,39 +0,0 @@
-#[=[
-Discover all tests in our test suites.
-
-This implementation is adapted vom GoogleTestAddTests.cmake
-#]=]
-
-set(SCRIPT)
-
-function(add_command CMD EXE TEST)
-endfunction()
-
-if(NOT EXISTS "${TEST_EXECUTABLE}")
- message(FATAL_ERROR "The test driver ${TEST_EXECUTABLE} does not exist.")
-endif()
-
-execute_process(COMMAND ${TEST_EXECUTABLE} "--tests"
- WORKING_DIRECTORY "${TEST_WORKING_DIR}"
- TIMEOUT "5"
- OUTPUT_VARIABLE "TEST_LIST_OUTPUT"
- RESULT_VARIABLE "TEST_LIST_RESULT"
-)
-
-if(NOT ${TEST_LIST_RESULT} EQUAL 0)
- message(FATAL_ERROR "Error while discovering tests:\n"
- "Executable: ${TEST_EXECUTABLE}\n"
- "Result: ${TEST_LIST_RESULT}\n"
- "Output:\n"
- " ${TEST_LIST_OUTPUT}\n"
- )
-endif()
-
-string(REPLACE "\n" ";" TEST_LIST_OUTPUT "${TEST_LIST_OUTPUT}")
-
-foreach(LINE ${TEST_LIST_OUTPUT})
- string(REPLACE "#" ": " TEST_NAME "${LINE}")
- set(SCRIPT "${SCRIPT}add_test(\"${TEST_NAME}\" \"${TEST_EXECUTABLE}\" \"${LINE}\")\n")
-endforeach()
-
-file(WRITE "${CTEST_FILE}" "${SCRIPT}") \ No newline at end of file
diff --git a/cmake/config.cmake.in b/cmake/config.cmake.in
deleted file mode 100644
index f07fcfd..0000000
--- a/cmake/config.cmake.in
+++ /dev/null
@@ -1,4 +0,0 @@
-@PACKAGE_INIT@
-
-include("${CMAKE_CURRENT_LIST_DIR}/newtypeTargets.cmake")
-check_required_components("@PROJECT_NAME@") \ No newline at end of file
diff --git a/conanfile.py b/conanfile.py
index 000831e..990b8ac 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -1,50 +1,72 @@
-import re
-
-from conans import ConanFile, CMake
-from conans.tools import load
-
-
-def read_project_property(property):
- try:
- cmake_lists = load("CMakeLists.txt")
- value = re.search(r"project\(.*{} \"(.*?)\"".format(property), cmake_lists, re.S).group(1)
- return value.strip()
- except:
- return None
+from conan import ConanFile
+from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
+from conan.tools.build import check_min_cppstd
class NewtypeConan(ConanFile):
name = "newtype"
+ version = "2.0.0"
+ license = "BSD-3-Clause"
+ description = "A library of types and functions to create strong type aliases"
+ url = "https://github.com/fmorgner/newtype"
+
+ settings = ("os", "arch", "compiler", "build_type")
+
scm = {
"type": "git",
- "url": "https://github.com/fmorgner/newtype.git",
- "revision": "auto",
+ "url": "auto",
+ "revision": "auto"
+ }
+
+ options = {
+ "enable_docs": [False, True],
}
- settings = None
- version = read_project_property("VERSION")
- license = "BSD-3-Clause"
- url = "https://github.com/fmorgner/newtype"
- description = read_project_property("DESCRIPTION")
- generators = "cmake"
- build_requires = (
- "CUTE/2.2.6@fmorgner/stable",
- "lyra/1.2.0"
- )
-
- def _configure_cmake(self):
- cmake = CMake(self)
- cmake.definitions["BUILD_TESTING"] = True
- cmake.definitions["RUN_TESTS_AFTER_BUILD"] = True
- cmake.configure()
- return cmake
+
+ default_options = {
+ "enable_docs": False,
+ }
+
+ generators = [
+ "CMakeDeps"
+ ]
+
+ exports_sources = [
+ "source/*",
+ "test_package/*",
+ "LICENSE",
+ ]
def build(self):
- cmake = self._configure_cmake()
+ cmake = CMake(self)
+ cmake.configure()
cmake.build()
+ cmake.test()
+
+ def build_requirements(self):
+ self.tool_requires("cmake/[~3.25]")
+ self.tool_requires("ninja/[~1.11]")
+ self.test_requires("catch2/[~3.3]")
+
+ def generate(self):
+ toolchain = CMakeToolchain(self)
+ toolchain.variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = True
+ toolchain.variables["PROJECT_VERSION"] = self.version
+ toolchain.variables["PROJECT_DESCRIPTION"] = self.description
+ toolchain.generate()
+
+ def layout(self):
+ cmake_layout(self, generator="Ninja Multi-Config", src_folder="source")
def package(self):
- cmake = self._configure_cmake()
+ cmake = CMake(self)
cmake.install()
def package_id(self):
- self.info.header_only() \ No newline at end of file
+ self.info.clear()
+
+ def package_info(self):
+ self.cpp_info.bindirs = []
+ self.cpp_info.libdirs = []
+
+ def validate(self):
+ check_min_cppstd(self, 20)
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
new file mode 100644
index 0000000..0bd0876
--- /dev/null
+++ b/source/CMakeLists.txt
@@ -0,0 +1,88 @@
+cmake_minimum_required(VERSION "3.25.0")
+
+project("newtype"
+ LANGUAGES CXX
+ DESCRIPTION "A library of types and functions to create strong type aliases"
+)
+
+enable_testing()
+
+# Project dependencies
+
+find_package("Catch2" "3.1"
+ COMPONENTS "Catch2WithMain"
+ REQUIRED
+)
+
+include("Catch")
+
+# Project Options
+
+option(BUILD_EXAMPLES "Build the library examples" OFF)
+
+# 'newtype' library
+
+add_library("${PROJECT_NAME}" INTERFACE)
+
+target_include_directories("${PROJECT_NAME}" INTERFACE
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:include>
+)
+
+target_compile_features("${PROJECT_NAME}" INTERFACE
+ "cxx_std_20"
+)
+
+install(TARGETS "${PROJECT_NAME}"
+ EXPORT "${PROJECT_NAME}Targets"
+ PUBLIC_HEADER DESTINATION "include"
+)
+
+install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
+ DESTINATION "include"
+)
+
+add_library("${PROJECT_NAME}::${PROJECT_NAME}" ALIAS "${PROJECT_NAME}")
+
+# 'newtype' tests
+
+add_executable("${PROJECT_NAME}_tests"
+ "test/src/arithmetic.cpp"
+ # "test/src/conversion_suite.cpp"
+ # "test/src/derivation_clause_suite.cpp"
+ # "test/src/equality_comparison_suite.cpp"
+ # "test/src/hash_suite.cpp"
+ # "test/src/io_operators_suite.cpp"
+ # "test/src/iterable_suite.cpp"
+ # "test/src/new_type_constructor_suite.cpp"
+ # "test/src/relational_operators_suite.cpp"
+)
+
+target_link_libraries("${PROJECT_NAME}_tests"
+ "${PROJECT_NAME}::${PROJECT_NAME}"
+ "Catch2::Catch2WithMain"
+)
+
+target_compile_options("${PROJECT_NAME}_tests" PRIVATE
+ "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wall>"
+ "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wextra>"
+ "$<$<CXX_COMPILER_ID:GNU,Clang>:-Werror>"
+ "$<$<CXX_COMPILER_ID:GNU,Clang>:-pedantic-errors>"
+)
+
+catch_discover_tests("${PROJECT_NAME}_tests")
+
+# 'newtype' examples
+
+if(BUILD_EXAMPLES)
+ function(add_example NAME)
+ add_executable("ex_${NAME}"
+ "examples/src/${NAME}.cpp"
+ )
+ target_link_libraries("ex_${NAME}" "${PROJECT_NAME}")
+ endfunction()
+
+ add_example("basic_usage")
+ add_example("basic_usage_with_show")
+ add_example("basic_usage_with_read")
+endif()
diff --git a/examples/src/basic_usage.cpp b/source/examples/src/basic_usage.cpp
index 35d1d2c..35d1d2c 100644
--- a/examples/src/basic_usage.cpp
+++ b/source/examples/src/basic_usage.cpp
diff --git a/examples/src/basic_usage_with_read.cpp b/source/examples/src/basic_usage_with_read.cpp
index 2dabe2e..2dabe2e 100644
--- a/examples/src/basic_usage_with_read.cpp
+++ b/source/examples/src/basic_usage_with_read.cpp
diff --git a/examples/src/basic_usage_with_show.cpp b/source/examples/src/basic_usage_with_show.cpp
index 4bb68f6..4bb68f6 100644
--- a/examples/src/basic_usage_with_show.cpp
+++ b/source/examples/src/basic_usage_with_show.cpp
diff --git a/include/newtype/derivable.hpp b/source/include/newtype/derivable.hpp
index c798c59..c798c59 100644
--- a/include/newtype/derivable.hpp
+++ b/source/include/newtype/derivable.hpp
diff --git a/include/newtype/derivation_clause.hpp b/source/include/newtype/derivation_clause.hpp
index 6de70e1..6de70e1 100644
--- a/include/newtype/derivation_clause.hpp
+++ b/source/include/newtype/derivation_clause.hpp
diff --git a/include/newtype/deriving.hpp b/source/include/newtype/deriving.hpp
index ae10bab..ae10bab 100644
--- a/include/newtype/deriving.hpp
+++ b/source/include/newtype/deriving.hpp
diff --git a/include/newtype/impl/new_type_iterator_types.hpp b/source/include/newtype/impl/new_type_iterator_types.hpp
index 2ea8274..2ea8274 100644
--- a/include/newtype/impl/new_type_iterator_types.hpp
+++ b/source/include/newtype/impl/new_type_iterator_types.hpp
diff --git a/include/newtype/impl/new_type_storage.hpp b/source/include/newtype/impl/new_type_storage.hpp
index f7842af..f7842af 100644
--- a/include/newtype/impl/new_type_storage.hpp
+++ b/source/include/newtype/impl/new_type_storage.hpp
diff --git a/include/newtype/impl/type_traits_extensions.hpp b/source/include/newtype/impl/type_traits_extensions.hpp
index dc41649..dc41649 100644
--- a/include/newtype/impl/type_traits_extensions.hpp
+++ b/source/include/newtype/impl/type_traits_extensions.hpp
diff --git a/include/newtype/newtype.hpp b/source/include/newtype/newtype.hpp
index e2704f3..e2704f3 100644
--- a/include/newtype/newtype.hpp
+++ b/source/include/newtype/newtype.hpp
diff --git a/include/newtype/version.hpp b/source/include/newtype/version.hpp
index 8678514..8678514 100644
--- a/include/newtype/version.hpp
+++ b/source/include/newtype/version.hpp
diff --git a/source/test/src/arithmetic.cpp b/source/test/src/arithmetic.cpp
new file mode 100644
index 0000000..5048393
--- /dev/null
+++ b/source/test/src/arithmetic.cpp
@@ -0,0 +1,300 @@
+#include "newtype/derivable.hpp"
+#include "newtype/deriving.hpp"
+#include "newtype/impl/type_traits_extensions.hpp"
+#include "newtype/newtype.hpp"
+
+#include <catch2/catch_test_macros.hpp>
+
+#include <type_traits>
+
+SCENARIO("Addition", "[arithmetic]")
+{
+ struct addable_type
+ {
+ auto constexpr operator+(addable_type const &) const -> addable_type
+ {
+ return {};
+ };
+ };
+
+ GIVEN("A new_type instance not deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag>;
+
+ THEN("it is not addable")
+ {
+ REQUIRE(!nt::impl::is_addable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is addable")
+ {
+ REQUIRE(nt::impl::is_addable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type over a non-addable class type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<void *, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is not addable")
+ {
+ REQUIRE(!nt::impl::is_addable_v<addable_type> == nt::impl::is_addable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type over an addable class type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<addable_type, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is addable")
+ {
+ REQUIRE(nt::impl::is_addable_v<addable_type> == nt::impl::is_addable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("addition produces the same type")
+ {
+ REQUIRE(std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() + std::declval<type_alias const &>())>);
+ }
+ }
+
+ GIVEN("Two objects of a new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+ auto lhs = type_alias{24};
+ auto rhs = type_alias{18};
+
+ THEN("addition produces the correct result with respect to the base type")
+ {
+ REQUIRE((lhs + rhs).decay() == 24 + 18);
+ }
+ }
+}
+
+SCENARIO("Subtraction", "[arithmetic]")
+{
+ struct subtractable_type
+ {
+ auto constexpr operator-(subtractable_type const &) const -> subtractable_type
+ {
+ return {};
+ };
+ };
+
+ GIVEN("A new_type not deriving nt::arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag>;
+
+ THEN("it is not subtractable")
+ {
+ REQUIRE(!nt::impl::is_subtractable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is subtractable")
+ {
+ REQUIRE(nt::impl::is_subtractable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type over a non-subtractable class type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<void *, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is not addable")
+ {
+ REQUIRE(!nt::impl::is_subtractable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type over a subtractable class type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<subtractable_type, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is subtractable")
+ {
+ REQUIRE(nt::impl::is_subtractable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("subtraction produces the same type")
+ {
+ REQUIRE(std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() - std::declval<type_alias const &>())>);
+ }
+ }
+
+ GIVEN("Two objects of a new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+ auto lhs = type_alias{24};
+ auto rhs = type_alias{18};
+
+ THEN("subtraction produces the correct result with respect to the base type")
+ {
+ REQUIRE((lhs - rhs).decay() == 24 - 18);
+ }
+ }
+}
+
+SCENARIO("Multiplication", "[arithmetic]")
+{
+ struct multipliable_type
+ {
+ auto constexpr operator*(multipliable_type const &) const -> multipliable_type
+ {
+ return {};
+ };
+ };
+
+ GIVEN("A new_type not deriving nt::arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag>;
+
+ THEN("it is not multipliable")
+ {
+ REQUIRE(!nt::impl::is_multipliable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is multipliable")
+ {
+ REQUIRE(nt::impl::is_multipliable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type over a non-multipliable class type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<void *, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is not multipliable")
+ {
+ REQUIRE(!nt::impl::is_multipliable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type over a multipliable class type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<multipliable_type, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is multipliable")
+ {
+ REQUIRE(nt::impl::is_multipliable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("multiplication produces the same type")
+ {
+ REQUIRE(std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() * std::declval<type_alias const &>())>);
+ }
+ }
+
+ GIVEN("Two objects of a new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+ auto lhs = type_alias{24};
+ auto rhs = type_alias{18};
+
+ THEN("multiplication produces the correct result with respect to the base type")
+ {
+ REQUIRE((lhs * rhs).decay() == 24 * 18);
+ }
+ }
+}
+
+SCENARIO("Division", "[arithmetic]")
+{
+ struct dividable_type
+ {
+ auto constexpr operator/(dividable_type const &) const -> dividable_type
+ {
+ return {};
+ };
+ };
+
+ GIVEN("A new_type not deriving nt::arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag>;
+
+ THEN("it is not divisible")
+ {
+ REQUIRE(!nt::impl::is_dividable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is divisible")
+ {
+ REQUIRE(nt::impl::is_dividable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type over a non-divisible class type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<void *, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is not divisible")
+ {
+ REQUIRE(!nt::impl::is_dividable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type over a divisible class type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<dividable_type, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("it is divisible")
+ {
+ REQUIRE(nt::impl::is_dividable_v<type_alias>);
+ }
+ }
+
+ GIVEN("A new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+
+ THEN("division produces the same type")
+ {
+ REQUIRE(std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() / std::declval<type_alias const &>())>);
+ }
+ }
+
+ GIVEN("Two objects of a new_type deriving nt::Arithmetic")
+ {
+ using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
+ auto lhs = type_alias{30};
+ auto rhs = type_alias{15};
+
+ THEN("division produces the correct result with respect to the base type")
+ {
+ REQUIRE((lhs / rhs).decay() == 30 / 15);
+ }
+ }
+}
diff --git a/test/src/conversion_suite.cpp b/source/test/src/conversion_suite.cpp
index cbe2463..cbe2463 100644
--- a/test/src/conversion_suite.cpp
+++ b/source/test/src/conversion_suite.cpp
diff --git a/test/src/derivation_clause_suite.cpp b/source/test/src/derivation_clause_suite.cpp
index 86a34ab..86a34ab 100644
--- a/test/src/derivation_clause_suite.cpp
+++ b/source/test/src/derivation_clause_suite.cpp
diff --git a/test/src/equality_comparison_suite.cpp b/source/test/src/equality_comparison_suite.cpp
index 4e484f4..4e484f4 100644
--- a/test/src/equality_comparison_suite.cpp
+++ b/source/test/src/equality_comparison_suite.cpp
diff --git a/test/src/hash_suite.cpp b/source/test/src/hash_suite.cpp
index b482414..b482414 100644
--- a/test/src/hash_suite.cpp
+++ b/source/test/src/hash_suite.cpp
diff --git a/test/src/io_operators_suite.cpp b/source/test/src/io_operators_suite.cpp
index 4e146a7..4e146a7 100644
--- a/test/src/io_operators_suite.cpp
+++ b/source/test/src/io_operators_suite.cpp
diff --git a/test/src/iterable_suite.cpp b/source/test/src/iterable_suite.cpp
index add4696..add4696 100644
--- a/test/src/iterable_suite.cpp
+++ b/source/test/src/iterable_suite.cpp
diff --git a/test/src/new_type_constructor_suite.cpp b/source/test/src/new_type_constructor_suite.cpp
index fc3e9f6..fc3e9f6 100644
--- a/test/src/new_type_constructor_suite.cpp
+++ b/source/test/src/new_type_constructor_suite.cpp
diff --git a/test/src/relational_operators_suite.cpp b/source/test/src/relational_operators_suite.cpp
index 64fcba0..64fcba0 100644
--- a/test/src/relational_operators_suite.cpp
+++ b/source/test/src/relational_operators_suite.cpp
diff --git a/test/include/arithmetic_suite.hpp b/test/include/arithmetic_suite.hpp
deleted file mode 100644
index 1eb4af8..0000000
--- a/test/include/arithmetic_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_ARITHMETIC_SUITE_HPP
-#define NEWTYPE_TEST_ARITHMETIC_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto arithmetic_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/conversion_suite.hpp b/test/include/conversion_suite.hpp
deleted file mode 100644
index 8b9c337..0000000
--- a/test/include/conversion_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_CONVERSION_SUITE_HPP
-#define NEWTYPE_TEST_CONVERSION_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto conversion_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/derivation_clause_suite.hpp b/test/include/derivation_clause_suite.hpp
deleted file mode 100644
index b5ef5c2..0000000
--- a/test/include/derivation_clause_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_DERIVATION_CLAUSE_SUITE_HPP
-#define NEWTYPE_TEST_DERIVATION_CLAUSE_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto derivation_clause_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/equality_comparison_suite.hpp b/test/include/equality_comparison_suite.hpp
deleted file mode 100644
index 80abbe7..0000000
--- a/test/include/equality_comparison_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_EQUALITY_COMPARISON_SUITE_HPP
-#define NEWTYPE_TEST_EQUALITY_COMPARISON_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto equality_comparison_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/hash_suite.hpp b/test/include/hash_suite.hpp
deleted file mode 100644
index 0ef51bc..0000000
--- a/test/include/hash_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_HASH_SUITE_HPP
-#define NEWTYPE_TEST_HASH_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto hash_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/io_operators_suite.hpp b/test/include/io_operators_suite.hpp
deleted file mode 100644
index c7af2ee..0000000
--- a/test/include/io_operators_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_IO_OPERATORS_SUITE_HPP
-#define NEWTYPE_TEST_IO_OPERATORS_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto io_operators_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/iterable_suite.hpp b/test/include/iterable_suite.hpp
deleted file mode 100644
index c2bbc6e..0000000
--- a/test/include/iterable_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_ITERABLE_SUITE_HPP
-#define NEWTYPE_TEST_ITERABLE_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto iterable_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/kawaii.hpp b/test/include/kawaii.hpp
deleted file mode 100644
index 9084b56..0000000
--- a/test/include/kawaii.hpp
+++ /dev/null
@@ -1,143 +0,0 @@
-#ifndef NEWTYPE_TEST_KAWAII_HPP
-#define NEWTYPE_TEST_KAWAII_HPP
-
-#include <cute/cute_test.h>
-
-#include <algorithm>
-#include <array>
-#include <cctype>
-#include <iterator>
-#include <sstream>
-#include <string>
-#include <utility>
-
-namespace nt::test
-{
-
- namespace impl
- {
- auto constexpr prepositions = std::array{"a", "an", "and", "as", "at", "by", "for", "in", "of", "on", "or", "the", "to"};
- auto constexpr keywords = std::array{"noexcept"};
- auto constexpr type_names = std::array{"new_type", "derivation_clause", "unordered_map"};
-
- auto inline replace_template_argument_syntax(std::string const & name) -> std::string
- {
- using namespace std::string_literals;
-
- auto template_argument_start = find(cbegin(name), cend(name), '<');
-
- if (template_argument_start == cend(name))
- {
- return name;
- }
-
- auto replaced{""s};
-
- copy(cbegin(name), template_argument_start, back_inserter(replaced));
-
- replaced += " [ T = ";
-
- auto template_argument_end = find(template_argument_start, cend(name), '>');
-
- copy(template_argument_start + 1, template_argument_end, back_inserter(replaced));
-
- return replaced + " ]";
- }
-
- auto inline is_prefix(std::string const & suspect, std::string const & of) -> bool
- {
- if (suspect.size() > of.size())
- {
- return false;
- }
- return equal(cbegin(suspect), cend(suspect), cbegin(of));
- }
-
- auto inline is_type_name_prefix(std::string const & suspect) -> bool
- {
- return std::any_of(cbegin(type_names), cend(type_names), [&](auto type_name) { return is_prefix(suspect, type_name); });
- }
-
- auto inline wordify(std::string const & name)
- {
- using namespace std::string_literals;
- using namespace impl;
-
- auto stream = std::stringstream{name};
- auto output{""s};
-
- while (stream)
- {
- auto current_char = static_cast<char>(stream.get());
-
- if (current_char == '_')
- {
- if (stream.peek() != '_')
- {
- output += ' ';
- }
- else
- {
- output += current_char;
- stream.ignore();
- }
- }
- else if (current_char != EOF)
- {
- output += current_char;
- }
- }
-
- return output;
- }
-
- auto inline titelize(std::string const & name) -> std::string
- {
- using namespace std::string_literals;
-
- auto stream = std::istringstream{name};
- auto buffer{""s};
- auto word{""s};
- auto first{false};
-
- while (stream >> word && word != "[")
- {
- auto is_preposition = std::find(cbegin(prepositions), cend(prepositions), word) != cend(prepositions);
- auto is_keyword = std::find(cbegin(keywords), cend(keywords), word) != cend(keywords);
- auto is_type_name = std::find(cbegin(type_names), cend(type_names), word) != cend(type_names);
- if ((!(is_preposition || is_keyword) || buffer.empty()) && !is_type_name)
- {
- word.front() = std::toupper(word.front());
- }
- buffer += (first ? "" : " ") + word;
- first = false;
- }
-
- auto rest{""s};
-
- if (stream)
- {
- buffer += " " + word;
- std::getline(stream, rest);
- }
-
- return buffer + rest;
- }
-
- } // namespace impl
-
- auto inline go_full_kawaii(std::string kowai) -> std::string
- {
- using namespace impl;
-
- auto template_free = replace_template_argument_syntax(kowai);
- auto wordified = wordify(template_free);
-
- return titelize(wordified);
- }
-
-} // namespace nt::test
-
-#define KAWAII(name) cute::test((&name), nt::test::go_full_kawaii(#name))
-
-#endif \ No newline at end of file
diff --git a/test/include/new_type_constructor_suite.hpp b/test/include/new_type_constructor_suite.hpp
deleted file mode 100644
index 38c3cba..0000000
--- a/test/include/new_type_constructor_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_NEW_TYPE_SUITE_HPP
-#define NEWTYPE_TEST_NEW_TYPE_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto new_type_constructor_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/include/relational_operators_suite.hpp b/test/include/relational_operators_suite.hpp
deleted file mode 100644
index 259834b..0000000
--- a/test/include/relational_operators_suite.hpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef NEWTYPE_TEST_RELATIONAL_OPERATORS_SUITE_HPP
-#define NEWTYPE_TEST_RELATIONAL_OPERATORS_SUITE_HPP
-
-#include <cute/cute_suite.h>
-
-#include <string>
-#include <utility>
-
-auto relational_operators_suite() -> std::pair<cute::suite, std::string>;
-
-#endif \ No newline at end of file
diff --git a/test/src/arithmetic_suite.cpp b/test/src/arithmetic_suite.cpp
deleted file mode 100644
index 0d8cfa8..0000000
--- a/test/src/arithmetic_suite.cpp
+++ /dev/null
@@ -1,330 +0,0 @@
-#include "arithmetic_suite.hpp"
-
-#include "kawaii.hpp"
-#include "newtype/derivable.hpp"
-#include "newtype/deriving.hpp"
-#include "newtype/impl/type_traits_extensions.hpp"
-#include "newtype/newtype.hpp"
-
-#include <cute/cute.h>
-
-#include <type_traits>
-
-namespace
-{
-
- struct addable_type
- {
- auto constexpr operator+(addable_type const &) const -> addable_type
- {
- return {};
- };
- };
-
- struct subtractable_type
- {
- auto constexpr operator-(subtractable_type const &) const -> subtractable_type
- {
- return {};
- };
- };
-
- struct multipliable_type
- {
- auto constexpr operator*(multipliable_type const &)const -> multipliable_type
- {
- return {};
- };
- };
-
- struct dividable_type
- {
- auto constexpr operator/(dividable_type const &) const -> dividable_type
- {
- return {};
- };
- };
-
-} // namespace
-
-inline namespace addition_tests
-{
-
- auto a_new__type_not_deriving_arithmetic_is_not_addable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag>;
- ASSERT(!(nt::impl::is_addable_v<type_alias>));
- }
-
- auto a_new__type_deriving_arithmetic_is_addable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT(nt::impl::is_addable_v<type_alias>);
- }
-
- template<typename T>
- auto a_new__type_deriving_arithmetic_is_addable_with_instances_of_itself_if_the_base_type_is_addable() -> void
- {
- static_assert(nt::impl::is_addable_v<T>, "Sanity Check");
- using type_alias = nt::new_type<T, struct tag, deriving(nt::Arithmetic)>;
- ASSERT_EQUAL(nt::impl::is_addable_v<T>, nt::impl::is_addable_v<type_alias>);
- }
-
- auto addition_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() + std::declval<type_alias const &>())>));
- }
-
- auto addition_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto lhs = type_alias{24};
- auto rhs = type_alias{18};
- ASSERT_EQUAL(24 + 18, (lhs + rhs).decay());
- }
-
-} // namespace addition_tests
-
-inline namespace subtraction_tests
-{
-
- auto a_new__type_not_deriving_arithmetic_is_not_subtractable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag>;
- ASSERT(!(nt::impl::is_subtractable_v<type_alias>));
- }
-
- auto a_new__type_deriving_arithmetic_is_subtractable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT(nt::impl::is_subtractable_v<type_alias>);
- }
-
- template<typename T>
- auto a_new__type_deriving_arithmetic_is_subtractable_with_instances_of_itself_if_the_base_type_is_subtractable() -> void
- {
- static_assert(nt::impl::is_subtractable_v<T>, "Sanity Check");
- using type_alias = nt::new_type<T, struct tag, deriving(nt::Arithmetic)>;
- ASSERT_EQUAL(nt::impl::is_subtractable_v<T>, nt::impl::is_subtractable_v<type_alias>);
- }
-
- auto subtraction_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() - std::declval<type_alias const &>())>));
- }
-
- auto subtraction_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto lhs = type_alias{24};
- auto rhs = type_alias{18};
- ASSERT_EQUAL(24 - 18, (lhs - rhs).decay());
- }
-
-} // namespace subtraction_tests
-
-inline namespace multiplication_tests
-{
-
- auto a_new__type_not_deriving_arithmetic_is_not_multipliable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag>;
- ASSERT(!(nt::impl::is_multipliable_v<type_alias>));
- }
-
- auto a_new__type_deriving_arithmetic_is_multipliable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT(nt::impl::is_multipliable_v<type_alias>);
- }
-
- template<typename T>
- auto a_new__type_deriving_arithmetic_is_multipliable_with_instances_of_itself_if_the_base_type_is_multipliable() -> void
- {
- static_assert(nt::impl::is_multipliable_v<T>, "Sanity Check");
- using type_alias = nt::new_type<T, struct tag, deriving(nt::Arithmetic)>;
- ASSERT_EQUAL(nt::impl::is_multipliable_v<T>, nt::impl::is_multipliable_v<type_alias>);
- }
-
- auto multiplication_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() * std::declval<type_alias const &>())>));
- }
-
- auto multiplication_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto lhs = type_alias{24};
- auto rhs = type_alias{18};
- ASSERT_EQUAL(24 * 18, (lhs * rhs).decay());
- }
-
-} // namespace multiplication_tests
-
-inline namespace division_tests
-{
-
- auto a_new__type_not_deriving_arithmetic_is_not_dividable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag>;
- ASSERT(!(nt::impl::is_dividable_v<type_alias>));
- }
-
- auto a_new__type_deriving_arithmetic_is_dividable_with_instances_of_itself() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT(nt::impl::is_dividable_v<type_alias>);
- }
-
- template<typename T>
- auto a_new__type_deriving_arithmetic_is_dividable_with_instances_of_itself_if_the_base_type_is_dividable() -> void
- {
- static_assert(nt::impl::is_dividable_v<T>, "Sanity Check");
- using type_alias = nt::new_type<T, struct tag, deriving(nt::Arithmetic)>;
- ASSERT_EQUAL(nt::impl::is_dividable_v<T>, nt::impl::is_dividable_v<type_alias>);
- }
-
- auto division_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias, decltype(std::declval<type_alias const &>() / std::declval<type_alias const &>())>));
- }
-
- auto division_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto lhs = type_alias{24};
- auto rhs = type_alias{2};
- ASSERT_EQUAL(24 / 2, (lhs / rhs).decay());
- }
-
-} // namespace division_tests
-
-inline namespace compound_arithmetic
-{
-
- auto addition_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias &, decltype(std::declval<type_alias &>() += std::declval<type_alias const &>())>));
- }
-
- auto addition_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type()
- -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto elhs = 42;
- auto erhs = 18;
- auto lhs = type_alias{elhs};
- auto rhs = type_alias{erhs};
- ASSERT_EQUAL(elhs += erhs, (lhs += rhs).decay());
- }
-
- auto subtraction_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias &, decltype(std::declval<type_alias &>() -= std::declval<type_alias const &>())>));
- }
-
- auto subtraction_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type()
- -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto elhs = 42;
- auto erhs = 18;
- auto lhs = type_alias{elhs};
- auto rhs = type_alias{erhs};
- ASSERT_EQUAL(elhs -= erhs, (lhs -= rhs).decay());
- }
-
- auto multiplication_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias &, decltype(std::declval<type_alias &>() *= std::declval<type_alias const &>())>));
- }
-
- auto multiplication_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type()
- -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto elhs = 42;
- auto erhs = 18;
- auto lhs = type_alias{elhs};
- auto rhs = type_alias{erhs};
- ASSERT_EQUAL(elhs *= erhs, (lhs *= rhs).decay());
- }
-
- auto division_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type() -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- ASSERT((std::is_same_v<type_alias &, decltype(std::declval<type_alias &>() /= std::declval<type_alias const &>())>));
- }
-
- auto division_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type()
- -> void
- {
- using type_alias = nt::new_type<int, struct tag, deriving(nt::Arithmetic)>;
- auto elhs = 42;
- auto erhs = 18;
- auto lhs = type_alias{elhs};
- auto rhs = type_alias{erhs};
- ASSERT_EQUAL(elhs /= erhs, (lhs /= rhs).decay());
- }
-
-} // namespace compound_arithmetic
-
-auto arithmetic_suite() -> std::pair<cute::suite, std::string>
-{
- return {
- {
- // clang-format off
-
- /// Addition Tests
- KAWAII(a_new__type_not_deriving_arithmetic_is_not_addable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_addable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_addable_with_instances_of_itself_if_the_base_type_is_addable<int>),
- KAWAII(a_new__type_deriving_arithmetic_is_addable_with_instances_of_itself_if_the_base_type_is_addable<addable_type>),
- KAWAII(addition_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(addition_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
-
- /// Subtraction Tests
- KAWAII(a_new__type_not_deriving_arithmetic_is_not_subtractable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_subtractable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_subtractable_with_instances_of_itself_if_the_base_type_is_subtractable<int>),
- KAWAII(a_new__type_deriving_arithmetic_is_subtractable_with_instances_of_itself_if_the_base_type_is_subtractable<subtractable_type>),
- KAWAII(subtraction_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(subtraction_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
-
- /// Multiplication Tests
- KAWAII(a_new__type_not_deriving_arithmetic_is_not_multipliable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_multipliable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_multipliable_with_instances_of_itself_if_the_base_type_is_multipliable<int>),
- KAWAII(a_new__type_deriving_arithmetic_is_multipliable_with_instances_of_itself_if_the_base_type_is_multipliable<multipliable_type>),
- KAWAII(multiplication_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(multiplication_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
-
- /// Division Tests
- KAWAII(a_new__type_not_deriving_arithmetic_is_not_dividable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_dividable_with_instances_of_itself),
- KAWAII(a_new__type_deriving_arithmetic_is_dividable_with_instances_of_itself_if_the_base_type_is_dividable<int>),
- KAWAII(a_new__type_deriving_arithmetic_is_dividable_with_instances_of_itself_if_the_base_type_is_dividable<dividable_type>),
- KAWAII(division_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(division_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
-
- /// Compound Arithmetic Tests
- KAWAII(addition_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(addition_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
- KAWAII(subtraction_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(subtraction_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
- KAWAII(multiplication_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(multiplication_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
- KAWAII(division_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_an_instance_of_the_same_new__type),
- KAWAII(division_assignment_of_two_instances_of_a_new__type_deriving_arithmetic_produces_the_correct_value_with_respect_to_the_base_type),
-
- // clang-format on
- },
- "Arithmetic Operators Tests"};
-} \ No newline at end of file
diff --git a/test/src/driver.cpp b/test/src/driver.cpp
deleted file mode 100644
index a0e8904..0000000
--- a/test/src/driver.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-#include "arithmetic_suite.hpp"
-#include "conversion_suite.hpp"
-#include "derivation_clause_suite.hpp"
-#include "equality_comparison_suite.hpp"
-#include "hash_suite.hpp"
-#include "io_operators_suite.hpp"
-#include "iterable_suite.hpp"
-#include "new_type_constructor_suite.hpp"
-#include "relational_operators_suite.hpp"
-
-#include <cute/cute.h>
-#include <cute/cute_runner.h>
-#include <cute/tap_listener.h>
-
-#include <lyra/arg.hpp>
-#include <lyra/cli_parser.hpp>
-#include <lyra/help.hpp>
-#include <lyra/opt.hpp>
-
-#include <algorithm>
-#include <cstdlib>
-#include <iostream>
-#include <iterator>
-#include <numeric>
-#include <string>
-#include <utility>
-#include <vector>
-
-using suite_list = std::vector<std::pair<cute::suite, std::string>>;
-
-auto get_test_selectors(suite_list const & suites) -> std::vector<std::string>
-{
- auto selectors = std::vector<std::string>{};
-
- for_each(cbegin(suites), cend(suites), [&](auto descriptor) {
- auto const & [suite, name] = descriptor;
- transform(cbegin(suite), cend(suite), std::back_inserter(selectors), [&, name = name](auto test) { return name + "#" + test.name(); });
- });
-
- return selectors;
-}
-
-auto do_run_tests(suite_list const & suites, int argc, char ** argv) -> bool
-{
- auto listener = cute::tap_listener<>{};
- auto runner = cute::makeRunner(listener, argc, argv);
-
- return accumulate(cbegin(suites), cend(suites), true, [&](auto accumulator, auto const & descriptor) {
- auto const & [suite, name] = descriptor;
- return accumulator && runner(suite, name.c_str());
- });
-}
-
-int main(int argc, char ** argv)
-{
- auto suites = std::vector{
- derivation_clause_suite(),
- new_type_constructor_suite(),
- conversion_suite(),
- equality_comparison_suite(),
- relational_operators_suite(),
- io_operators_suite(),
- arithmetic_suite(),
- hash_suite(),
- iterable_suite(),
- };
-
- auto selectors = get_test_selectors(suites);
-
- auto list_tests{false};
- auto list_suites{false};
- auto show_help{false};
- auto selected_tests = std::vector<std::string>{};
-
- auto cli = lyra::cli_parser() | //
- lyra::opt(list_tests)["-t"]["--tests"]("List all registered tests") | //
- lyra::opt(list_suites)["-s"]["--suites"]("List all registered suites") | //
- lyra::arg(selected_tests, "test selector")("A pattern to select a specific test") | //
- lyra::help(show_help);
- auto result = cli.parse({argc, argv});
-
- if (list_tests)
- {
- copy(cbegin(selectors), cend(selectors), std::ostream_iterator<std::string>{std::cout, "\n"});
- }
- if (list_suites)
- {
- transform(cbegin(suites), cend(suites), std::ostream_iterator<std::string>{std::cout, "\n"}, [](auto descriptor) {
- auto const & [_, name] = descriptor;
- return name;
- });
- }
- else if (!result || show_help)
- {
- std::cout << cli;
- }
- else
- {
- return do_run_tests(suites, argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE;
- }
-} \ No newline at end of file
diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt
index 1aafacf..f511e49 100644
--- a/test_package/CMakeLists.txt
+++ b/test_package/CMakeLists.txt
@@ -1,10 +1,13 @@
-cmake_minimum_required(VERSION "3.0")
+cmake_minimum_required(VERSION "3.25")
project("TestPackage" CXX)
-set(CMAKE_CXX_STANDARD "20")
+find_package("newtype")
-include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
-conan_basic_setup()
+add_executable("${PROJECT_NAME}"
+ "main.cpp"
+)
-add_executable("test_package" "main.cpp") \ No newline at end of file
+target_link_libraries("${PROJECT_NAME}" PRIVATE
+ "newtype::newtype"
+)
diff --git a/test_package/conanfile.py b/test_package/conanfile.py
index 0b12b5f..ae8c241 100644
--- a/test_package/conanfile.py
+++ b/test_package/conanfile.py
@@ -1,11 +1,12 @@
import os
-from conans import ConanFile, CMake
+from conan import ConanFile
+from conan.tools.cmake import CMake, cmake_layout
class NewtypeTestConan(ConanFile):
- settings = None
- requires = "newtype/[~=1.0]@fmorgner/stable"
- generators = "cmake"
+ settings = ("os", "arch", "compiler", "build_type")
+ requires = "newtype/[~2.0]"
+ generators = "CMakeDeps", "CMakeToolchain"
def build(self):
cmake = CMake(self)
@@ -13,5 +14,8 @@ class NewtypeTestConan(ConanFile):
cmake.build()
def test(self):
- os.chdir("bin")
- self.run(".%stest_package" % os.sep) \ No newline at end of file
+ os.chdir(self.build_folder)
+ self.run(".%sTestPackage" % os.sep)
+
+ def layout(self):
+ cmake_layout(self, generator="Ninja Multi-Config")
diff --git a/test_package/main.cpp b/test_package/main.cpp
index 95fe763..d2efe04 100644
--- a/test_package/main.cpp
+++ b/test_package/main.cpp
@@ -1,4 +1,4 @@
-#include "newtype/new_type.hpp"
+#include "newtype/newtype.hpp"
#include <iostream>