Skip to content

Commit

Permalink
[Test] Fix tests of util
Browse files Browse the repository at this point in the history
  • Loading branch information
rikyoz committed Oct 21, 2023
1 parent fc6de4e commit d9b94d3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/src/test_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 ) );
Expand Down

0 comments on commit d9b94d3

Please sign in to comment.