import org.junit.Test;
public class GlobalOptimumTwoTest {
@Test
public void basicTest() {
GlobalOptimumTwo.maxSum = Integer.MIN_VALUE;
int[] values = {10, -5, -20};
System.out.println("Layer order");
BTree root = GlobalOptimumTwo.buildTree(values);
BTreePrinter.printNode(root);
GlobalOptimumTwo.maxPathSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumTwo.maxSum);
GlobalOptimumTwo.maxSum = Integer.MIN_VALUE;
int[] values2 = {10, -5, 20};
System.out.println("Layer order");
root = GlobalOptimumTwo.buildTree(values2);
BTreePrinter.printNode(root);
GlobalOptimumTwo.maxPathSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumTwo.maxSum);
GlobalOptimumTwo.maxSum = Integer.MIN_VALUE;
int[] values3 = {10, -5, -20, 3, -15, 7, 26, -9, 14};
System.out.println("Layer order");
root = GlobalOptimumTwo.buildTree(values3);
BTreePrinter.printNode(root);
GlobalOptimumTwo.maxPathSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumTwo.maxSum);
GlobalOptimumTwo.maxSum = Integer.MIN_VALUE;
int[] values4 = {10};
System.out.println("Layer order");
root = GlobalOptimumTwo.buildTree(values4);
BTreePrinter.printNode(root);
GlobalOptimumTwo.maxPathSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumTwo.maxSum);
GlobalOptimumTwo.maxSum = Integer.MIN_VALUE;
int[] values5 = {};
System.out.println("Layer order");
root = GlobalOptimumTwo.buildTree(values5);
BTreePrinter.printNode(root);
GlobalOptimumTwo.maxPathSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumTwo.maxSum);
GlobalOptimumTwo.maxSum = Integer.MIN_VALUE;
int[] values6 = {-1};
System.out.println("Layer order");
root = GlobalOptimumTwo.buildTree(values6);
BTreePrinter.printNode(root);
GlobalOptimumTwo.maxPathSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumTwo.maxSum);
GlobalOptimumTwo.maxSum = Integer.MIN_VALUE;
int[] values7 = {-1, -8, -4};
System.out.println("Layer order");
root = GlobalOptimumTwo.buildTree(values7);
BTreePrinter.printNode(root);
GlobalOptimumTwo.maxPathSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumTwo.maxSum);
GlobalOptimumTwo.maxSum = Integer.MIN_VALUE;
int[] values8 = {16, -85, 26, -9, 52, -33, 0, -21, 93};
System.out.println("Layer order");
root = GlobalOptimumTwo.buildTree(values8);
BTreePrinter.printNode(root);
GlobalOptimumTwo.maxPathSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumTwo.maxSum);
}
}