amaranth/nmigen/test/test_examples.py
whitequark 5c63177fc2 test: generate examples to verilog as part of unit tests.
This is to make sure 806a62c2 doesn't happen again.
2019-07-08 10:12:26 +00:00

29 lines
1 KiB
Python

import sys
import subprocess
from pathlib import Path
from .tools import *
def example_test(name):
path = (Path(__file__).parent / ".." / ".." / "examples" / name).resolve()
def test_function(self):
subprocess.check_call([sys.executable, path, "generate"], stdout=subprocess.DEVNULL)
return test_function
class ExamplesTestCase(FHDLTestCase):
test_alu = example_test("basic/alu.py")
test_alu_hier = example_test("basic/alu_hier.py")
test_arst = example_test("basic/arst.py")
test_cdc = example_test("basic/cdc.py")
test_ctr = example_test("basic/ctr.py")
test_ctr_ce = example_test("basic/ctr_ce.py")
test_fsm = example_test("basic/fsm.py")
test_gpio = example_test("basic/gpio.py")
test_inst = example_test("basic/inst.py")
test_mem = example_test("basic/mem.py")
test_pmux = example_test("basic/pmux.py")
test_por = example_test("basic/por.py")
test_uart = example_test("basic/uart.py")