/** * See if it can handle a null leaf */ @Test public void findClosest_nullLeaf() { KdTreeSearch1<double[]> alg = createAlg(); KdTree tree = createTreeWithNull(); alg.setTree(tree); alg.setMaxDistance(Double.MAX_VALUE); // the first decision will be incorrect and it will need to back track KdTree.Node found = alg.findNeighbor(new double[]{2, 3}); assertSame(found, tree.root); }
/** * See if it can handle a null leaf */ @Test public void findClosest_nullLeaf() { KdTreeSearchN<double[]> alg = createAlg(); KdTree tree = StandardKdTreeSearch1Tests.createTreeWithNull(); alg.setTree(tree); alg.setMaxDistance(Double.MAX_VALUE); // the first decision will be incorrect and it will need to back track found.reset(); alg.findNeighbor(new double[]{2, 3}, 1, found); assertTrue(found.get(0).node == tree.root); }