From d9b94d31b0fce87dd401824b06eac08373dc48d9 Mon Sep 17 00:00:00 2001 From: Oz Date: Sat, 21 Oct 2023 20:55:38 +0200 Subject: [PATCH] [Test] Fix tests of util --- tests/src/test_util.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/src/test_util.cpp b/tests/src/test_util.cpp index 9cf3290f..8707d67c 100644 --- a/tests/src/test_util.cpp +++ b/tests/src/test_util.cpp @@ -17,10 +17,12 @@ using bit7z::check_overflow; using bit7z::clamp_cast; using bit7z::cmp_greater_equal; -constexpr auto kMaxValue = ( std::numeric_limits< int64_t >::max )(); -constexpr auto kMinValue = ( std::numeric_limits< int64_t >::min )(); +using bit7z::seek_to_offset; TEST_CASE( "util: Calling check_overflow on a non-overflowing offset", "[util][check_overflow]" ) { //-V2008 + constexpr auto kMaxValue = ( std::numeric_limits< int64_t >::max )(); + constexpr auto kMinValue = ( std::numeric_limits< int64_t >::min )(); + REQUIRE_FALSE( check_overflow( kMaxValue, 0 ) ); REQUIRE_FALSE( check_overflow( kMaxValue, -1 ) ); REQUIRE_FALSE( check_overflow( kMaxValue, -42 ) ); @@ -69,6 +71,9 @@ TEST_CASE( "util: Calling check_overflow on a non-overflowing offset", "[util][c } TEST_CASE( "util: Calling check_overflow on an overflowing offset", "[util][check_overflow]" ) { + constexpr auto kMaxValue = ( std::numeric_limits< int64_t >::max )(); + constexpr auto kMinValue = ( std::numeric_limits< int64_t >::min )(); + REQUIRE( check_overflow( kMaxValue, kMaxValue ) ); REQUIRE( check_overflow( kMaxValue, 42 ) ); REQUIRE( check_overflow( kMaxValue, 1 ) );