Skip to content

Commit c7bc224

Browse files
committed
Improving Code Coverage Update
1 parent e8829f0 commit c7bc224

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/test/java/com/thealgorithms/tree/HeavyLightDecompositionTest.java

+10
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,14 @@ void testSkewedTreeMaxQuery() {
8282

8383
assertEquals(35, hld.queryMaxInPath(1, 4), "Max value in skewed tree should be 35");
8484
}
85+
86+
/**
87+
* Tests a skewed tree structure to ensure max path queries work correctly.
88+
* Expected: When called with u as a deeper node, it should swap correctly.
89+
*/
90+
@Test
91+
void testDepthSwapInPathQuery() {
92+
assertEquals(50, hld.queryMaxInPath(5, 2), "Query should handle depth swap correctly");
93+
assertEquals(40, hld.queryMaxInPath(4, 1), "Query handle swap nodes and return max value");
94+
}
8595
}

0 commit comments

Comments
 (0)