ENH: Convert 4 Common CTests to GoogleTest#6071
ENH: Convert 4 Common CTests to GoogleTest#6071hjmjohnson wants to merge 5 commits intoInsightSoftwareConsortium:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Modules/Core/Common/test/CMakeLists.txt | Removes four legacy CTest source files and their itk_add_test entries; adds four new GTest sources to the GTest driver target. Plumbing is consistent with the rest of the file. |
| Modules/Core/Common/test/itkCompensatedSummationGTest.cxx | Faithful rename + conversion: EXIT_FAILURE guards replaced by EXPECT_* macros; original two-condition check (`vanillaError <= accumulatorError |
| Modules/Core/Common/test/itkPriorityQueueGTest.cxx | Faithful rename + conversion; min-queue and max-queue loop invariants preserved; sequence is not mutated by the min-queue pass so the max-queue sequence.back() / sequence.size() checks remain valid. |
| Modules/Core/Common/test/itkRealTimeIntervalGTest.cxx | New GTest file with 5 well-scoped test cases; all original CHECK_FOR_VALUE / CHECK_FOR_BOOLEAN paths accounted for; minor: identical CheckForValue helper also lives in itkRealTimeStampGTest.cxx. |
| Modules/Core/Common/test/itkRealTimeStampGTest.cxx | New GTest file with 6 test cases; both ITK_TRY_EXPECT_EXCEPTION sites mapped correctly; ComparisonOperators test is labelled RealTimeStamp but exercises only RealTimeInterval objects (inherited issue, noted as P2). |
| Modules/Core/Common/test/itkRealTimeIntervalTest.cxx | Deleted — content migrated to itkRealTimeIntervalGTest.cxx; no residual references remain. |
| Modules/Core/Common/test/itkRealTimeStampTest.cxx | Deleted — content migrated to itkRealTimeStampGTest.cxx; no residual references remain. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Before["Before (legacy CTest)"]
A1[itkCompensatedSummationTest.cxx] --> D1[ITKCommon2TestDriver]
A2[itkPriorityQueueTest.cxx] --> D2[ITKCommon1TestDriver]
A3[itkRealTimeIntervalTest.cxx] --> D2
A4[itkRealTimeStampTest.cxx] --> D2
end
subgraph After["After (GoogleTest)"]
B1[itkCompensatedSummationGTest.cxx] --> G[ITKCommonGTestDriver]
B2[itkPriorityQueueGTest.cxx] --> G
B3[itkRealTimeIntervalGTest.cxx] --> G
B4[itkRealTimeStampGTest.cxx] --> G
end
G --> T1[RealTimeInterval: 5 TEST blocks]
G --> T2[RealTimeStamp: 6 TEST blocks]
G --> T3[CompensatedSummation: 1 TEST block]
G --> T4[PriorityQueue: 1 TEST block]
Comments Outside Diff (2)
-
Modules/Core/Common/test/itkRealTimeStampGTest.cxx, line 731-766 (link)Test suite name vs. tested type mismatch
TEST(RealTimeStamp, ComparisonOperators)only constructs and comparesitk::RealTimeIntervalobjects (t1,t2,t3), so the GoogleTest output will label this as aRealTimeStamptest even though it never exercises anyRealTimeStampcomparison operators. This is inherited from the original monolithic test, but the mechanical split into named GTest blocks is a good opportunity to either rename this toTEST(RealTimeInterval, ComparisonOperators)or replacet1/t2/t3with actualitk::RealTimeStampobjects to match the suite name. -
Modules/Core/Common/test/itkRealTimeIntervalGTest.cxx, line 304-313 (link)Duplicated
CheckForValuehelperThe same
CheckForValuefunction (including theITK_GCC_PRAGMA_PUSH/ITK_GCC_SUPPRESS_Wfloat_equalblock) is copy-pasted verbatim into bothitkRealTimeIntervalGTest.cxxanditkRealTimeStampGTest.cxx. If the tolerance logic ever needs to change, both files must be updated in sync. Extracting this into a small shared test-utility header (e.g.itkGTestUtilities.h) would keep it DRY. This is a minor concern since anonymous-namespace placement prevents ODR issues, but worth noting for future maintainability.
Reviews (1): Last reviewed commit: "ENH: Convert itkRealTimeStampTest to GTe..." | Re-trigger Greptile
Mechanical conversion of 4 no-argument CTests in
Modules/Core/Common/test/to GoogleTest format: CompensatedSummation, PriorityQueue, RealTimeInterval, RealTimeStamp.Conversion details
return EXIT_FAILUREpath mapped to a correspondingEXPECT_*assertionCHECK_FOR_VALUE/CHECK_FOR_BOOLEANmacros replaced withEXPECT_LE/EXPECT_TRUE/EXPECT_FALSEITK_TRY_EXPECT_EXCEPTIONreplaced withEXPECT_THROW(..., itk::ExceptionObject)git log --followhistory trackingLocal verification