-
Notifications
You must be signed in to change notification settings - Fork 4
Fix generateActionSequence and validActionSequence for Activity Final nodes #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
28556a4
Initial plan
Copilot 3c41d4d
Fix generateActionSequence and validActionSequence for Activity Ends
Copilot 0835a07
Improve test descriptions for Activity Final node tests
Copilot 616314c
Fix missing newline at end of ActionSequencesActivityFinalSpec.hs
jvoigtlaender 1a0d242
Fix formatting in ActionSequencesActivityFinalSpec.hs
jvoigtlaender 65f3542
Fix zero state creation for Activity Final nodes and update failing t…
Copilot e3d1ea5
Fix zero state creation using all places in Petri net and restore tes…
Copilot 2bf6e60
Implement Activity Final detection using original diagram labels
Copilot 1c10c97
Replace 'lbl' variable with 'nodeLabel' for spell-checking compliance
Copilot f7d98bc
Improve zero state creation to use target state structure
Copilot 70d1d36
Fix formatting issues in ActionSequences.hs
jvoigtlaender a46e79e
Fix generateActionSequence and validActionSequence for Activity Final…
Copilot 20eb9f7
Fix zero state consistency across all Activity Final functions
Copilot d6a9dfc
Merge branch 'dev' into copilot/fix-187
jvoigtlaender c23d78c
Merge branch 'dev' into copilot/fix-187
jvoigtlaender File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
63 changes: 63 additions & 0 deletions
63
test/Modelling/ActivityDiagram/ActionSequencesActivityFinalSpec.hs
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| module Modelling.ActivityDiagram.ActionSequencesActivityFinalSpec where | ||
|
|
||
| import Modelling.ActivityDiagram.ActionSequences (generateActionSequence, validActionSequence) | ||
|
|
||
| import Modelling.ActivityDiagram.Datatype ( | ||
| UMLActivityDiagram(..), | ||
| AdNode (..), | ||
| AdConnection (..) | ||
| ) | ||
|
|
||
| import Test.Hspec(Spec, context, describe, it, shouldBe) | ||
|
|
||
| spec :: Spec | ||
| spec = | ||
| describe "ActionSequences with Activity Final nodes" $ do | ||
| context "simple diagram with Activity Final" $ do | ||
| it "generates a valid sequence ending at Activity Final" $ | ||
| generateActionSequence testDiagramSimpleActivityFinal `shouldBe` ["A"] | ||
| it "validates a sequence ending at Activity Final" $ | ||
| validActionSequence ["A"] testDiagramSimpleActivityFinal `shouldBe` True | ||
| context "fork diagram with Activity Final" $ do | ||
| it "validates sequence ['A','B'] that reaches Activity Final and terminates all flows" $ | ||
| validActionSequence ["A","B"] testDiagramForkActivityFinal `shouldBe` True | ||
| it "rejects incomplete sequence ['A'] that doesn't reach termination" $ | ||
| validActionSequence ["A"] testDiagramForkActivityFinal `shouldBe` False | ||
| it "validates sequence ['A','C','B'] where Activity Final terminates all flows" $ | ||
| validActionSequence ["A","C","B"] testDiagramForkActivityFinal `shouldBe` True | ||
|
|
||
| -- Simple diagram: Initial -> A -> Activity Final | ||
| testDiagramSimpleActivityFinal :: UMLActivityDiagram | ||
| testDiagramSimpleActivityFinal = UMLActivityDiagram | ||
| { nodes = | ||
| [ AdInitialNode { label = 1 } | ||
| , AdActionNode { label = 2, name = "A" } | ||
| , AdActivityFinalNode { label = 3 } | ||
| ] | ||
| , connections = | ||
| [ AdConnection { from = 1, to = 2, guard = "" } | ||
| , AdConnection { from = 2, to = 3, guard = "" } | ||
| ] | ||
| } | ||
|
|
||
| -- Fork diagram: Initial -> A -> Fork -> (B -> Activity Final, C -> Flow Final) | ||
| testDiagramForkActivityFinal :: UMLActivityDiagram | ||
| testDiagramForkActivityFinal = UMLActivityDiagram | ||
| { nodes = | ||
| [ AdInitialNode { label = 1 } | ||
| , AdActionNode { label = 2, name = "A" } | ||
| , AdForkNode { label = 3 } | ||
| , AdActionNode { label = 4, name = "B" } | ||
| , AdActionNode { label = 5, name = "C" } | ||
| , AdActivityFinalNode { label = 6 } | ||
| , AdFlowFinalNode { label = 7 } | ||
| ] | ||
| , connections = | ||
| [ AdConnection { from = 1, to = 2, guard = "" } | ||
| , AdConnection { from = 2, to = 3, guard = "" } | ||
| , AdConnection { from = 3, to = 4, guard = "" } | ||
| , AdConnection { from = 3, to = 5, guard = "" } | ||
| , AdConnection { from = 4, to = 6, guard = "" } -- B leads to Activity Final | ||
| , AdConnection { from = 5, to = 7, guard = "" } -- C leads to Flow Final | ||
| ] | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These test cases / examples do not cover the implemented case: i.e. when a
FinalPetriNodeis added. This leads to two conclusions:testDiagramForkActivityFinal, but having an additionalAdObjectNodebetween "B" andAdActivitFinalNodeand between "C" andAdFlowFinalNode).AdActionNodesfor severalFinalchecks in the implementation in order to identify the Petri nodes corresponding toAdActionNodes that are immediately followed by anAdActivityFinalNode. (Because they do not end up in the resulting Petri net in this case.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also,
testDiagramSimpleActivityFinalis probably too trivial and can be removed altogether (as removing theAdActivityFinalNodedoes not change anything for valid action sequences).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot, can you address these reviewer comments?