forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_1038Test.java
More file actions
36 lines (28 loc) · 1.06 KB
/
_1038Test.java
File metadata and controls
36 lines (28 loc) · 1.06 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
30
31
32
33
34
35
36
package com.fishercoder;
import com.fishercoder.common.classes.TreeNode;
import com.fishercoder.common.utils.TreeUtils;
import com.fishercoder.solutions._1038;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.Arrays;
import static org.junit.Assert.assertEquals;
public class _1038Test {
private static _1038.Solution1 solution1;
private static TreeNode root;
private static TreeNode expected;
private static TreeNode actual;
@BeforeClass
public static void setup() {
solution1 = new _1038.Solution1();
}
@Test
public void test1() {
root = TreeUtils.constructBinaryTree(Arrays.asList(4, 1, 6, 0, 2, 5, 7, null, null, null, 3, null, null, null, 8));
TreeUtils.printBinaryTree(root);
expected = TreeUtils.constructBinaryTree(Arrays.asList(30, 36, 21, 36, 35, 26, 15, null, null, null, 33, null, null, null, 8));
TreeUtils.printBinaryTree(expected);
actual = solution1.bstToGst(root);
TreeUtils.printBinaryTree(actual);
assertEquals(expected, actual);
}
}