1
1
package com .thealgorithms .dynamicprogramming ;
2
2
3
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
4
+
5
+ import com .thealgorithms .datastructures .graphs .UndirectedAdjacencyListGraph ;
3
6
import org .junit .jupiter .api .BeforeEach ;
4
7
import org .junit .jupiter .api .Test ;
5
- import com .thealgorithms .datastructures .graphs .UndirectedAdjacencyListGraph ;
6
- import static org .junit .jupiter .api .Assertions .assertEquals ;
7
8
8
9
class TreeMatchingTest {
9
10
UndirectedAdjacencyListGraph graph ;
@@ -29,7 +30,7 @@ void testMaxMatchingForGeneralTree() {
29
30
graph .addEdge (5 , 9 , 10 );
30
31
31
32
TreeMatching treeMatching = new TreeMatching (graph );
32
- assertEquals (110 ,treeMatching .getMaxMatching (0 ,-1 ));
33
+ assertEquals (110 , treeMatching .getMaxMatching (0 , -1 ));
33
34
}
34
35
35
36
@ Test
@@ -47,7 +48,7 @@ void testMaxMatchingForBalancedTree() {
47
48
graph .addEdge (7 , 11 , 10 );
48
49
graph .addEdge (7 , 12 , 5 );
49
50
TreeMatching treeMatching = new TreeMatching (graph );
50
- assertEquals (100 ,treeMatching .getMaxMatching (0 ,-1 ));
51
+ assertEquals (100 , treeMatching .getMaxMatching (0 , -1 ));
51
52
}
52
53
53
54
@ Test
@@ -65,13 +66,13 @@ void testMaxMatchingForTreeWithVariedEdgeWeights() {
65
66
graph .addEdge (4 , 11 , 50 );
66
67
graph .addEdge (4 , 12 , 20 );
67
68
TreeMatching treeMatching = new TreeMatching (graph );
68
- assertEquals (140 ,treeMatching .getMaxMatching (0 ,-1 ));
69
+ assertEquals (140 , treeMatching .getMaxMatching (0 , -1 ));
69
70
}
70
71
71
72
@ Test
72
73
void emptyTree () {
73
74
TreeMatching treeMatching = new TreeMatching (graph );
74
- assertEquals (0 ,treeMatching .getMaxMatching (0 ,-1 ));
75
+ assertEquals (0 , treeMatching .getMaxMatching (0 , -1 ));
75
76
}
76
77
77
78
@ Test
@@ -116,5 +117,4 @@ void testUnbalancedTree() {
116
117
TreeMatching treeMatching = new TreeMatching (graph );
117
118
assertEquals (100 , treeMatching .getMaxMatching (0 , -1 ));
118
119
}
119
-
120
120
}
0 commit comments