import org.junit.Test;
public class GlobalOptimumThreeTest {
@Test
public void basicTest() {
int[] values = {10, -5, -20};
System.out.println("Layer order");
BTree root = GlobalOptimumThree.buildTree(values);
BTreePrinter.printNode(root);
BTree c = GlobalOptimumThree.commonParent0(root, -5, 20);
System.out.println("common parent of -5, 20");
System.out.println(c);
int[] values2 = {10, -5, 20};
System.out.println("Layer order");
root = GlobalOptimumThree.buildTree(values2);
BTreePrinter.printNode(root);
c = GlobalOptimumThree.commonParent0(root, -5, 10);
System.out.println("common parent of -5, 10");
System.out.println(c);
int[] values3 = {10, -5, -20, 3, -15, 7, 26, -9, 14};
System.out.println("Layer order");
root = GlobalOptimumThree.buildTree(values3);
BTreePrinter.printNode(root);
c = GlobalOptimumThree.commonParent0(root, 3, 7);
System.out.println("common parent of 3, 7");
System.out.println(c);
int[] values4 = {10};
System.out.println("Layer order");
root = GlobalOptimumThree.buildTree(values4);
BTreePrinter.printNode(root);
c = GlobalOptimumThree.commonParent0(root, 10, 10);
System.out.println("common parent 10, 10");
System.out.println(c);
int[] values5 = {};
System.out.println("Layer order");
root = GlobalOptimumThree.buildTree(values5);
BTreePrinter.printNode(root);
c = GlobalOptimumThree.commonParent0(root, 0, 0);
System.out.println("common parent 0, 0");
System.out.println(c);
int[] values6 = {-1};
System.out.println("Layer order");
root = GlobalOptimumThree.buildTree(values6);
BTreePrinter.printNode(root);
c = GlobalOptimumThree.commonParent0(root, -1, 0);
System.out.println("common parent of -1, 0");
System.out.println(c);
int[] values7 = {-1, -8, -4};
System.out.println("Layer order");
root = GlobalOptimumThree.buildTree(values7);
BTreePrinter.printNode(root);
c = GlobalOptimumThree.commonParent0(root, 90, 3);
System.out.println("common parent: 90, 3");
System.out.println(c);
int[] values8 = {16, -85, 26, -9, 52, -33, 0, -21, 93};
System.out.println("Layer order");
root = GlobalOptimumThree.buildTree(values8);
BTreePrinter.printNode(root);
c = GlobalOptimumThree.commonParent0(root, 52, -21);
System.out.println("common parent of 52, -21");
System.out.println(c);
int[] values9 = {16, -85, 26, -9, 52, -33, 0, -21, 93};
System.out.println("Layer order");
root = GlobalOptimumThree.buildTree(values9);
BTreePrinter.printNode(root);
c = GlobalOptimumThree.commonParent0(root, 52, 21);
System.out.println("common parent of 52, 21");
System.out.println(c);
int[] values10 = {16, -85, 26, -9, 52, -33, 0, -21, 93};
System.out.println("Layer order");
root = GlobalOptimumThree.buildTree(values10);
BTreePrinter.printNode(root);
c = GlobalOptimumThree.commonParent0(root, 16, 0);
System.out.println("common parent of 16, 0");
System.out.println(c);
}
@Test
public void test() {
int[] values10 = {16, -85, 26, -9, 52, -33, 0, -21, 93};
System.out.println("Layer order");
BTree root = GlobalOptimumThree.buildTree(values10);
BTreePrinter.printNode(root);
BTree c = GlobalOptimumThree.commonParent0(root, 16, 0);
System.out.println("common parent of 16, 0");
System.out.println(c);
}
}