tests: move out of the main package.
[nmigen.git] / tests / compat / test_passive.py
1 import unittest
2
3 from nmigen.compat import *
4
5
6 class PassiveCase(unittest.TestCase):
7 def test_terminates_correctly(self):
8 n = 5
9
10 count = 0
11 @passive
12 def counter():
13 nonlocal count
14 while True:
15 yield
16 count += 1
17
18 def terminator():
19 for i in range(n):
20 yield
21
22 run_simulation(Module(), [counter(), terminator()])
23 self.assertEqual(count, n)