build: catch2 updated to 3.1.0

This commit is contained in:
Mateusz Pusz
2022-09-01 16:19:51 +02:00
parent 1096d8d8ba
commit 707b39f0c4
8 changed files with 14 additions and 16 deletions

View File

@ -115,7 +115,7 @@ class MPUnitsConan(ConanFile):
def build_requirements(self):
if self._build_all:
self.test_requires("catch2/2.13.9")
self.test_requires("catch2/3.1.0")
self.test_requires("wg21-linear_algebra/0.7.2")
if not self._skip_docs:
self.tool_requires("doxygen/1.9.4")

View File

@ -22,13 +22,12 @@
cmake_minimum_required(VERSION 3.2)
find_package(Catch2 CONFIG REQUIRED)
find_package(Catch2 3 CONFIG REQUIRED)
add_executable(
unit_tests_runtime catch_main.cpp math_test.cpp magnitude_test.cpp fmt_test.cpp fmt_units_test.cpp
distribution_test.cpp
unit_tests_runtime math_test.cpp magnitude_test.cpp fmt_test.cpp fmt_units_test.cpp distribution_test.cpp
)
target_link_libraries(unit_tests_runtime PRIVATE mp-units::mp-units Catch2::Catch2)
target_link_libraries(unit_tests_runtime PRIVATE mp-units::mp-units Catch2::Catch2WithMain)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(

View File

@ -1,2 +0,0 @@
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>

View File

@ -20,8 +20,9 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <units/isq/si/length.h>
#include <units/quantity_io.h>
#include <units/random.h>
#include <array>
#include <initializer_list>

View File

@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <units/customization_points.h>
#include <units/format.h>
#include <units/generic/dimensionless.h>
@ -35,7 +35,6 @@
using namespace units;
using namespace units::isq;
using namespace units::isq::si;
using namespace Catch::Matchers;
TEST_CASE("operator<< on a quantity", "[text][ostream][fmt]")
{
@ -696,13 +695,13 @@ TEST_CASE("precision specification for integral representation should throw", "[
SECTION("full format {:%Q %q} on a quantity")
{
REQUIRE_THROWS_MATCHES(STD_FMT::vformat("{:%.1Q %q}", STD_FMT::make_format_args(1_q_m)), STD_FMT::format_error,
Message("precision not allowed for integral quantity representation"));
Catch::Matchers::Message("precision not allowed for integral quantity representation"));
}
SECTION("value only format {:%Q} on a quantity")
{
REQUIRE_THROWS_MATCHES(STD_FMT::vformat("{:%.1Q}", STD_FMT::make_format_args(1_q_m)), STD_FMT::format_error,
Message("precision not allowed for integral quantity representation"));
Catch::Matchers::Message("precision not allowed for integral quantity representation"));
}
}

View File

@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <units/bits/external/hacks.h> // IWYU pragma: keep
#include <units/format.h>
#include <units/isq/iec80000/iec80000.h>

View File

@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include <catch2/catch.hpp>
#include <catch2/catch_test_macros.hpp>
#include <units/magnitude.h>
#include <units/ratio.h>
#include <type_traits>

View File

@ -20,13 +20,14 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#include <units/isq/si/area.h>
#include <units/isq/si/cgs/length.h>
#include <units/isq/si/length.h>
#include <units/isq/si/time.h>
#include <units/isq/si/volume.h>
#include <units/math.h>
#include <units/quantity_io.h>
#include <limits>
using namespace units;
@ -296,7 +297,7 @@ TEMPLATE_TEST_CASE_SIG("pow<N>() implementation exponentiates values to power N"
(std::intmax_t N, N), 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25)
{
auto v = GENERATE(range(0.5, 20.0, 0.5));
REQUIRE(detail::pow_impl<N>(v) == Approx(std::pow(v, N)).epsilon(1e-15).margin(0));
REQUIRE(detail::pow_impl<N>(v) == Catch::Approx(std::pow(v, N)).epsilon(1e-15).margin(0));
}
template<std::intmax_t N>