Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/syntax/test_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,27 @@ def test_interrupt_except_else():
assert tuple(actions) == (1, 2, 3, 1, 1, 5, None)


def test_interrupt_invariant_after_actions():
scenario = compileScenic(
"""
behavior Foo():
invariant: ego.bar == 0
try:
for i in range(3):
take 1
interrupt when simulation().currentTime == 1:
take 2
ego.bar = 1
except InvariantViolation:
ego.bar = 0
take 4
ego = new Object with bar 0, with behavior Foo
"""
)
actions = sampleEgoActions(scenario, maxSteps=4)
assert tuple(actions) == (1, 2, 4, None)


# Nesting


Expand Down
Loading