Skip to content

Commit 03ac304

Browse files
committed
TEST: Exercise both paths in dispatched OOC algorithms
* Force direct and scanline dispatch in six correctness suites * Reuse existing expected outputs and exemplars for both paths * Cover valid type and multicomponent threshold cases Signed-off-by: Joey Kleingers <joey.kleingers@bluequartz.net>
1 parent 56b33ef commit 03ac304

7 files changed

Lines changed: 49 additions & 6 deletions

src/Plugins/OrientationAnalysis/test/BadDataNeighborOrientationCheckTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "simplnx/Pipeline/Pipeline.hpp"
1111
#include "simplnx/Pipeline/PipelineFilter.hpp"
1212
#include "simplnx/UnitTest/UnitTestCommon.hpp"
13+
#include "simplnx/Utilities/AlgorithmDispatch.hpp"
1314

1415
#include <filesystem>
1516
#include <fstream>
@@ -1575,6 +1576,10 @@ TEST_CASE("OrientationAnalysis::BadDataNeighborOrientationCheckFilter: Case 3.2"
15751576
// Case 4: Semi-Complex Synthetic Structure | Valid | 3 phase | Tolerance 5 | 4 Min Neighbors
15761577
TEST_CASE("OrientationAnalysis::BadDataNeighborOrientationCheckFilter: Case 4", "[OrientationAnalysis][BadDataNeighborOrientationCheckFilter]")
15771578
{
1579+
const bool forceOocAlgorithm = static_cast<bool>(GENERATE(from_range(nx::core::k_ForceOocTestValues)));
1580+
const nx::core::ForceOocAlgorithmGuard guard(forceOocAlgorithm);
1581+
CAPTURE(forceOocAlgorithm);
1582+
15781583
const UnitTest::TestFileSentinel testDataSentinel(unit_test::k_TestFilesDir, "bad_data_neighbor_orientation_check_v2.tar.gz", "bad_data_neighbor_orientation_check_v2", true, true);
15791584

15801585
auto baseDataFilePath = fs::path(fmt::format("{}/bad_data_neighbor_orientation_check_v2/case_4/case_4_input.dream3d", unit_test::k_TestFilesDir));

src/Plugins/OrientationAnalysis/test/ComputeKernelAvgMisorientationsTest.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ TEST_CASE("OrientationAnalysis::ComputeKernelAvgMisorientations: Working Set Pla
221221
SIMPLNX_RESULT_REQUIRE_VALID(result);
222222
REQUIRE(result.value().UseRollingWindow);
223223
REQUIRE(result.value().WindowSlices == 3);
224-
REQUIRE(result.value().RollingBytes == 2720000);
224+
REQUIRE(result.value().RollingBytes == 3040000);
225225
REQUIRE(result.value().RollingBytes <= result.value().CapBytes);
226226
}
227227

@@ -238,12 +238,12 @@ TEST_CASE("OrientationAnalysis::ComputeKernelAvgMisorientations: Working Set Pla
238238
SIMPLNX_RESULT_REQUIRE_VALID(result);
239239
REQUIRE_FALSE(result.value().UseRollingWindow);
240240
REQUIRE(result.value().CapBytes == 262144);
241-
REQUIRE(result.value().RollingBytes == 442368);
242-
// Keep blocks aligned to complete X rows and provide nine fully
241+
REQUIRE(result.value().RollingBytes == 507904);
242+
// Keep blocks aligned to complete X rows and provide eight fully
243243
// associative slots for the five active Z-row blocks. This prevents the
244244
// bounded fallback from evicting every input block for each focal tuple.
245245
REQUIRE(result.value().BlockTuples == 1280);
246-
REQUIRE(result.value().CacheSlots == 9);
246+
REQUIRE(result.value().CacheSlots == 8);
247247
}
248248

249249
SECTION("slice tuple overflow reports complete context")
@@ -378,8 +378,8 @@ TEST_CASE("OrientationAnalysis::ComputeKernelAvgMisorientations: Working Set Ove
378378
constexpr uint64 k_Budget = 4096;
379379
constexpr usize k_MaxSize = std::numeric_limits<usize>::max();
380380
constexpr uint64 k_MaxBytes = std::numeric_limits<uint64>::max();
381-
constexpr uint64 k_InputBytesPerTuple = 20;
382-
constexpr uint64 k_FocalAndOutputBytesPerTuple = 8;
381+
constexpr uint64 k_InputBytesPerTuple = 24;
382+
constexpr uint64 k_FocalAndOutputBytesPerTuple = 4;
383383
constexpr uint64 k_TotalRollingBytesPerTuple = k_InputBytesPerTuple + k_FocalAndOutputBytesPerTuple;
384384

385385
constexpr bool k_CanRepresentInputByteOverflow = k_MaxSize > k_MaxBytes / k_InputBytesPerTuple;

src/Plugins/SimplnxCore/test/ComputeCoordinateThresholdTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "simplnx/Parameters/ChoicesParameter.hpp"
1515
#include "simplnx/Parameters/VectorParameter.hpp"
1616
#include "simplnx/UnitTest/UnitTestCommon.hpp"
17+
#include "simplnx/Utilities/AlgorithmDispatch.hpp"
1718

1819
#include "SimplnxCore/SimplnxCore_test_dirs.hpp"
1920

@@ -357,6 +358,10 @@ TEST_CASE("SimplnxCore::ComputeCoordinateThresholdFilter: Sphere Runtime Warning
357358

358359
TEST_CASE("SimplnxCore::ComputeCoordinateThresholdFilter: Image Geom Test - Rectangle", "[SimplnxCore][ComputeCoordinateThresholdFilter]")
359360
{
361+
const bool forceOocAlgorithm = static_cast<bool>(GENERATE(from_range(nx::core::k_ForceOocTestValues)));
362+
const nx::core::ForceOocAlgorithmGuard guard(forceOocAlgorithm);
363+
CAPTURE(forceOocAlgorithm);
364+
360365
DataStructure dataStructure;
361366

362367
ImageGeom* imageGeom = ImageGeom::Create(dataStructure, k_GeomName);

src/Plugins/SimplnxCore/test/ComputeKMedoidsTest.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "simplnx/Pipeline/Pipeline.hpp"
1010
#include "simplnx/Pipeline/PipelineFilter.hpp"
1111
#include "simplnx/UnitTest/UnitTestCommon.hpp"
12+
#include "simplnx/Utilities/AlgorithmDispatch.hpp"
1213

1314
#include "SimplnxCore/Filters/ComputeKMedoidsFilter.hpp"
1415

@@ -40,6 +41,11 @@ TEST_CASE("SimplnxCore::ComputeKMedoidsFilter: Valid Filter Execution", "[Simpln
4041
{
4142
UnitTest::LoadPlugins();
4243

44+
const bool forceOocAlgorithm = static_cast<bool>(GENERATE(from_range(nx::core::k_ForceOocTestValues)));
45+
const nx::core::ForceOocAlgorithmGuard guard(forceOocAlgorithm);
46+
CAPTURE(forceOocAlgorithm);
47+
48+
const UnitTest::PreferencesSentinel prefsSentinel(DataStorageMode::ForceOutOfCore, 1024);
4349
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "k_files_v2.tar.gz", "k_files_v2");
4450
DataStructure dataStructure = UnitTest::LoadDataStructure(fs::path(fmt::format("{}/k_files_v2/7_0_medoids_exemplar.dream3d", unit_test::k_TestFilesDir)));
4551

src/Plugins/SimplnxCore/test/ComputeLargestCrossSectionsTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "simplnx/DataStructure/Geometry/ImageGeom.hpp"
1313
#include "simplnx/Parameters/ChoicesParameter.hpp"
14+
#include "simplnx/Utilities/AlgorithmDispatch.hpp"
1415
#include "simplnx/Utilities/DataStoreUtilities.hpp"
1516

1617
#include "SimplnxCore/Filters/ComputeLargestCrossSectionsFilter.hpp"
@@ -358,6 +359,10 @@ TEST_CASE("SimplnxCore::ComputeLargestCrossSectionsFilter: Valid Filter Executio
358359
{
359360
UnitTest::LoadPlugins();
360361

362+
const bool forceOocAlgorithm = static_cast<bool>(GENERATE(from_range(nx::core::k_ForceOocTestValues)));
363+
const nx::core::ForceOocAlgorithmGuard guard(forceOocAlgorithm);
364+
CAPTURE(forceOocAlgorithm);
365+
361366
const auto plane = static_cast<ChoicesParameter::ValueType>(GENERATE(0, 1, 2));
362367
const std::array<std::array<float32, 6>, 3> expectedCrossSections = {
363368
{{0.0f, 0.625f, 0.875f, 0.0625f, 0.1875f, 1.375f}, {0.0f, 0.4375f, 1.1875f, 0.1875f, 0.125f, 1.625f}, {0.0f, 0.75f, 1.4375f, 0.1875f, 0.125f, 2.1875f}}};

src/Plugins/SimplnxCore/test/DBSCANTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "simplnx/Pipeline/Pipeline.hpp"
88
#include "simplnx/Pipeline/PipelineFilter.hpp"
99
#include "simplnx/UnitTest/UnitTestCommon.hpp"
10+
#include "simplnx/Utilities/AlgorithmDispatch.hpp"
1011

1112
#include "SimplnxCore/Filters/Algorithms/DBSCAN.hpp"
1213
#include "SimplnxCore/Filters/DBSCANFilter.hpp"
@@ -255,6 +256,10 @@ TEST_CASE("SimplnxCore::DBSCAN: 2D Test: Varied", "[SimplnxCore][DBSCAN]")
255256

256257
TEST_CASE("SimplnxCore::DBSCAN: 3D Test (LowDensityFirst)", "[SimplnxCore][DBSCAN]")
257258
{
259+
const bool forceOocAlgorithm = static_cast<bool>(GENERATE(from_range(nx::core::k_ForceOocTestValues)));
260+
const nx::core::ForceOocAlgorithmGuard guard(forceOocAlgorithm);
261+
CAPTURE(forceOocAlgorithm);
262+
258263
const nx::core::UnitTest::TestFileSentinel testDataSentinel(nx::core::unit_test::k_TestFilesDir, "dbscan_test.tar.gz", "dbscan_test");
259264
DataStructure dataStructure = UnitTest::LoadDataStructure(fs::path(fmt::format("{}/dbscan_test/7_0_3d_dbscan_test_data.dream3d", unit_test::k_TestFilesDir)));
260265

src/Plugins/SimplnxCore/test/MultiThresholdObjectsTest.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "simplnx/Pipeline/Pipeline.hpp"
77
#include "simplnx/Pipeline/PipelineFilter.hpp"
88
#include "simplnx/UnitTest/UnitTestCommon.hpp"
9+
#include "simplnx/Utilities/AlgorithmDispatch.hpp"
910

1011
#include <catch2/catch.hpp>
1112
#include <filesystem>
@@ -101,6 +102,10 @@ TEST_CASE("SimplnxCore::MultiThresholdObjects: Valid Execution", "[SimplnxCore][
101102
{
102103
UnitTest::LoadPlugins();
103104

105+
const bool forceOocAlgorithm = static_cast<bool>(GENERATE(from_range(nx::core::k_ForceOocTestValues)));
106+
const nx::core::ForceOocAlgorithmGuard guard(forceOocAlgorithm);
107+
CAPTURE(forceOocAlgorithm);
108+
104109
DataStructure dataStructure = CreateTestDataStructure();
105110

106111
SECTION("Float Array Threshold")
@@ -193,6 +198,10 @@ TEMPLATE_TEST_CASE("SimplnxCore::MultiThresholdObjects: Valid Execution - Custom
193198
{
194199
UnitTest::LoadPlugins();
195200

201+
const bool forceOocAlgorithm = static_cast<bool>(GENERATE(from_range(nx::core::k_ForceOocTestValues)));
202+
const nx::core::ForceOocAlgorithmGuard guard(forceOocAlgorithm);
203+
CAPTURE(forceOocAlgorithm);
204+
196205
MultiThresholdObjectsFilter filter;
197206
DataStructure dataStructure = CreateTestDataStructure();
198207
Arguments args;
@@ -450,6 +459,10 @@ TEST_CASE("SimplnxCore::MultiThresholdObjects: Valid Execution, DataType", "[Sim
450459
{
451460
UnitTest::LoadPlugins();
452461

462+
const bool forceOocAlgorithm = static_cast<bool>(GENERATE(from_range(nx::core::k_ForceOocTestValues)));
463+
const nx::core::ForceOocAlgorithmGuard guard(forceOocAlgorithm);
464+
CAPTURE(forceOocAlgorithm);
465+
453466
DataStructure dataStructure = CreateTestDataStructure();
454467

455468
// Signed
@@ -730,6 +743,10 @@ TEST_CASE("SimplnxCore::MultiThresholdObjects: Valid Execution, DataType", "[Sim
730743

731744
TEST_CASE("SimplnxCore::MultiThresholdObjects: Valid Execution - Multicomponent", "[SimplnxCore][MultiThresholdObjectsFilter]")
732745
{
746+
const bool forceOocAlgorithm = static_cast<bool>(GENERATE(from_range(nx::core::k_ForceOocTestValues)));
747+
const nx::core::ForceOocAlgorithmGuard guard(forceOocAlgorithm);
748+
CAPTURE(forceOocAlgorithm);
749+
733750
DataStructure dataStructure = CreateTestDataStructure();
734751

735752
MultiThresholdObjectsFilter filter;

0 commit comments

Comments
 (0)