-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest0098.java
More file actions
33 lines (26 loc) · 822 Bytes
/
Test0098.java
File metadata and controls
33 lines (26 loc) · 822 Bytes
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
30
31
32
33
package leetcode;
import ds.tree.TreeNode;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/**
* @author xiangdotzhaoAtwoqutechcommacom
* @date 2020/1/13
*/
class Test0098 {
private final Solution0098 solution = new Solution0098();
@Test
@DisplayName("98 Validate Binary Search Tree")
void isValidBST() {
TreeNode root = new TreeNode(2);
root.left = new TreeNode(1);
root.right = new TreeNode(3);
assertTrue(solution.isValidBST(root));
root = new TreeNode(5);
root.left = new TreeNode(1);
root.right = new TreeNode(4);
root.right.left = new TreeNode(3);
root.right.right = new TreeNode(6);
assertFalse(solution.isValidBST(root));
}
}