mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-25 18:58:56 +00:00
Tests: Add tests for Checked<> decrement operator
This commit is contained in:
parent
1ac0aaa555
commit
d2334957ba
Notes:
sideshowbarker
2024-07-17 09:48:50 +09:00
Author: https://github.com/Poseydon42 🔰
Commit: d2334957ba
Pull-request: https://github.com/SerenityOS/serenity/pull/16365
Reviewed-by: https://github.com/MacDue ✅
1 changed files with 14 additions and 1 deletions
|
@ -41,7 +41,20 @@ TEST_CASE(operator_incr)
|
|||
EXPECT_EQ(a++, 8);
|
||||
EXPECT_EQ(a++, 9);
|
||||
EXPECT_EQ(a, 10);
|
||||
// TODO: If decrementing gets supported, test it.
|
||||
}
|
||||
|
||||
TEST_CASE(operator_decr)
|
||||
{
|
||||
Checked<u32> a = 5;
|
||||
EXPECT_EQ(--a, 4u);
|
||||
EXPECT_EQ(--a, 3u);
|
||||
EXPECT_EQ(a--, 3u);
|
||||
EXPECT_EQ(a--, 2u);
|
||||
EXPECT_EQ(a--, 1u);
|
||||
EXPECT_EQ(a, 0u);
|
||||
EXPECT(!a.has_overflow());
|
||||
a--;
|
||||
EXPECT(a.has_overflow());
|
||||
}
|
||||
|
||||
TEST_CASE(operator_cmp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue