From 67e3dada7afc07c469fc33ca4732bed4b4562f38 Mon Sep 17 00:00:00 2001 From: Nicolas Mellado Date: Thu, 3 Aug 2023 16:30:24 +0200 Subject: [PATCH] WIP: Test query mutation --- tests/src/queries_range.cpp | 40 ++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/tests/src/queries_range.cpp b/tests/src/queries_range.cpp index 4926d8a29..04db7158d 100644 --- a/tests/src/queries_range.cpp +++ b/tests/src/queries_range.cpp @@ -47,21 +47,33 @@ void testKdTreeRangeIndex(bool quick = true) #pragma omp parallel for - for (int i = 0; i < N; ++i) - { - Scalar r = Eigen::internal::random(0., 0.5); - std::vector resultsTree; + for (int i = 0; i < N; ++i) { - for (int j : kdtree->range_neighbors(i, r)) { - resultsTree.push_back(j); - } - if( SampleKdTree ) { - bool resTree = check_range_neighbors(points, sampling, i, r, resultsTree); - VERIFY(resTree); - } - else { - bool resTree = check_range_neighbors(points, sampling, i, r, resultsTree); - VERIFY(resTree); +// auto query = KdTreeRangeIndexQuery>(kdtree, 0, 0.); + auto query = kdtree->range_neighbors(0, 0); + + for (int repeatRadius = 0; repeatRadius != 10; ++repeatRadius) { + std::vector resultsTree, resultsMutable; + Scalar r = Eigen::internal::random(0.01, 0.5); + + for (int j: kdtree->range_neighbors(i, r)) { + resultsTree.push_back(j); + } + // for (int j : kdtree->range_neighbors(i, r)) { + for (int j: query(i, r)) { + resultsMutable.push_back(j); + } + if (SampleKdTree) { + bool resTree = check_range_neighbors(points, sampling, i, r, resultsTree); + bool resMutable = check_range_neighbors(points, sampling, i, r, resultsMutable); + VERIFY(resTree); + VERIFY(resMutable); + } else { + bool resTree = check_range_neighbors(points, sampling, i, r, resultsTree); + bool resMutable = check_range_neighbors(points, sampling, i, r, resultsMutable); + VERIFY(resTree); + VERIFY(resMutable); + } } }