migen/test: if SimCase is a TestCase, it's run in every module that imports it

This commit is contained in:
Robert Jordens 2013-11-30 06:51:24 -07:00 committed by Sebastien Bourdeauducq
parent 4eef3b9399
commit e54fa6f5f4
3 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@ class SimBench(Module):
if self.callback is not None: if self.callback is not None:
return self.callback(self, s) return self.callback(self, s)
class SimCase(unittest.TestCase): class SimCase:
TestBench = SimBench TestBench = SimBench
def setUp(self, *args, **kwargs): def setUp(self, *args, **kwargs):

View File

@ -5,7 +5,7 @@ from migen.genlib.coding import *
from migen.test.support import SimCase, SimBench from migen.test.support import SimCase, SimBench
class EncCase(SimCase): class EncCase(SimCase, unittest.TestCase):
class TestBench(SimBench): class TestBench(SimBench):
def __init__(self): def __init__(self):
self.submodules.dut = Encoder(8) self.submodules.dut = Encoder(8)
@ -29,7 +29,7 @@ class EncCase(SimCase):
self.assertEqual(i, 1<<o) self.assertEqual(i, 1<<o)
self.run_with(cb, 256) self.run_with(cb, 256)
class PrioEncCase(SimCase): class PrioEncCase(SimCase, unittest.TestCase):
class TestBench(SimBench): class TestBench(SimBench):
def __init__(self): def __init__(self):
self.submodules.dut = PriorityEncoder(8) self.submodules.dut = PriorityEncoder(8)
@ -55,7 +55,7 @@ class PrioEncCase(SimCase):
self.assertGreaterEqual(i, 1<<o) self.assertGreaterEqual(i, 1<<o)
self.run_with(cb, 256) self.run_with(cb, 256)
class DecCase(SimCase): class DecCase(SimCase, unittest.TestCase):
class TestBench(SimBench): class TestBench(SimBench):
def __init__(self): def __init__(self):
self.submodules.dut = Decoder(8) self.submodules.dut = Decoder(8)

View File

@ -5,7 +5,7 @@ from migen.genlib.fifo import SyncFIFO, AsyncFIFO
from migen.test.support import SimCase, SimBench from migen.test.support import SimCase, SimBench
class SyncFIFOCase(SimCase): class SyncFIFOCase(SimCase, unittest.TestCase):
class TestBench(SimBench): class TestBench(SimBench):
def __init__(self): def __init__(self):
self.submodules.dut = SyncFIFO([("a", 32), ("b", 32)], 2) self.submodules.dut = SyncFIFO([("a", 32), ("b", 32)], 2)