Skip to content

Commit

Permalink
Adapt example & test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDecan committed Oct 19, 2024
1 parent 801dd68 commit 18a6adb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions docs/examples/elevator/elevator.plantuml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@
title Elevator
state "active" as active {
state "floorListener" as floorListener {
[*] -right-> floorSelecting
state "floorSelecting" as floorSelecting {
floorSelecting --> floorSelecting : floorSelected / destination = event.floor
}
[*] -right-> floorSelecting
}
--
state "movingElevator" as movingElevator {
[*] -right-> doorsOpen
state "moving" as moving {
moving --> doorsOpen : [destination == current] / doors_open = True
state "movingDown" as movingDown {
movingDown : **entry** / current = current - 1
movingDown --> movingDown : [destination < current]
}
state "movingUp" as movingUp {
movingUp : **entry** / current = current + 1
movingUp --> movingUp : [destination > current]
}
}
state "doorsClosed" as doorsClosed {
doorsClosed --> movingUp : [destination > current]
doorsClosed --> movingDown : [destination < current and destination >= 0]
}
state "doorsOpen" as doorsOpen {
doorsOpen -right-> doorsClosed : [destination != current] / doors_open = False
doorsOpen -right-> doorsClosed : [after(10) and current > 0] / destination = 0; doors_open = False
}
[*] -right-> doorsOpen
}
}
@enduml
floorSelecting --> floorSelecting : floorSelected / destination = event.floor
movingDown --> movingDown : [destination < current]
movingUp --> movingUp : [destination > current]
moving --> doorsOpen : [destination == current] / doors_open = True
doorsClosed --> movingUp : [destination > current]
doorsClosed --> movingDown : [destination < current and destination >= 0]
doorsOpen -right-> doorsClosed : [destination != current] / doors_open = False
doorsOpen -right-> doorsClosed : [after(10) and current > 0] / destination = 0; doors_open = False
@enduml
Binary file modified docs/examples/elevator/elevator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_export_based_on_filepath(self, elevator):
filepath = 'docs/examples/elevator/elevator.plantuml'
statechart = elevator.statechart
with open(filepath, 'r') as f:
p1 = f.read()
p1 = f.read().strip()

assert p1 != export_to_plantuml(statechart)
assert p1 == export_to_plantuml(statechart, based_on=p1)
Expand All @@ -167,4 +167,4 @@ def test_cli(self, capsys):
out, _ = capsys.readouterr()
export = export_to_plantuml(statechart, based_on_filepath='docs/examples/elevator/elevator.plantuml', statechart_description=True, statechart_preamble=True, state_contracts=True, transition_contracts=True, state_action=False, statechart_name=False, transition_action=False)
assert export == out.strip()

0 comments on commit 18a6adb

Please sign in to comment.