1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-10 07:38:06 -05:00

cryptsuite: add another test I missed.

I just found a file lying around in a different source directory that
contained a test case I'd had trouble with last week, so now I've
recovered it, it ought to go in the test suite as a regression test.
This commit is contained in:
Simon Tatham 2019-01-03 23:42:50 +00:00
parent 188e2525c7
commit 40e18d98ed

View File

@ -279,6 +279,14 @@ class mpint(unittest.TestCase):
bm = mp_copy(bi)
self.assertEqual(int(mp_mul(am, bm)), ai * bi)
# A regression test for a bug that came up during development
# of mpint.c, relating to an intermediate value overflowing
# its container.
ai, bi = (2**8512 * 2 // 3), (2**4224 * 11 // 15)
am = mp_copy(ai)
bm = mp_copy(bi)
self.assertEqual(int(mp_mul(am, bm)), ai * bi)
@staticmethod
def nbits(n):
# Mimic mp_get_nbits for ordinary Python integers.