From 09c76582b5ff0f2b942609f5c85744f1ce96e332 Mon Sep 17 00:00:00 2001 From: Markus Vieth Date: Mon, 10 Jan 2022 13:40:24 +0100 Subject: [PATCH] Fix octree dynamic-depths tests If enableDynamicDepth is not called on a "fresh" octree, the assert inside the function aborts the test Problem was introduced in commit https://github.com/PointCloudLibrary/pcl/commit/8bd1213e914bcf9cd0729ed34c0c8351d41d342c while extending tests --- test/octree/test_octree.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/octree/test_octree.cpp b/test/octree/test_octree.cpp index 0a4df9e6e3d..27c890b18fd 100644 --- a/test/octree/test_octree.cpp +++ b/test/octree/test_octree.cpp @@ -1132,10 +1132,6 @@ TEST (PCL, Octree_Pointcloud_Nearest_K_Neighbour_Search) std::priority_queue::VectorType> pointCandidates; - // create octree - OctreePointCloudSearch octree (0.1); - octree.setInputCloud (cloudIn); - Indices k_indices; std::vector k_sqr_distances; @@ -1143,6 +1139,10 @@ TEST (PCL, Octree_Pointcloud_Nearest_K_Neighbour_Search) std::vector k_sqr_distances_bruteforce; for (const std::size_t maxObjsPerLeaf: {0, 5}) { + // create octree + OctreePointCloudSearch octree (0.1); + octree.setInputCloud (cloudIn); + if (maxObjsPerLeaf != 0) octree.enableDynamicDepth (maxObjsPerLeaf); for (unsigned int test_id = 0; test_id < test_runs; test_id++) @@ -1233,11 +1233,11 @@ TEST (PCL, Octree_Pointcloud_Box_Search) srand (static_cast (time (nullptr))); - // create octree - OctreePointCloudSearch octree (1); - octree.setInputCloud (cloudIn); - for (const std::size_t maxObjsPerLeaf: {0, 5}) { + // create octree + OctreePointCloudSearch octree (1); + octree.setInputCloud (cloudIn); + if (maxObjsPerLeaf != 0) octree.enableDynamicDepth (maxObjsPerLeaf); for (unsigned int test_id = 0; test_id < test_runs; test_id++)