Skip to content

Commit

Permalink
Tests: Add tests for Checked<T>::div() overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
alimpfard authored and awesomekling committed May 7, 2021
1 parent da68c45 commit aacbee8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Tests/AK/TestChecked.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ TEST_CASE(detects_signed_overflow)
EXPECT((Checked<i64>(0x4000000000000000) - Checked<i64>(-0x4000000000000000)).has_overflow());
EXPECT(!(Checked<i64>(-0x4000000000000000) - Checked<i64>(0x4000000000000000)).has_overflow());
EXPECT((Checked<i64>(-0x4000000000000000) - Checked<i64>(0x4000000000000001)).has_overflow());

EXPECT((Checked<i32>(0x80000000) / Checked<i32>(-1)).has_overflow());
EXPECT((Checked<i64>(0x8000000000000000) / Checked<i64>(-1)).has_overflow());
}

TEST_CASE(detects_unsigned_overflow)
Expand Down

0 comments on commit aacbee8

Please sign in to comment.