From aacbee8ed84ef1e58b9845774c89436cf3d479db Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Fri, 7 May 2021 11:43:25 +0430 Subject: Tests: Add tests for Checked::div() overflow --- Tests/AK/TestChecked.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Tests') 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(0x4000000000000000) - Checked(-0x4000000000000000)).has_overflow()); EXPECT(!(Checked(-0x4000000000000000) - Checked(0x4000000000000000)).has_overflow()); EXPECT((Checked(-0x4000000000000000) - Checked(0x4000000000000001)).has_overflow()); + + EXPECT((Checked(0x80000000) / Checked(-1)).has_overflow()); + EXPECT((Checked(0x8000000000000000) / Checked(-1)).has_overflow()); } TEST_CASE(detects_unsigned_overflow) -- cgit v1.2.3