diff --git a/Octree/test/Octree/test_node.cpp b/Octree/test/Octree/test_node.cpp index 0f657e046db..29eae6317dc 100644 --- a/Octree/test/Octree/test_node.cpp +++ b/Octree/test/Octree/test_node.cpp @@ -2,10 +2,54 @@ #include #include #include +#include -typedef CGAL::Octree::Node::Node Node; +typedef CGAL::Octree::Node::Node::iterator> Node; int main(void) { + // Build a new node + Node n = Node(); + + // Check that its values are correct + assert(n.is_root()); + assert(n.is_leaf()); + assert(!n.parent()); + assert(n.depth() == 0); + assert(n.location()[0] == 0 && n.location()[1] == 0 && n.location()[2] == 0); + + // Split the node + n.split(); + + // Check that it's children's values are also correct + for (std::size_t i = 0; i < 8; ++i) { + + assert(!n[i].is_root()); + assert(n[i].is_leaf()); + assert(*n[i].parent() == n); + assert(n[i].depth() == 1); + } + + // Check that the parent has updated + assert(n.is_root()); + assert(!n.is_leaf()); + + // Split one of the children + n[1].split(); + + // Check each of that child's children + for (std::size_t i = 0; i < 8; ++i) { + + assert(!n[1][i].is_root()); + assert(n[1][i].is_leaf()); + assert(*n[1][i].parent() == n[1]); + assert(*n[1][i].parent()->parent() == n); + assert(n[1][i].depth() == 2); + } + + // Check that the child's values have updated + assert(!n[1].is_root()); + assert(!n[1].is_leaf()); + return 0; } diff --git a/Octree/test/Octree/test_octree_nearest_neighbor.cpp b/Octree/test/Octree/test_octree_nearest_neighbor.cpp index 81a622dafe1..5fd4d438575 100644 --- a/Octree/test/Octree/test_octree_nearest_neighbor.cpp +++ b/Octree/test/Octree/test_octree_nearest_neighbor.cpp @@ -63,7 +63,7 @@ void naive_vs_octree(std::size_t dataset_size) { << "distance^2 of " << CGAL::squared_distance(naive_nearest, random_point) << " " << "with a time of " - << naive_elapsed_time.count() + << naive_elapsed_time.count() << "s " << std::endl; // Do the same using the octree @@ -84,7 +84,7 @@ void naive_vs_octree(std::size_t dataset_size) { << "distance^2 of " << CGAL::squared_distance(octree_nearest, random_point) << " " << "with a time of " - << octree_elapsed_time.count() + << octree_elapsed_time.count() << "s " << std::endl; // Check that they produce the same answer