tests: move out of the main package.
[nmigen.git] / tests / test_examples.py
1 import sys
2 import subprocess
3 from pathlib import Path
4
5 from .utils import *
6
7
8 def example_test(name):
9 path = (Path(__file__).parent / ".." / "examples" / name).resolve()
10 def test_function(self):
11 subprocess.check_call([sys.executable, str(path), "generate", "-t", "v"],
12 stdout=subprocess.DEVNULL)
13 return test_function
14
15
16 class ExamplesTestCase(FHDLTestCase):
17 test_alu = example_test("basic/alu.py")
18 test_alu_hier = example_test("basic/alu_hier.py")
19 test_arst = example_test("basic/arst.py")
20 test_cdc = example_test("basic/cdc.py")
21 test_ctr = example_test("basic/ctr.py")
22 test_ctr_en = example_test("basic/ctr_en.py")
23 test_fsm = example_test("basic/fsm.py")
24 test_gpio = example_test("basic/gpio.py")
25 test_inst = example_test("basic/inst.py")
26 test_mem = example_test("basic/mem.py")
27 test_pmux = example_test("basic/pmux.py")
28 test_por = example_test("basic/por.py")
29
30 def test_uart(self):
31 path = (Path(__file__).parent / ".." / "examples" / "basic" / "uart.py").resolve()
32 subprocess.check_call([sys.executable, str(path), "generate"],
33 stdout=subprocess.DEVNULL)