From f50a95910dd6f64751bd2004a335dec386485acc Mon Sep 17 00:00:00 2001 From: ullingerc Date: Tue, 1 Oct 2024 14:26:08 +0200 Subject: [PATCH] tests --- test/engine/SpatialJoinTest.cpp | 76 +++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/test/engine/SpatialJoinTest.cpp b/test/engine/SpatialJoinTest.cpp index 8b18ec93e2..3fcbe93270 100644 --- a/test/engine/SpatialJoinTest.cpp +++ b/test/engine/SpatialJoinTest.cpp @@ -823,6 +823,66 @@ std::vector> expectedMaxDist10000000_rows_diff{ mergeToRow(unordered_rows.at(4), unordered_rows_small.at(3), expectedDistEifLib)}; +std::vector> expectedNearestNeighbors1{ + mergeToRow(unordered_rows.at(0), unordered_rows.at(0), expectedDistSelf), + mergeToRow(unordered_rows.at(1), unordered_rows.at(1), expectedDistSelf), + mergeToRow(unordered_rows.at(2), unordered_rows.at(2), expectedDistSelf), + mergeToRow(unordered_rows.at(3), unordered_rows.at(3), expectedDistSelf), + mergeToRow(unordered_rows.at(4), unordered_rows.at(4), expectedDistSelf)}; + +std::vector> expectedNearestNeighbors2{ + mergeToRow(unordered_rows.at(0), unordered_rows.at(0), expectedDistSelf), + mergeToRow(unordered_rows.at(1), unordered_rows.at(1), expectedDistSelf), + mergeToRow(unordered_rows.at(2), unordered_rows.at(2), expectedDistSelf), + mergeToRow(unordered_rows.at(3), unordered_rows.at(3), expectedDistSelf), + mergeToRow(unordered_rows.at(4), unordered_rows.at(4), expectedDistSelf), + mergeToRow(unordered_rows.at(0), unordered_rows.at(1), expectedDistUniMun), + mergeToRow(unordered_rows.at(1), unordered_rows.at(0), expectedDistUniMun), + mergeToRow(unordered_rows.at(2), unordered_rows.at(4), expectedDistEyeEif), + mergeToRow(unordered_rows.at(3), unordered_rows.at(2), expectedDistEyeLib), + mergeToRow(unordered_rows.at(4), unordered_rows.at(2), expectedDistEyeEif)}; + +std::vector> expectedNearestNeighbors2_400000{ + mergeToRow(unordered_rows.at(0), unordered_rows.at(0), expectedDistSelf), + mergeToRow(unordered_rows.at(1), unordered_rows.at(1), expectedDistSelf), + mergeToRow(unordered_rows.at(2), unordered_rows.at(2), expectedDistSelf), + mergeToRow(unordered_rows.at(3), unordered_rows.at(3), expectedDistSelf), + mergeToRow(unordered_rows.at(4), unordered_rows.at(4), expectedDistSelf), + mergeToRow(unordered_rows.at(0), unordered_rows.at(1), expectedDistUniMun), + mergeToRow(unordered_rows.at(1), unordered_rows.at(0), expectedDistUniMun), + mergeToRow(unordered_rows.at(2), unordered_rows.at(4), expectedDistEyeEif), + mergeToRow(unordered_rows.at(4), unordered_rows.at(2), expectedDistEyeEif)}; + +std::vector> expectedNearestNeighbors2_4000{ + mergeToRow(unordered_rows.at(0), unordered_rows.at(0), expectedDistSelf), + mergeToRow(unordered_rows.at(1), unordered_rows.at(1), expectedDistSelf), + mergeToRow(unordered_rows.at(2), unordered_rows.at(2), expectedDistSelf), + mergeToRow(unordered_rows.at(3), unordered_rows.at(3), expectedDistSelf), + mergeToRow(unordered_rows.at(4), unordered_rows.at(4), expectedDistSelf), + mergeToRow(unordered_rows.at(0), unordered_rows.at(1), expectedDistUniMun), + mergeToRow(unordered_rows.at(1), unordered_rows.at(0), expectedDistUniMun)}; + +std::vector> expectedNearestNeighbors2_40{ + mergeToRow(unordered_rows.at(0), unordered_rows.at(0), expectedDistSelf), + mergeToRow(unordered_rows.at(1), unordered_rows.at(1), expectedDistSelf), + mergeToRow(unordered_rows.at(2), unordered_rows.at(2), expectedDistSelf), + mergeToRow(unordered_rows.at(3), unordered_rows.at(3), expectedDistSelf), + mergeToRow(unordered_rows.at(4), unordered_rows.at(4), expectedDistSelf)}; + +std::vector> expectedNearestNeighbors3_500000{ + mergeToRow(unordered_rows.at(0), unordered_rows.at(0), expectedDistSelf), + mergeToRow(unordered_rows.at(1), unordered_rows.at(1), expectedDistSelf), + mergeToRow(unordered_rows.at(2), unordered_rows.at(2), expectedDistSelf), + mergeToRow(unordered_rows.at(3), unordered_rows.at(3), expectedDistSelf), + mergeToRow(unordered_rows.at(4), unordered_rows.at(4), expectedDistSelf), + mergeToRow(unordered_rows.at(0), unordered_rows.at(1), expectedDistUniMun), + mergeToRow(unordered_rows.at(1), unordered_rows.at(0), expectedDistUniMun), + mergeToRow(unordered_rows.at(1), unordered_rows.at(4), expectedDistMunEif), + mergeToRow(unordered_rows.at(0), unordered_rows.at(4), expectedDistUniEif), + mergeToRow(unordered_rows.at(2), unordered_rows.at(4), expectedDistEyeEif), + mergeToRow(unordered_rows.at(4), unordered_rows.at(2), expectedDistEyeEif), + mergeToRow(unordered_rows.at(4), unordered_rows.at(0), expectedDistUniEif)}; + // test the compute result method on small examples TEST(SpatialJoin, computeResultSmallDatasetLargeChildren) { std::vector columnNames = { @@ -855,6 +915,22 @@ TEST(SpatialJoin, computeResultSmallDatasetLargeChildren) { buildAndTestSmallTestSetLargeChildren("", false, expectedMaxDist10000000_rows, columnNames); + buildAndTestSmallTestSetLargeChildren("", true, + expectedNearestNeighbors1, columnNames); + buildAndTestSmallTestSetLargeChildren("", true, + expectedNearestNeighbors2, columnNames); + buildAndTestSmallTestSetLargeChildren("", true, + expectedNearestNeighbors2_400000, + columnNames); + buildAndTestSmallTestSetLargeChildren("", true, + expectedNearestNeighbors2_4000, + columnNames); + buildAndTestSmallTestSetLargeChildren("", true, + expectedNearestNeighbors2_40, + columnNames); + buildAndTestSmallTestSetLargeChildren("", true, + expectedNearestNeighbors3_500000, + columnNames); } TEST(SpatialJoin, computeResultSmallDatasetSmallChildren) {