Coverage for hdl_registers/generator/vhdl/simulation/test/test_wait_until_package.py: 100%
16 statements
« prev ^ index » next coverage.py v7.6.8, created at 2024-12-01 20:50 +0000
« prev ^ index » next coverage.py v7.6.8, created at 2024-12-01 20:50 +0000
1# --------------------------------------------------------------------------------------------------
2# Copyright (c) Lukas Vik. All rights reserved.
3#
4# This file is part of the hdl-registers project, an HDL register generator fast enough to run
5# in real time.
6# https://hdl-registers.com
7# https://github.com/hdl-registers/hdl-registers
8# --------------------------------------------------------------------------------------------------
10"""
11Some limited unit tests.
12Note that the generated VHDL code is also simulated in a functional test.
13"""
15# First party libraries
16from hdl_registers.generator.vhdl.simulation.wait_until_package import (
17 VhdlSimulationWaitUntilPackageGenerator,
18)
19from hdl_registers.register_list import RegisterList
20from hdl_registers.register_modes import REGISTER_MODES
23def test_package_is_not_generated_without_registers(tmp_path):
24 register_list = RegisterList(name="test", source_definition_file=None)
26 assert not VhdlSimulationWaitUntilPackageGenerator(register_list, tmp_path).create().exists()
28 register_list.add_constant(name="apa", value=True, description="")
29 assert not VhdlSimulationWaitUntilPackageGenerator(register_list, tmp_path).create().exists()
31 register_list.append_register(name="hest", mode=REGISTER_MODES["r_w"], description="")
32 assert VhdlSimulationWaitUntilPackageGenerator(register_list, tmp_path).create().exists()
35def test_re_generating_package_without_registers_should_delete_old_file(tmp_path):
36 register_list = RegisterList(name="test", source_definition_file=None)
37 register_list.append_register(name="apa", mode=REGISTER_MODES["r_w"], description="")
39 assert VhdlSimulationWaitUntilPackageGenerator(register_list, tmp_path).create().exists()
41 register_list.register_objects = []
42 assert not VhdlSimulationWaitUntilPackageGenerator(register_list, tmp_path).create().exists()