summaryrefslogtreecommitdiff
path: root/tests/test_fixed_point.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_fixed_point.cpp')
-rw-r--r--tests/test_fixed_point.cpp7
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);
+}