diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-05-07 11:43:25 +0430 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-07 09:26:11 +0200 |
commit | aacbee8ed84ef1e58b9845774c89436cf3d479db (patch) | |
tree | 734a13f2e5823efbf010a66ca2e9a95cd90fea58 /Tests | |
parent | da68c4580cbb087d928f010468c6165aacd6b299 (diff) | |
download | serenity-aacbee8ed84ef1e58b9845774c89436cf3d479db.zip |
Tests: Add tests for Checked<T>::div() overflow
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/AK/TestChecked.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Tests/AK/TestChecked.cpp b/Tests/AK/TestChecked.cpp index a4c932d696..474efd442c 100644 --- a/Tests/AK/TestChecked.cpp +++ b/Tests/AK/TestChecked.cpp @@ -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) |