mirror of
https://github.com/smyalygames/checklist-tester.git
synced 2025-05-18 14:34:12 +02:00
feat(formal): add checking functions for procedures
This commit is contained in:
parent
1354906b57
commit
e904ecb8df
@ -93,6 +93,25 @@ types
|
|||||||
Checklist = seq of Procedure;
|
Checklist = seq of Procedure;
|
||||||
|
|
||||||
functions
|
functions
|
||||||
|
--@doc Finds the index of the next item in the checklist that needs to be completed
|
||||||
|
procedure_next_index: Procedure -> nat1
|
||||||
|
procedure_next_index(p) ==
|
||||||
|
hd [ x | x in set {1,...,len p} & p(x).checked = false]
|
||||||
|
pre
|
||||||
|
-- Checks to prevent getting the head of an empty sequence
|
||||||
|
len p > 0
|
||||||
|
and procedure_completed(p) = false
|
||||||
|
post
|
||||||
|
-- Checks that the index of the item is the next one to be completed
|
||||||
|
p(RESULT).checked = false
|
||||||
|
and if RESULT > 1 then
|
||||||
|
p(RESULT-1).checked = true
|
||||||
|
else
|
||||||
|
true;
|
||||||
|
|
||||||
|
--@doc Checks if the procedure has been completed
|
||||||
|
procedure_completed: Procedure -> bool
|
||||||
|
procedure_completed(p) ==
|
||||||
|
false not in set { p(x).checked | x in set {1,...,len p} };
|
||||||
|
|
||||||
end Checklist
|
end Checklist
|
||||||
|
Loading…
x
Reference in New Issue
Block a user