Testing¶
Testing guide for zuspec-be-sw.
Running Tests¶
Run all tests:
pytest
Run unit tests:
pytest tests/unit/
With coverage:
pytest --cov=zuspec.be.sw
Writing Tests¶
Test template:
def test_feature(tmpdir):
@zdc.dataclass
class MyComp(zdc.Component):
def method(self):
print("test")
ctxt = zdc.DataModelFactory().build(MyComp)
validator = CValidator()
assert validator.validate(ctxt)
gen = CGenerator(Path(tmpdir))
sources = gen.generate(ctxt)
compiler = CCompiler(Path(tmpdir))
exe = compiler.compile(sources, Path(tmpdir) / "test")
runner = TestRunner()
result = runner.run(exe)
assert result.passed