From 28fd42b64ae2878114225bea8ede2fb16d466908 Mon Sep 17 00:00:00 2001 From: batsumaru <> Date: Sun, 9 Aug 2026 11:28:19 +0900 Subject: Test for explict overflow --- tests/test_fixed_point.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_fixed_point.cpp b/tests/test_fixed_point.cpp index 8cb12d2..b3d3e78 100644 --- a/tests/test_fixed_point.cpp +++ b/tests/test_fixed_point.cpp @@ -7,3 +7,10 @@ TEST_CASE("fp_t addition is commutative") { CHECK(a + b == b + a); REQUIRE(a.raw != 0); } + +TEST_CASE("fp_t addition overflows") { + fp_t a = fp_t::from_raw(INT32_MAX); + fp_t b = fp_t::from_raw(1); + fp_t c = fp_t::from_raw(INT32_MIN); + CHECK(a + b == c); +} -- cgit v1.3