import org.junit.Test;
public class GlobalOptimumOneTest {
@Test
public void basicTest() {
GlobalOptimumOne.max = Integer.MIN_VALUE;
int[] values = {10, -5, -20};
System.out.println("Layer order");
BTree root = GlobalOptimumOne.buildTree(values);
BTreePrinter.printNode(root);
GlobalOptimumOne.maxSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumOne.max);
GlobalOptimumOne.max = Integer.MIN_VALUE;
int[] values2 = {10, -5, 20};
System.out.println("Layer order");
root = GlobalOptimumOne.buildTree(values2);
BTreePrinter.printNode(root);
GlobalOptimumOne.maxSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumOne.max);
GlobalOptimumOne.max = Integer.MIN_VALUE;
int[] values3 = {10, -5, -20, 3, -15, 7, 26, -9, 14};
System.out.println("Layer order");
root = GlobalOptimumOne.buildTree(values3);
BTreePrinter.printNode(root);
GlobalOptimumOne.maxSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumOne.max);
GlobalOptimumOne.max = Integer.MIN_VALUE;
int[] values4 = {10};
System.out.println("Layer order");
root = GlobalOptimumOne.buildTree(values4);
BTreePrinter.printNode(root);
GlobalOptimumOne.maxSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumOne.max);
GlobalOptimumOne.max = Integer.MIN_VALUE;
int[] values5 = {};
System.out.println("Layer order");
root = GlobalOptimumOne.buildTree(values5);
BTreePrinter.printNode(root);
GlobalOptimumOne.maxSum(root);
System.out.println("max subtree");
System.out.println(GlobalOptimumOne.max);
}
}