forked from examplehub/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPathSumTest.java
More file actions
26 lines (22 loc) · 789 Bytes
/
PathSumTest.java
File metadata and controls
26 lines (22 loc) · 789 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
package com.examplehub.leetcode.easy;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.examplehub.datastructures.binarytree.Node;
import org.junit.jupiter.api.Test;
class PathSumTest {
@Test
void testSolution1() {
Node<Integer> root = new Node<>(5);
root.left = new Node<>(4);
root.right = new Node<>(8);
root.left.left = new Node<>(11);
root.right.left = new Node<>(13);
root.right.right = new Node<>(4);
root.left.left.left = new Node<>(7);
root.left.left.right = new Node<>(2);
root.right.right.right = new Node<>(1);
assertTrue(PathSum.solution1(root, 22));
assertTrue(PathSum.solution1(root, 26));
assertFalse(PathSum.solution1(root, 100));
}
}