diff options
| author | batsumaru <> | 2026-08-09 11:28:19 +0900 |
|---|---|---|
| committer | batsumaru <> | 2026-08-09 11:28:19 +0900 |
| commit | 28fd42b64ae2878114225bea8ede2fb16d466908 (patch) | |
| tree | 388b1ca2ee14d25d7741f8a62b185e116dd954c5 /tests/test_fixed_point.cpp | |
| parent | 6fec4f36122ce8ea59aca51b9ff6bce1210d676a (diff) | |
Test for explict overflow
Diffstat (limited to 'tests/test_fixed_point.cpp')
| -rw-r--r-- | tests/test_fixed_point.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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); +} |
