Skip to content

Commit 9b11936

Browse files
authored
Merge pull request InsightSoftwareConsortium#5903 from hjmjohnson/convert-itkthreadedimageregionpartitionertest-to-gtest
ENH: Convert itkThreadedImageRegionPartitionerTest to GTest
2 parents 134937b + 60a842a commit 9b11936

2 files changed

Lines changed: 8 additions & 23 deletions

File tree

Modules/Core/Common/test/CMakeLists.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ set(
8383
itkThreadedIteratorRangePartitionerTest.cxx
8484
itkThreadedIteratorRangePartitionerTest2.cxx
8585
itkThreadedIteratorRangePartitionerTest3.cxx
86-
itkThreadedImageRegionPartitionerTest.cxx
8786
itkThreadLoggerTest.cxx
8887
itkLoggerThreadWrapperTest.cxx
8988
itkThreadDefsTest.cxx
@@ -237,12 +236,6 @@ itk_add_test(
237236
ITKCommon1TestDriver
238237
itkImageAdaptorPipeLineTest
239238
)
240-
itk_add_test(
241-
NAME itkThreadedImageRegionPartitionerTest
242-
COMMAND
243-
ITKCommon2TestDriver
244-
itkThreadedImageRegionPartitionerTest
245-
)
246239
itk_add_test(
247240
NAME itkCovariantVectorGeometryTest
248241
COMMAND
@@ -1669,6 +1662,7 @@ set(
16691662
itkFloodFillIteratorGTest.cxx
16701663
itkDerivativeOperatorGTest.cxx
16711664
itkFloodFilledSpatialFunctionGTest.cxx
1665+
itkThreadedImageRegionPartitionerGTest.cxx
16721666
)
16731667
creategoogletestdriver(ITKCommon "${ITKCommon-Test_LIBRARIES}" "${ITKCommonGTests}")
16741668
# If `-static` was passed to CMAKE_EXE_LINKER_FLAGS, compilation fails. No need to

Modules/Core/Common/test/itkThreadedImageRegionPartitionerTest.cxx renamed to Modules/Core/Common/test/itkThreadedImageRegionPartitionerGTest.cxx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,20 @@
1616
*
1717
*=========================================================================*/
1818
#include "itkThreadedImageRegionPartitioner.h"
19-
#include "itkTestingMacros.h"
19+
#include "itkGTest.h"
2020

21-
/*
22-
* Main test entry function
23-
*/
24-
int
25-
itkThreadedImageRegionPartitionerTest(int, char *[])
21+
#include <vector>
22+
23+
24+
TEST(ThreadedImageRegionPartitioner, PartitionDomain)
2625
{
2726
constexpr unsigned int Dimension{ 2 };
2827

2928
using ThreadedImageRegionPartitionerType = itk::ThreadedImageRegionPartitioner<Dimension>;
3029
const ThreadedImageRegionPartitionerType::Pointer threadedImageRegionPartitioner =
3130
ThreadedImageRegionPartitionerType::New();
3231

33-
ITK_EXERCISE_BASIC_OBJECT_METHODS(
32+
ITK_GTEST_EXERCISE_BASIC_OBJECT_METHODS(
3433
threadedImageRegionPartitioner, ThreadedImageRegionPartitioner, ThreadedDomainPartitioner);
3534

3635

@@ -71,14 +70,6 @@ itkThreadedImageRegionPartitionerTest(int, char *[])
7170
{
7271
threadedImageRegionPartitioner->PartitionDomain(i, totalThreads, completeRegion, subRegion);
7372
std::cout << "The resulting subregion for thread: " << i << " is : " << subRegion << std::endl;
74-
75-
if (expectedSubRegions[i] != subRegion)
76-
{
77-
std::cerr << "The calculated sub-region, " << subRegion
78-
<< " did not match the expected region: " << expectedSubRegions[i] << std::endl;
79-
return EXIT_FAILURE;
80-
}
73+
EXPECT_EQ(subRegion, expectedSubRegions[i]) << "Mismatch at thread " << i;
8174
}
82-
83-
return EXIT_SUCCESS;
8475
}

0 commit comments

Comments
 (0)