add 100 random integer tests to partitioned add
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 9 Feb 2020 14:53:22 +0000 (14:53 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 9 Feb 2020 14:53:22 +0000 (14:53 +0000)
src/ieee754/part/test/test_partsig.py

index 774e119f6a2525a8cf44e205ceaf6b7034b39db0..ae78f3441e63575dca5fec143f18059b8af827e2 100644 (file)
@@ -9,6 +9,7 @@ from nmigen.cli import verilog, rtlil
 from ieee754.part.partsig import PartitionedSignal
 from ieee754.part_mux.part_mux import PMux
 
+from random import randint
 import unittest
 import itertools
 
@@ -82,13 +83,17 @@ class TestPartitionPoints(unittest.TestCase):
                               "part_sig_add")
         def async_process():
             def test_add(msg_prefix, carry, *mask_list):
+                rand_data = []
+                for i in range(100):
+                    a, b = randint(0, 1<<16), randint(0, 1<<16)
+                    rand_data.append((a, b))
                 for a, b in [(0x0000, 0x0000),
                              (0x1234, 0x1234),
                              (0xABCD, 0xABCD),
                              (0xFFFF, 0x0000),
                              (0x0000, 0x0000),
                              (0xFFFF, 0xFFFF),
-                             (0x0000, 0xFFFF)]:
+                             (0x0000, 0xFFFF)] + rand_data:
                     yield module.a.eq(a)
                     yield module.b.eq(b)
                     carry_sig = 0xf if carry else 0