diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..4c71ee9e --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,64 @@ +--- +# +# clang-format v12.0.0 +# +Checks: +'-*, + #TBD llvm-header-guard, + bugprone-*, + cert-*, + clang-analyzer-*, + -clang-analyzer-cplusplus.Move, + cppcoreguidelines-*, + -cppcoreguidelines-macro-usage, + concurrency-*, + #MAYBE google-*, + hicpp-*, + -hicpp-explicit-conversions, + misc-*, + -misc-const-correctness, + -misc-include-cleaner, + modernize-*, + -modernize-type-traits, + -modernize-use-nodiscard, + -modernize-use-trailing-return-type, + performance-*, + portability-*, + readability-*, + -readability-identifier-naming, + -readability-identifier-length, + -readability-simplify-boolean-expr, + -readability-string-compare, + -*-magic-numbers, + -*-narrowing-conversions, + -*-uppercase-literal-suffix, +' + +HeaderFilterRegex: '.*' +WarningsAsErrors: 'clang*' +FormatStyle: google +UseColor: false + +#MAYBE: ... example only +CheckOptions: + - { key: readability-identifier-naming.NamespaceCase, value: CamelCase } + - { key: readability-identifier-naming.ClassCase, value: CamelCase } + - { key: readability-identifier-naming.MemberCase, value: camelBack } + - { key: readability-identifier-naming.MemberPrefix, value: m_ } + - { key: readability-identifier-naming.StructCase, value: lower_case } + - { key: readability-identifier-naming.UnionCase, value: lower_case } + - { key: readability-identifier-naming.TypedefCase, value: lower_case } + - { key: readability-identifier-naming.TypedefSuffix, value: _type } + - { key: readability-identifier-naming.FunctionCase, value: camelBack } + - { key: readability-identifier-naming.EnumCase, value: CamelCase } + - { key: readability-identifier-naming.ConstexprFunctionCase, value: CamelCase } + - { key: readability-identifier-naming.ConstexprMethodCase, value: CamelCase } + - { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase } + - { key: readability-identifier-naming.ClassConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.EnumConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.GlobalConstantPointerCase, value: UPPER_CASE } + - { key: readability-identifier-naming.LocalConstantPointerCase, value: UPPER_CASE } + - { key: readability-identifier-naming.ScopedEnumConstantCase, value: UPPER_CASE } + - { key: readability-identifier-naming.StaticConstantCase, value: UPPER_CASE } +... diff --git a/.github/workflows/api-doc.yml b/.github/workflows/api-doc.yml index c6d56e7c..5135bb9d 100644 --- a/.github/workflows/api-doc.yml +++ b/.github/workflows/api-doc.yml @@ -7,7 +7,7 @@ jobs: name: generate-doxygen runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: install dependencies run: | sudo apt install doxygen graphviz diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 7c99dbab..1aae3971 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -7,7 +7,7 @@ jobs: name: Run SI benchmarks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: install dependencies run: | sudo -H pip3 install setuptools wheel @@ -17,7 +17,6 @@ jobs: - name: Build and run benchmarks with Catch2 run: | - conan install . --output-folder=build --build=missing --settings=build_type=Release cmake --preset=ci-ninja-release cmake --build build --target SI_unit_benchmarks diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c39463e..13b00d01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,41 +12,40 @@ jobs: runs-on: ${{ matrix.os }} strategy: - fail-fast: true + fail-fast: false matrix: name: - [ubuntu-gcc-9, ubuntu-clang-12, macos-apple-clang-11, windows-msvc-19] + [ubuntu-gcc-11, ubuntu-clang-13, macos-apple-clang, windows-msvc-19] include: - - name: ubuntu-gcc-9 + - name: ubuntu-gcc-11 os: ubuntu-22.04 compiler: g++ - compiler-version: 9 + compiler-version: 11 compiler-name-conan: gcc - - name: ubuntu-clang-12 + - name: ubuntu-clang-13 os: ubuntu-22.04 compiler: clang++ - compiler-version: "12" + compiler-version: "13" compiler-name-conan: clang - - name: macos-apple-clang-11 - os: macos-11 - + - name: macos-apple-clang + os: macos-latest + compiler-cppstd: "gnu17" - name: windows-msvc-19 os: windows-2019 configure-preset: "ci-windows-msvc2019" build-preset: "ci-msvc2019-debug" - steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: dependencies (Linux) if: runner.os == 'Linux' run: | sudo apt install shunit2 ninja-build python3-setuptools python3-pip -y sudo pip3 install conan - + - name: dependencies (macos) if: runner.os == 'macOS' @@ -59,7 +58,7 @@ jobs: pip install conan curl -L0 https://github.com/kward/shunit2/archive/v2.1.7.zip --output shunit2.zip unzip -j -n shunit2.zip - + - name: set-compiler-env run: | if [ "${{ matrix.compiler }}" != "" ]; then @@ -71,10 +70,13 @@ jobs: run: | conan profile detect --force if [ "${{ matrix.compiler-name-conan }}" != "" ]; then - sed -i 's/compiler=.*/compiler=${{ matrix.compiler-name-conan }}/g' ~/.conan2/profiles/default + sed -i.bak -e 's/compiler=.*/compiler=${{ matrix.compiler-name-conan }}/g' ~/.conan2/profiles/default fi if [ "${{ matrix.compiler-version }}" != "" ]; then - sed -i 's/compiler.version=[0-9]\+/compiler.version=${{ matrix.compiler-version }}/g' ~/.conan2/profiles/default + sed -i.bak -e 's/compiler.version=[0-9]\+/compiler.version=${{ matrix.compiler-version }}/g' ~/.conan2/profiles/default + fi + if [ "${{ matrix.compiler-cppstd }}" != "" ]; then + sed -i.bak -e 's/compiler.cppstd=gnu[0-9]\+/compiler.cppstd=${{ matrix.compiler-cppstd }}/g' ~/.conan2/profiles/default fi shell: bash @@ -86,16 +88,15 @@ jobs: else cmake --preset=ci-ninja-debug fi - + shell: bash - + - name: build-debug run: | - if [ "${{ matrix.build-preset }}" != "" ]; then cmake --build ./build --preset=${{ matrix.build-preset }} else - cmake --build ./build + cmake --build ./build fi shell: bash @@ -121,7 +122,7 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f7f169e6..4bab0ef8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: - name: build run: | cmake --preset ci-ninja-debug - cmake --build build + cmake --build build - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 diff --git a/CMakeLists.txt b/CMakeLists.txt index df3f67ad..5faa0b8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,9 @@ -cmake_minimum_required(VERSION 3.23) +cmake_minimum_required(VERSION 3.23...3.27) + +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +endif() project( "SI" @@ -9,28 +14,21 @@ project( LANGUAGES CXX) include(GNUInstallDirs) -include(CTest) - -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - set(IS_TOPLEVEL_PROJECT TRUE) -else() - set(IS_TOPLEVEL_PROJECT FALSE) -endif() option(SI_INSTALL_LIBRARY "Enable installing of SI library into default locations" - ${IS_TOPLEVEL_PROJECT}) -option(SI_BUILD_TESTING "Build and run SI tests " ${IS_TOPLEVEL_PROJECT}) -option(SI_BUILD_DOC "Generate SI documentation" ${IS_TOPLEVEL_PROJECT}) + ${PROJECT_IS_TOP_LEVEL}) +option(SI_BUILD_TESTING "Build and run SI tests " ${PROJECT_IS_TOP_LEVEL}) +option(SI_BUILD_DOC "Generate SI documentation" ${PROJECT_IS_TOP_LEVEL}) # Only search for Catch2 if we're doing testing # (this reduces the amount of warnings when added via FetchContent or git submodules) if(SI_BUILD_TESTING) find_package(Catch2) - if (NOT Catch2_FOUND) + if(NOT Catch2_FOUND) message(WARNING "Catch2 not found, not building tests") set(SI_BUILD_TESTING OFF) - endif () + endif() endif() add_library(SI INTERFACE) @@ -45,7 +43,9 @@ target_include_directories( target_compile_features(SI INTERFACE cxx_std_17) -if(BUILD_TESTING AND SI_BUILD_TESTING) +if(SI_BUILD_TESTING) + enable_testing() + include(Catch) add_subdirectory(test) endif() diff --git a/CMakePresets.json b/CMakePresets.json index 35630033..4bb625fe 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,37 +1,52 @@ { - "version": 4, + "version": 6, "cmakeMinimumRequired": { "major": 3, - "minor": 21, + "minor": 25, "patch": 0 }, "configurePresets": [ { "name": "ccache-env", "hidden": true, + "description": "build using ccache", + "cacheVariables": { + "CMAKE_CXX_COMPILER_LAUNCHER ": "ccache" + }, "environment": { "CCACHE_BASEDIR": "${sourceDir}", "CCACHE_SLOPPINESS": "pch_defines,time_macros" } }, + { + "name": "clang-tidy-env", + "hidden": true, + "description": "build using clang-tidy as precompile step", + "cacheVariables": { + "CMAKE_CXX_CLANG_TIDY": "clang-tidy" + }, + "environment": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "YES" + } + }, { "name": "conan-module-path", "hidden": true, + "description": "setup using conan toolchain", + "binaryDir": "${sourceDir}/build", "cacheVariables": { "CMAKE_PREFIX_PATH": "${sourceDir}/build/" } }, { "name": "ci-ninja", - "displayName": "Ninja", + "hidden": true, "description": "build using Ninja generator", "inherits": [ "ccache-env", "conan-module-path" ], - "generator": "Ninja", - "hidden": true, - "binaryDir": "${sourceDir}/build" + "generator": "Ninja" }, { "name": "ci-ninja-debug", @@ -47,6 +62,7 @@ "name": "ci-ninja-release", "displayName": "Ninja Release", "inherits": [ + "clang-tidy-env", "ci-ninja" ], "cacheVariables": { @@ -57,7 +73,6 @@ "name": "ci-windows-msvc2019", "displayName": "MSVC 2019", "generator": "Visual Studio 16 2019", - "binaryDir": "${sourceDir}/build", "inherits": [ "conan-module-path" ], @@ -90,6 +105,96 @@ "lhs": "${hostSystemName}", "rhs": "Windows" } + }, + { + "name": "ci-ninja-debug", + "displayName": "Ninja debug", + "configurePreset": "ci-ninja-debug", + "configuration": "Debug" + }, + { + "name": "ci-ninja-release", + "displayName": "Ninja release", + "configurePreset": "ci-ninja-release", + "configuration": "Release", + "targets": [ "all", "api_doc" ] + } + ], + "testPresets": [ + { + "name": "test-common", + "description": "Test CMake settings that apply to all configurations", + "hidden": true, + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": true + } + }, + { + "name": "ci-ninja-debug", + "displayName": "Strict", + "description": "Enable output and stop on failure", + "inherits": "test-common", + "configurePreset": "ci-ninja-debug" + }, + { + "name": "ci-ninja-release", + "displayName": "Strict", + "description": "Enable output and stop on failure", + "inherits": "test-common", + "configurePreset": "ci-ninja-release" + } + ], + "packagePresets": [ + { + "name": "ci-ninja-release", + "configurePreset": "ci-ninja-release", + "generators": [ + "TGZ" + ] + } + ], + "workflowPresets": [ + { + "name": "ci-ninja-debug", + "steps": [ + { + "type": "configure", + "name": "ci-ninja-debug" + }, + { + "type": "build", + "name": "ci-ninja-debug" + }, + { + "type": "test", + "name": "ci-ninja-debug" + } + ] + }, + { + "name": "ci-ninja-release", + "steps": [ + { + "name": "ci-ninja-release", + "type": "configure" + }, + { + "name": "ci-ninja-release", + "type": "build" + }, + { + "type": "test", + "name": "ci-ninja-release" + }, + { + "name": "ci-ninja-release", + "type": "package" + } + ] } ] -} \ No newline at end of file +} diff --git a/conanfile.txt b/conanfile.txt index b3786fa0..da38c1a8 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,5 +1,5 @@ [requires] -catch2/2.13.10 +catch2/3.4.0 [generators] CMakeDeps \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d02b93ec..8b2f301b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.23) add_executable(SI_detail_tests) target_sources( SI_detail_tests - PRIVATE src/Catch2Main.cc + PRIVATE src/detail_tests/detail_tests.cc src/detail_tests/number_parser_tests.cc src/detail_tests/unit_t_operator_tests.cc @@ -17,7 +17,7 @@ target_include_directories( $) target_compile_features(SI_detail_tests PRIVATE cxx_std_17) -target_link_libraries(SI_detail_tests Catch2::Catch2) +target_link_libraries(SI_detail_tests Catch2::Catch2WithMain) target_compile_options( SI_detail_tests @@ -33,7 +33,7 @@ target_compile_options( add_executable(SI_base_unit_tests) target_sources( SI_base_unit_tests - PRIVATE src/Catch2Main.cc + PRIVATE src/base_unit_tests/mass_tests.cc src/base_unit_tests/time_tests.cc src/base_unit_tests/electric_current_tests.cc @@ -48,7 +48,7 @@ target_include_directories( $) target_compile_features(SI_base_unit_tests PRIVATE cxx_std_17) -target_link_libraries(SI_base_unit_tests Catch2::Catch2) +target_link_libraries(SI_base_unit_tests Catch2::Catch2WithMain) target_compile_options( SI_base_unit_tests @@ -68,7 +68,7 @@ target_compile_options( add_executable(SI_derived_unit_tests) target_sources( SI_derived_unit_tests - PRIVATE src/Catch2Main.cc + PRIVATE src/derived_unit_tests/area_tests.cc src/derived_unit_tests/frequency_tests.cc src/derived_unit_tests/electric_charge_tests.cc @@ -105,7 +105,7 @@ target_include_directories( $) target_compile_features(SI_derived_unit_tests PRIVATE cxx_std_17) -target_link_libraries(SI_derived_unit_tests Catch2::Catch2) +target_link_libraries(SI_derived_unit_tests Catch2::Catch2WithMain) target_compile_options( SI_derived_unit_tests @@ -121,7 +121,8 @@ target_compile_options( add_executable(SI_unit_benchmarks) target_sources( SI_unit_benchmarks - PRIVATE src/Catch2Main.cc src/benchmarks/unit_assignment_benchmarks.cc + PRIVATE + src/benchmarks/unit_assignment_benchmarks.cc src/benchmarks/detail_benchmarks.cc src/benchmarks/string_operations_benchmarks.cc) @@ -131,7 +132,7 @@ target_include_directories( $) target_compile_features(SI_unit_benchmarks PRIVATE cxx_std_17) -target_link_libraries(SI_unit_benchmarks Catch2::Catch2) +target_link_libraries(SI_unit_benchmarks Catch2::Catch2WithMain) target_compile_options( SI_unit_benchmarks diff --git a/test/compilation-tests.sh b/test/compilation-tests.sh index 41cf08f1..6c036394 100755 --- a/test/compilation-tests.sh +++ b/test/compilation-tests.sh @@ -10,15 +10,15 @@ buildSingleTarget() if [ "${2}" == "DEFAULTBUILD" ]; then cmake ${ROOT_DIR}/test/src/compilation_tests/ -B${BUILD_DIR} -DCMAKE_PREFIX_PATH=${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DCMAKE_BUILD_TYPE=Release -G Ninja > /dev/null assertEquals "Configuration successful" 0 $? - + else cmake ${ROOT_DIR}/test/src/compilation_tests/ -B${BUILD_DIR} -DCMAKE_PREFIX_PATH=${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-DSI_DISABLE_IMPLICIT_RATIO_CONVERSION" -G Ninja > /dev/null assertEquals "Configuration successful" 0 $? fi - + cmake --build ${BUILD_DIR} --config Release --target $1 > /dev/null RESULT=$? - + if [ "${3}" == "PASS" ]; then assertEquals "Building successful" 0 $RESULT else @@ -27,14 +27,14 @@ buildSingleTarget() } oneTimeSetUp(){ - + BUILD_DIR=$(mktemp -d) conan install . --output-folder=${BUILD_DIR} --build=missing --settings=build_type=Release 2>&1> /dev/null - + # install SI - cmake ${ROOT_DIR} -B${BUILD_DIR} -DCMAKE_PREFIX_PATH=${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DBUILD_TESTING=off -DCMAKE_BUILD_TYPE=Release -G Ninja > /dev/null + cmake ${ROOT_DIR} -B${BUILD_DIR} -DCMAKE_PREFIX_PATH=${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DSI_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -G Ninja > /dev/null cmake --build ${BUILD_DIR} --config Release --target install > /dev/null - + if [ -d ${BUILD_DIR} ]; then rm -rf ${BUILD_DIR} fi @@ -52,7 +52,7 @@ tearDown(){ } testSISelfSuccessfulCompilationWhenDefaultInvocation() { - + cmake ${ROOT_DIR} -B${BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${BUILD_DIR} -G Ninja > /dev/null assertEquals "Configuration successful" 0 $? cmake --build ${BUILD_DIR} --config Release > /dev/null @@ -60,7 +60,7 @@ testSISelfSuccessfulCompilationWhenDefaultInvocation() { } testSISelfFailedCompilationWhenImplicitConversionDisabled() { - + cmake ${ROOT_DIR} -B${BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${BUILD_DIR} -DCMAKE_CXX_FLAGS="-DSI_DISABLE_IMPLICIT_RATIO_CONVERSION" -G Ninja > /dev/null assertEquals "Configuration successful" 0 $? cmake --build ${BUILD_DIR} --config Release @@ -347,4 +347,4 @@ testCompilationSucceedsWhenNumberParserDoesNotOverflow() # Load shUnit2. -. shunit2 \ No newline at end of file +. shunit2 diff --git a/test/include/catch2/catch.hpp b/test/include/catch2/catch.hpp new file mode 100644 index 00000000..564e5e8a --- /dev/null +++ b/test/include/catch2/catch.hpp @@ -0,0 +1,2 @@ +// see https://github.com/catchorg/Catch2/blob/v3.0.1/docs/migrate-v2-to-v3.md#how-to-migrate-projects-from-v2-to-v3 +#include diff --git a/test/installation-tests.sh b/test/installation-tests.sh index 2cc4d551..5ed4deeb 100755 --- a/test/installation-tests.sh +++ b/test/installation-tests.sh @@ -17,11 +17,11 @@ tearDown() { if [ -d ${SI_BUILD_DIR} ]; then rm -rf ${SI_BUILD_DIR} fi - + if [ -d ${INSTALL_PATH} ]; then rm -rf ${INSTALL_PATH} fi - + if [ -d ${BUILD_DIR} ]; then rm -rf ${BUILD_DIR} fi @@ -29,30 +29,30 @@ tearDown() { testPureCmakeInstallation() { # install SI - cmake ${ROOT_DIR} -B${SI_BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DBUILD_TESTING=off -DCMAKE_BUILD_TYPE=Release + cmake ${ROOT_DIR} -B${SI_BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DSI_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release cmake --build ${SI_BUILD_DIR} --config Release --target install assertEquals "Installation build successful" 0 $? cmake ${ROOT_DIR}/test/installation-tests -B${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} cmake --build ${BUILD_DIR} assertEquals "build against installation successful" 0 $? - + } testPureCmakeInstallationWithInstallOptionTurnedOff() { # install SI - cmake ${ROOT_DIR} -B${SI_BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DBUILD_TESTING=off -DSI_INSTALL_LIBRARY=OFF -DCMAKE_BUILD_TYPE=Release + cmake ${ROOT_DIR} -B${SI_BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DSI_BUILD_TESTING=OFF -DSI_INSTALL_LIBRARY=OFF -DCMAKE_BUILD_TYPE=Release cmake --build ${SI_BUILD_DIR} --config Release --target install assertNotEquals "Installation build successful" 0 $? - + DIRECTORY_CONTENTS=$(ls -A ${INSTALL_PATH}) EMPTY="" assertEquals "Installation directory is empty" "${EMPTY}" "${DIRECTORY_CONTENTS}" - + } testCpackInstallation() { # install SI - cmake ${ROOT_DIR} -B${SI_BUILD_DIR} -DCPACK_PACKAGE_FILE_NAME=install-SI -DBUILD_TESTING=off -DCMAKE_BUILD_TYPE=Release + cmake ${ROOT_DIR} -B${SI_BUILD_DIR} -DCPACK_PACKAGE_FILE_NAME=install-SI -DSI_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release cmake --build ${SI_BUILD_DIR} --config Release --target package assertEquals "Installation build successful" 0 $? if [ "${OS_NAME}" = "Linux" ] || [ "${OS_NAME}" = "Darwin" ]; then @@ -63,13 +63,13 @@ testCpackInstallation() { # echo "done" return fi - + assertEquals "Installation script successful" 0 $? - + cmake ${ROOT_DIR}/test/installation-tests -B${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} cmake --build ${BUILD_DIR} assertEquals "build against installation successful" 0 $? - + } @@ -78,7 +78,7 @@ testUsageAsSubdirectory() { cmake ${ROOT_DIR}/test/installation-test-subdirectory -B${BUILD_DIR} -DCMAKE_BUILD_TYPE=Release cmake --build ${BUILD_DIR} assertEquals "build against installation successful" 0 $? - + } # Load shUnit2. diff --git a/test/src/derived_unit_tests/velocity_tests.cc b/test/src/derived_unit_tests/velocity_tests.cc index 17500476..a9363db6 100644 --- a/test/src/derived_unit_tests/velocity_tests.cc +++ b/test/src/derived_unit_tests/velocity_tests.cc @@ -139,7 +139,7 @@ TEST_CASE("GIVEN a length of type float WHEN divided by a value of type double " SI::metre_t a = 1.5_km; SI::seconds_t s{1.0}; - SI::metre_per_second_t c = a / s; + SI::metre_per_second_t c = a / s; // NOLINT(clang-analyzer-deadcode.DeadStores) STATIC_REQUIRE( std::is_same>::value); } diff --git a/test/src/detail_tests/unit_t_operator_tests.cc b/test/src/detail_tests/unit_t_operator_tests.cc index 37095fa6..b0bcb19f 100644 --- a/test/src/detail_tests/unit_t_operator_tests.cc +++ b/test/src/detail_tests/unit_t_operator_tests.cc @@ -60,7 +60,7 @@ TEMPLATE_TEST_CASE( unit_t<'X', std::ratio<1>, TestType, std::ratio<1>> v1{123}; unit_t<'X', std::ratio<1>, TestType, std::ratio<1>> v2{std::move(v1)}; - REQUIRE(v1 == v2); + REQUIRE(v1 == v2); // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved) } TEMPLATE_TEST_CASE( @@ -71,7 +71,7 @@ TEMPLATE_TEST_CASE( unit_t<'X', std::ratio<1>, TestType, std::ratio<1>> v1{1000}; unit_t<'X', std::ratio<1>, TestType, std::kilo> v2{std::move(v1)}; - REQUIRE(v1 == v2); + REQUIRE(v1 == v2); // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved) REQUIRE(v2.value() == 1); } @@ -84,7 +84,7 @@ TEMPLATE_TEST_CASE("GIVEN two values of the same unit type WHEN move assigned" v2 = std::move(v1); - REQUIRE(v1 == v2); + REQUIRE(v1 == v2); // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved) } TEMPLATE_TEST_CASE( @@ -98,7 +98,7 @@ TEMPLATE_TEST_CASE( unit_t<'X', std::ratio<1>, TestType, std::kilo> v2{0}; v2 = std::move(v1); - REQUIRE(v1 == v2); + REQUIRE(v1 == v2); // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved) REQUIRE(v2.value() == 1); } diff --git a/test/version-consistency.sh b/test/version-consistency.sh index 9e700013..1d6dce41 100755 --- a/test/version-consistency.sh +++ b/test/version-consistency.sh @@ -24,7 +24,7 @@ testVersionNumberConsistency() { CHANGELOG_VERSION=$(sed -n -E '/## [0-9]+\.[0-9]+\.[0-9]+/p' ${ROOT_DIR}/CHANGELOG.md | head -1 | grep -E -o '[0-9]+\.[0-9]+\.[0-9]+') ORIG_DIR=$(pwd) - cmake ${ROOT_DIR} -B${SI_BUILD_DIR} -DBUILD_TESTING=off -DCMAKE_BUILD_TYPE=Debug >/dev/null + cmake ${ROOT_DIR} -B${SI_BUILD_DIR} -DSI_BUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Debug >/dev/null cd ${SI_BUILD_DIR} CMAKE_VERSION=$(cmake --system-information | grep -E "VERSION:STATIC" | grep -E -o '[0-9]+\.[0-9]+\.[0-9]+') cd ${ORIG_DIR}