test.sim: add tests for sync functionality and errors.

This commit is contained in:
whitequark 2018-12-18 17:53:50 +00:00
parent 7fa82a70be
commit 07e9cfa939
3 changed files with 189 additions and 3 deletions

View file

@ -354,7 +354,7 @@ class Simulator:
if inspect.isgeneratorfunction(process):
process = process()
if not inspect.isgenerator(process):
raise TypeError("Cannot add a process '{!r}' because it is not a generator or"
raise TypeError("Cannot add a process '{!r}' because it is not a generator or "
"a generator function"
.format(process))
return process
@ -643,11 +643,11 @@ class Simulator:
elif type(cmd) is Assign:
lhs_signals = cmd.lhs._lhs_signals()
for signal in lhs_signals:
signal_slot = self._signal_slots[signal]
if not signal in self._signals:
raise ValueError("Process '{}' sent a request to set signal '{!r}', "
"which is not a part of simulation"
.format(self._name_process(process), signal))
signal_slot = self._signal_slots[signal]
if self._comb_signals[signal_slot]:
raise ValueError("Process '{}' sent a request to set signal '{!r}', "
"which is a part of combinatorial assignment in "