Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from catch v2 to v3 #56

Merged
merged 2 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: C++ CI Workflow
on:
push:
pull_request:

env:
Catch2_TAG: v2.11.3
Catch2_TAG: v3.0.1

jobs:
build:
Expand Down Expand Up @@ -36,30 +36,30 @@ jobs:
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done


- name: Dependencies [macOS]
if: matrix.os == 'macOS-latest'
run: |
brew update
brew install libmatio catch2
brew install libmatio

- name: Dependencies [Ubuntu]
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install libmatio-dev valgrind libeigen3-dev

- name: Cache Source-based Dependencies
id: cache-source-deps
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/install/deps
# Including ${{ runner.temp }} is a workaround taken from https://github.com/robotology/whole-body-estimators/pull/62 to fix macos configuration failure on https://github.com/ami-iit/bipedal-locomotion-framework/pull/45
key: source-deps-${{ runner.os }}-${{runner.temp}}-build-type-${{ matrix.build_type }}-vcpkg-${{ env.vcpkg_TAG }}-catch2-${{ env.Catch2_TAG }}
- name: Source-based Dependencies [Ubuntu]
if: steps.cache-source-deps.outputs.cache-hit != 'true' && matrix.os == 'ubuntu-latest'
key: source-deps-${{ runner.os }}-${{runner.temp}}-build-type-${{ matrix.build_type }}-catch2-${{ env.Catch2_TAG }}


- name: Catch2 installation
if: steps.cache-source-deps.outputs.cache-hit != 'true'
shell: bash
run: |
# Catch2
Expand Down Expand Up @@ -110,4 +110,4 @@ jobs:
run: |
cd build
ctest --output-on-failure -C ${{ matrix.build_type }} .

14 changes: 7 additions & 7 deletions .github/workflows/conda-forge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
# Execute a "nightly" build at 2 AM UTC
# Execute a "nightly" build at 2 AM UTC
- cron: '0 2 * * *'

jobs:
Expand All @@ -30,19 +30,19 @@ jobs:
- name: Dependencies
shell: bash -l {0}
run: |
# Compilation related dependencies
mamba install cmake compilers make ninja pkg-config
# Compilation related dependencies
mamba install cmake compilers make ninja pkg-config
# Actual dependencies
mamba install libmatio catch2 eigen

- name: Configure [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
mkdir -p build
cd build
cmake -GNinja -DBUILD_TESTING:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..

- name: Configure [Windows]
if: contains(matrix.os, 'windows')
shell: bash -l {0}
Expand All @@ -51,12 +51,12 @@ jobs:
cd build
cmake -G"Visual Studio 16 2019" -DBUILD_TESTING:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..

- name: Build
- name: Build
shell: bash -l {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}

- name: Test
shell: bash -l {0}
run: |
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [Unrealeased]
- Moving from Catch2 v2 to v3 [#56](https://github.com/ami-iit/matio-cpp/pull/56)

## [0.2.0] - 2022-04-28
- Using a custom variable in InstallBasicPackageFile to backup the module path: [#47](https://github.com/ami-iit/matio-cpp/pull/47).
- Added more checks before creating a file: [#49](https://github.com/ami-iit/matio-cpp/pull/49).
- Added reflection and conversions from common types [#55](https://github.com/ami-iit/matio-cpp/pull/55)
Expand Down
10 changes: 2 additions & 8 deletions cmake/AddUnitTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# BSD-2-Clause license. See the accompanying LICENSE file for details.


find_package(Catch2 REQUIRED)
find_package(Catch2 3.0.1 REQUIRED)

find_package(VALGRIND QUIET)

Expand All @@ -27,12 +27,6 @@ if (FRAMEWORK_RUN_Valgrind_tests)
separate_arguments(MEMCHECK_COMMAND_COMPLETE)
endif()

configure_file(cmake/Catch2Main.cpp.in ${CMAKE_BINARY_DIR}/Testing/Catch2Main.cpp)
add_library(CatchTestMain ${CMAKE_BINARY_DIR}/Testing/Catch2Main.cpp)
target_link_libraries(CatchTestMain PUBLIC Catch2::Catch2)



function(add_unit_test)

set(options )
Expand All @@ -54,7 +48,7 @@ function(add_unit_test)
add_executable(${targetname}
"${unit_test_files}")

target_link_libraries(${targetname} PRIVATE CatchTestMain ${${prefix}_LINKS})
target_link_libraries(${targetname} PRIVATE Catch2::Catch2WithMain ${${prefix}_LINKS})
target_compile_definitions(${targetname} PRIVATE CATCH_CONFIG_FAST_COMPILE CATCH_CONFIG_DISABLE_MATCHERS)

add_test(NAME ${targetname} COMMAND ${targetname})
Expand Down
10 changes: 0 additions & 10 deletions cmake/Catch2Main.cpp.in

This file was deleted.

2 changes: 1 addition & 1 deletion test/CellArrayUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
*/

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <vector>
#include <matioCpp/matioCpp.h>

Expand Down
2 changes: 1 addition & 1 deletion test/ElementUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
*/

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <matioCpp/matioCpp.h>

void checkSameDimensions(matioCpp::Span<const size_t> a, matioCpp::Span<const size_t> b)
Expand Down
2 changes: 1 addition & 1 deletion test/ExogenousConversionsUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

//#define MATIOCPP_NO_EIGEN
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <matioCpp/matioCpp.h>
#include <map>
#include <set>
Expand Down
2 changes: 1 addition & 1 deletion test/FileUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
*/

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <matioCpp/matioCpp.h>
#include "MatFolderPath.h"

Expand Down
2 changes: 1 addition & 1 deletion test/MatvarHandlerUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
*/

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <vector>
#include <matioCpp/matioCpp.h>

Expand Down
2 changes: 1 addition & 1 deletion test/MultiDimensionalArrayUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
*/

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <vector>
#include <matioCpp/matioCpp.h>

Expand Down
2 changes: 1 addition & 1 deletion test/SpanUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <matioCpp/matioCpp.h>

// Catch2
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>

#include <array> // for array
#include <iostream> // for ptrdiff_t
Expand Down
2 changes: 1 addition & 1 deletion test/StructArrayElementUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
*/

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <matioCpp/matioCpp.h>

void checkSameDimensions(matioCpp::Span<const size_t> a, matioCpp::Span<const size_t> b)
Expand Down
2 changes: 1 addition & 1 deletion test/StructArrayUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
*/

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <vector>
#include <matioCpp/matioCpp.h>

Expand Down
2 changes: 1 addition & 1 deletion test/StructUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
*/

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <vector>
#include <matioCpp/matioCpp.h>

Expand Down
2 changes: 1 addition & 1 deletion test/VariableUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
*/

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <vector>
#include <matioCpp/matioCpp.h>

Expand Down
2 changes: 1 addition & 1 deletion test/VectorUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* BSD-2-Clause license (https://opensource.org/licenses/BSD-2-Clause).
*/

#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <vector>
#include <matioCpp/matioCpp.h>

Expand Down