From b0d8a2f5f5718ba3fea628cad7bcbbc76c6a140c Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sat, 21 Dec 2024 16:19:39 +0100 Subject: Fix possible overflow with assignment operations --- test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') diff --git a/test b/test index 2930e89..3256a12 100755 --- a/test +++ b/test @@ -115,6 +115,24 @@ public: assert_equal(n, Zmod<12>(4)); } }, +{ + .name = "Multiplication overflow", + .f = []() { + Zmod<10> n = 8; + Zmod<10> m = 9; + auto prod = m * n; + assert_equal(prod.toint64(), 2); + } +}, +{ + .name = "Multiplication and assignment overflow", + .f = []() { + Zmod<10> n = 8; + Zmod<10> m = 9; + n *= m; + assert_equal(n.toint64(), 2); + } +}, }; int main() { -- cgit v1.2.3