Search in sources :

Example 1 with TreeNode

use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.

the class _449Test method test1.

@Test
public void test1() {
    expectedRoot = new TreeNode(3);
    expectedRoot.left = new TreeNode(1);
    expectedRoot.right = new TreeNode(4);
    expectedRoot.left.right = new TreeNode(2);
    assertEquals(expectedRoot.toString(), solution1.deserialize(solution1.serialize(expectedRoot)).toString());
    assertEquals(expectedRoot.toString(), solution2.deserialize(solution2.serialize(expectedRoot)).toString());
    assertEquals(expectedRoot.toString(), solution3.deserialize(solution3.serialize(expectedRoot)).toString());
}
Also used : TreeNode(com.fishercoder.common.classes.TreeNode) Test(org.junit.Test)

Example 2 with TreeNode

use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.

the class _449Test method test2.

@Test
public void test2() {
    expectedRoot = new TreeNode(2);
    expectedRoot.left = new TreeNode(1);
    expectedRoot.right = new TreeNode(3);
    assertEquals(expectedRoot.toString(), solution1.deserialize(solution1.serialize(expectedRoot)).toString());
    assertEquals(expectedRoot.toString(), solution2.deserialize(solution2.serialize(expectedRoot)).toString());
    assertEquals(expectedRoot.toString(), solution3.deserialize(solution3.serialize(expectedRoot)).toString());
}
Also used : TreeNode(com.fishercoder.common.classes.TreeNode) Test(org.junit.Test)

Example 3 with TreeNode

use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.

the class _501Test method setupForEachTest.

@Before
public void setupForEachTest() {
    expected = new int[] {};
    actual = new int[] {};
    treeNode = new TreeNode(0);
}
Also used : TreeNode(com.fishercoder.common.classes.TreeNode) Before(org.junit.Before)

Example 4 with TreeNode

use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.

the class _513Test method setupForEachTest.

@Before
public void setupForEachTest() {
    expected = 0;
    actual = 0;
    root = new TreeNode(0);
}
Also used : TreeNode(com.fishercoder.common.classes.TreeNode) Before(org.junit.Before)

Example 5 with TreeNode

use of com.fishercoder.common.classes.TreeNode in project Leetcode by fishercoder1534.

the class _513Test method test1.

@Test
public void test1() {
    TreeNode root = new TreeNode(2);
    root.left = new TreeNode(1);
    root.right = new TreeNode(3);
    expected = 1;
    actual = test.findBottomLeftValue(root);
    assertEquals(expected, actual);
}
Also used : TreeNode(com.fishercoder.common.classes.TreeNode) Test(org.junit.Test)

Aggregations

TreeNode (com.fishercoder.common.classes.TreeNode)39 Test (org.junit.Test)24 ArrayList (java.util.ArrayList)7 LinkedList (java.util.LinkedList)6 HashMap (java.util.HashMap)2 List (java.util.List)2 Before (org.junit.Before)2 ArrayDeque (java.util.ArrayDeque)1 TreeMap (java.util.TreeMap)1 Ignore (org.junit.Ignore)1