Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MAPD_file_rouge
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AROUISSI Khaoula
MAPD_file_rouge
Commits
7d4dbce0
Commit
7d4dbce0
authored
6 months ago
by
BOUZAZI Firas
Browse files
Options
Downloads
Patches
Plain Diff
first 3rd
parent
3d9df66c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/org/petriNet/ReseauPetriTest.java
+94
-6
94 additions, 6 deletions
src/test/java/org/petriNet/ReseauPetriTest.java
with
94 additions
and
6 deletions
src/test/java/org/petriNet/ReseauPetriTest.java
+
94
−
6
View file @
7d4dbce0
...
@@ -605,12 +605,100 @@ public class ReseauPetriTest {
...
@@ -605,12 +605,100 @@ public class ReseauPetriTest {
assertEquals
(
0
,
Destruction
.
getArcs
().
size
(),
"SA1"
);
assertEquals
(
0
,
Destruction
.
getArcs
().
size
(),
"SA1"
);
}
}
@Test
@DisplayName
(
"ARC ZERO"
)
public
void
testArczero
()
{
// Initialize the Petri network
ReseauPetri
petriNetwork
=
new
ReseauPetri
();
// Create places
Place
place1
=
new
Place
(
3
,
petriNetwork
.
generateId
(
1
));
Place
place2
=
new
Place
(
0
,
petriNetwork
.
generateId
(
1
));
// Add places to the network
petriNetwork
.
ajouterPlace
(
place1
);
petriNetwork
.
ajouterPlace
(
place2
);
// Create a transition
Transition
transition1
=
new
Transition
(
"T1"
,
petriNetwork
.
generateId
(
2
));
// Add the transition to the network
petriNetwork
.
ajouterTransition
(
transition1
);
// Create arcs and add them to the network
// Incoming arc from place2 to transition1 with weight 1
Arc_zero
incomingArc_zero
=
new
Arc_zero
(
transition1
,
place2
,
1
,
petriNetwork
.
generateId
(
0
));
petriNetwork
.
ajouterArc
(
incomingArc_zero
);
transition1
.
ajouterArc_ENTRANT
(
incomingArc_zero
);
// Outgoing arc from transition1 to place1 with weight 1
Arc_SORTANT
outgoingArc
=
new
Arc_SORTANT
(
transition1
,
place1
,
1
,
petriNetwork
.
generateId
(
0
));
petriNetwork
.
ajouterArc
(
outgoingArc
);
transition1
.
ajouterArc_SORTANT
(
outgoingArc
);
// Display the initial state of the Petri network
System
.
out
.
println
(
"Initial State of Petri Network:"
);
petriNetwork
.
afficherReseau
();
// Activate the transition
System
.
out
.
println
(
"\nActivating transition T1..."
);
petriNetwork
.
tirer_transition
(
String
.
valueOf
(
transition1
.
getId
()));
// Display the state of the Petri network after activation
System
.
out
.
println
(
"\nState of Petri Network after Transition T1 Activation:"
);
petriNetwork
.
afficherReseau
();
// Assertions to verify the correct state of the Petri network
assertEquals
(
4
,
place1
.
get_nombre_jetons
(),
"Tokens in Place 1 should be 4"
);
assertEquals
(
0
,
place2
.
get_nombre_jetons
(),
"Tokens in Place 2 should be 0"
);
}
@Test
@DisplayName
(
"ARC Videur"
)
public
void
testArcvideur
()
{
// Initialize the Petri network
ReseauPetri
petriNetwork
=
new
ReseauPetri
();
// Create places
Place
place1
=
new
Place
(
2
,
petriNetwork
.
generateId
(
1
));
Place
place2
=
new
Place
(
4
,
petriNetwork
.
generateId
(
1
));
// Add places to the network
petriNetwork
.
ajouterPlace
(
place1
);
petriNetwork
.
ajouterPlace
(
place2
);
// Create a transition
Transition
transition1
=
new
Transition
(
"T1"
,
petriNetwork
.
generateId
(
2
));
// Add the transition to the network
petriNetwork
.
ajouterTransition
(
transition1
);
// Create arcs and add them to the network
// Incoming arc from place2 to transition1 with weight 1
Arc_videur
incomingArc_videur
=
new
Arc_videur
(
transition1
,
place2
,
1
,
petriNetwork
.
generateId
(
0
));
petriNetwork
.
ajouterArc
(
incomingArc_videur
);
transition1
.
ajouterArc_ENTRANT
(
incomingArc_videur
);
// Outgoing arc from transition1 to place1 with weight 1
Arc_SORTANT
outgoingArc
=
new
Arc_SORTANT
(
transition1
,
place1
,
1
,
petriNetwork
.
generateId
(
0
));
petriNetwork
.
ajouterArc
(
outgoingArc
);
transition1
.
ajouterArc_SORTANT
(
outgoingArc
);
// Display the initial state of the Petri network
System
.
out
.
println
(
"Initial State of Petri Network:"
);
petriNetwork
.
afficherReseau
();
// Activate the transition
System
.
out
.
println
(
"\nActivating transition T1..."
);
petriNetwork
.
tirer_transition
(
String
.
valueOf
(
transition1
.
getId
()));
// Display the state of the Petri network after activation
System
.
out
.
println
(
"\nState of Petri Network after Transition T1 Activation:"
);
petriNetwork
.
afficherReseau
();
// Assertions to verify the correct state of the Petri network
assertEquals
(
3
,
place1
.
get_nombre_jetons
(),
"Tokens in Place 1 should be 3"
);
assertEquals
(
0
,
place2
.
get_nombre_jetons
(),
"Tokens in Place 2 should be 0"
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment