tests: move out of the main package.
[nmigen.git] / tests / compat / test_run_simulation.py
1 import unittest
2
3 from nmigen import Signal, Module, Elaboratable
4
5 from .support import SimCase
6
7
8 class RunSimulation(SimCase, unittest.TestCase):
9 """ test for https://github.com/nmigen/nmigen/issues/344 """
10
11 class TestBench(Elaboratable):
12 def __init__(self):
13 self.a = Signal()
14
15 def elaborate(self, platform):
16 m = Module()
17 m.d.sync += self.a.eq(~self.a)
18 return m
19
20 def test_run_simulation(self):
21 def gen():
22 yield
23 for i in range(10):
24 yield
25 a = (yield self.tb.a)
26 self.assertEqual(a, i % 2)
27
28 self.run_with(gen())