Tests: Add tests for Checked<T>::div() overflow

This commit is contained in:
Ali Mohammad Pur 2021-05-07 11:43:25 +04:30 committed by Andreas Kling
parent da68c4580c
commit aacbee8ed8
Notes: sideshowbarker 2024-07-18 18:37:22 +09:00

View File

@ -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)