11package com .thealgorithms .graph ;
22
3- import static org .junit .jupiter .api .Assertions .* ;
3+ import static org .junit .jupiter .api .Assertions .assertEquals ;
44
5- import com .thealgorithms .graph .ConstraintShortestPath .* ;
5+ import com .thealgorithms .graph .ConstrainedShortestPath . Graph ;
66import org .junit .jupiter .api .Test ;
77
8- public class ConstraintShortestPathTest {
8+ public class ConstrainedShortestPathTest {
99
1010 /**
1111 * Tests a simple linear graph to verify if the solver calculates the shortest path correctly.
@@ -18,7 +18,7 @@ public void testSimpleGraph() {
1818 graph .addEdge (1 , 2 , 3 , 2 );
1919
2020 int maxResource = 5 ;
21- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
21+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
2222
2323 assertEquals (5 , solver .solve (0 , 2 ));
2424 }
@@ -34,7 +34,7 @@ public void testNoPath() {
3434 graph .addEdge (1 , 2 , 3 , 6 );
3535
3636 int maxResource = 5 ;
37- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
37+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
3838
3939 assertEquals (-1 , solver .solve (0 , 2 ));
4040 }
@@ -52,7 +52,7 @@ public void testMultiplePaths() {
5252 graph .addEdge (2 , 3 , 3 , 2 );
5353
5454 int maxResource = 3 ;
55- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
55+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
5656
5757 assertEquals (5 , solver .solve (0 , 3 ));
5858 }
@@ -68,7 +68,7 @@ public void testExactResourceLimit() {
6868 graph .addEdge (1 , 2 , 3 , 2 );
6969
7070 int maxResource = 5 ;
71- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
71+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
7272
7373 assertEquals (5 , solver .solve (0 , 2 ));
7474 }
@@ -84,7 +84,7 @@ public void testDisconnectedGraph() {
8484 graph .addEdge (2 , 3 , 3 , 2 );
8585
8686 int maxResource = 5 ;
87- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
87+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
8888
8989 assertEquals (-1 , solver .solve (0 , 3 ));
9090 }
@@ -102,7 +102,7 @@ public void testGraphWithCycles() {
102102 graph .addEdge (1 , 3 , 4 , 2 );
103103
104104 int maxResource = 3 ;
105- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
105+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
106106
107107 assertEquals (6 , solver .solve (0 , 3 ));
108108 }
@@ -120,7 +120,7 @@ public void testLargeGraphPerformance() {
120120 }
121121
122122 int maxResource = 1000 ;
123- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
123+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
124124
125125 assertEquals (999 , solver .solve (0 , nodeCount - 1 ));
126126 }
@@ -136,7 +136,7 @@ public void testIsolatedNodes() {
136136 graph .addEdge (1 , 2 , 3 , 1 );
137137
138138 int maxResource = 5 ;
139- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
139+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
140140
141141 assertEquals (-1 , solver .solve (0 , 3 ));
142142 }
@@ -154,7 +154,7 @@ public void testCyclicLargeGraph() {
154154 graph .addEdge (0 , 5 , 5 , 3 );
155155
156156 int maxResource = 10 ;
157- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
157+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
158158
159159 assertEquals (5 , solver .solve (0 , 5 ));
160160 }
@@ -180,7 +180,7 @@ public void testLargeComplexGraph() {
180180 graph .addEdge (8 , 9 , 2 , 1 );
181181
182182 int maxResource = 10 ;
183- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
183+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
184184
185185 assertEquals (19 , solver .solve (0 , 9 ));
186186 }
@@ -194,7 +194,7 @@ public void testSingleNodeGraph() {
194194 Graph graph = new Graph (1 );
195195
196196 int maxResource = 0 ;
197- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
197+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
198198
199199 assertEquals (0 , solver .solve (0 , 0 ));
200200 }
@@ -211,7 +211,7 @@ public void testTightResourceConstraint() {
211211 graph .addEdge (0 , 2 , 2 , 2 );
212212
213213 int maxResource = 3 ;
214- ConstraintShortestPath solver = new ConstraintShortestPath (graph , maxResource );
214+ ConstrainedShortestPath solver = new ConstrainedShortestPath (graph , maxResource );
215215
216216 assertEquals (2 , solver .solve (0 , 2 ));
217217 }
0 commit comments