- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValidateBinarySearchTreeTest.java
More file actions
Latest commit
29 lines (26 loc) · 1.03 KB
/
Copy pathValidateBinarySearchTreeTest.java
File metadata and controls
29 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
importorg.example.helpers.TreeNode;
importorg.example.problems.validate_binary_search_tree.Solution;
importorg.junit.jupiter.api.Assertions;
importorg.junit.jupiter.params.ParameterizedTest;
importorg.junit.jupiter.params.provider.Arguments;
importorg.junit.jupiter.params.provider.MethodSource;
importjava.util.stream.Stream;
publicclassValidateBinarySearchTreeTest {
privatestaticStream<Arguments> provideCases() {
returnStream.of(
Arguments.of(newTreeNode(2, newTreeNode(1), newTreeNode(3)), true),
Arguments.of(newTreeNode(
5,
newTreeNode(1),
newTreeNode(4, newTreeNode(3), newTreeNode(6))
), false),
Arguments.of(newTreeNode(2, null, newTreeNode(3, newTreeNode(1), null)), false)
);
}
@ParameterizedTest
@MethodSource("provideCases")
publicvoidtest(TreeNoderoot, booleanexpected) {
Solutions = newSolution();
Assertions.assertSame(expected, s.isValidBST(root));
}
}