test/divider: subtests
authorSebastien Bourdeauducq <sb@m-labs.hk>
Tue, 13 Oct 2015 10:39:41 +0000 (18:39 +0800)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Tue, 13 Oct 2015 10:39:41 +0000 (18:39 +0800)
migen/test/test_divider.py

index 8ccb00e56d5be1b7b0dede72b24c83a9ae12d28b..8779bdb75f4197e6855778b77474f25872c7a81e 100644 (file)
@@ -14,13 +14,14 @@ class DivisionCase(SimCase, unittest.TestCase):
         def gen():
             for dividend in range(16):
                 for divisor in range(1, 16):
-                    yield self.tb.dut.dividend_i.eq(dividend)
-                    yield self.tb.dut.divisor_i.eq(divisor)
-                    yield self.tb.dut.start_i.eq(1)
-                    yield
-                    yield self.tb.dut.start_i.eq(0)
-                    while not (yield self.tb.dut.ready_o):
+                    with self.subTest(dividend=dividend, divisor=divisor):
+                        yield self.tb.dut.dividend_i.eq(dividend)
+                        yield self.tb.dut.divisor_i.eq(divisor)
+                        yield self.tb.dut.start_i.eq(1)
                         yield
-                    self.assertEqual((yield self.tb.dut.quotient_o), dividend//divisor)
-                    self.assertEqual((yield self.tb.dut.remainder_o), dividend%divisor)
+                        yield self.tb.dut.start_i.eq(0)
+                        while not (yield self.tb.dut.ready_o):
+                            yield
+                        self.assertEqual((yield self.tb.dut.quotient_o), dividend//divisor)
+                        self.assertEqual((yield self.tb.dut.remainder_o), dividend%divisor)
         self.run_with(gen())