Created
September 26, 2021 08:07
-
-
Save sz332/0dc70c244b4877eed01c69bafa7a6fb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------- MODULE statemachine ---------------------------- | |
EXTENDS TLC, Sequences, Integers | |
(* --algorithm statemachine | |
fair process webProcess = 1 | |
variables | |
machineState = "Starting", | |
run = TRUE; | |
accessAttemptState = "NULL"; | |
begin P: | |
while run do | |
Start: | |
if machineState = "Starting" then | |
machineState := "LoginScreen"; | |
else | |
skip; | |
end if; | |
LoginScreen: | |
if machineState = "LoginScreen" then | |
machineState := "TotpScreen"; | |
accessAttemptState := "Undecided"; | |
else | |
skip; | |
end if; | |
TotpScreen: | |
if machineState = "TotpScreen" then | |
either | |
machineState := "LoggedInScreen"; | |
or | |
machineState := "SmsScreen"; | |
accessAttemptState := "Cancelled"; | |
end either; | |
else | |
skip; | |
end if; | |
SmsScreen: | |
if machineState = "SmsScreen" then | |
machineState := "LoggedInScreen"; | |
else | |
skip; | |
end if; | |
LoggedInScreen: | |
if machineState = "LoggedInScreen" then | |
machineState := "Stop"; | |
else | |
skip; | |
end if; | |
Stop: | |
if machineState = "Stop" then | |
assert accessAttemptState = "Undecided" \/ accessAttemptState = "Cancelled"; | |
run := FALSE; | |
else | |
skip; | |
end if; | |
end while; | |
end process; | |
end algorithm; *) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment