Move all gtests out of MRMesh into MRTest; drop MRMesh's GTest dependency#6171
Merged
Conversation
Relocate 71 of the remaining 72 TEST(MRMesh, ...) cases from 41 files in source/MRMesh into source/MRTest, continuing the work of #6132 and #6145. - 39 mixed files: tests extracted into source/MRTest/<Name>Tests.cpp, wrapped in namespace MR with <MRMesh/...> includes; MRGTest.h and other test-only includes dropped from the sources. - 2 test-only files moved wholesale (git mv) and removed from MRMesh.vcxproj/.filters: MRMeshBuildDeleteTest.cpp, MRDistanceMapTests.cpp. - MRTest.vcxproj/.filters updated; CMake auto-discovers new files via GLOB. TEST(MRMesh, SurfaceDistance) stays in MRMesh: it calls the file-static helper getFieldAtC (shared with production code), which is not exported from the shared MRMesh library, so moving it would require an API change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…rces Relocate the "// verifies that template can be instantiated with typical parameters" explicit instantiations into the MRTest project: - AffineXf<Vector2<...>> / AffineXf<Vector3<...>> into MRAffineXf2Tests.cpp and MRAffineXf3Tests.cpp - BestFitParabola<float|double> into MRBestFitParabolaTests.cpp - QuadraticForm<Vector2|3<...>> into a new MRQuadraticFormTests.cpp (MRQuadraticForm.cpp keeps its MRMESH_API sum/sumAt instantiations, which are real exported symbols). These instantiations are header-only compile checks (no MRMESH_API), so nothing links against them; the check is now performed by the MRTest build. Remove the MRMesh .cpp files left with no code after the test and instantiation moves, and drop their MRMesh.vcxproj/.filters entries: MRAABBTreePolyline2, MRAABBTreePolyline3, MRAffineXf2, MRAffineXf3, MRBestFitParabola, MRFinally, MRId, MRIntersection, MRLine3, MRTupleBindings, MRViewportId. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Now that getFieldAtC is exported (MRMESH_API), the last remaining gtest in MRMesh moves into source/MRTest/MRSurfaceDistanceBuilderTests.cpp. Drop the test and the now-unused MRGTest.h include from MRSurfaceDistanceBuilder.cpp. MRMesh no longer contains any gtest cases. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MRGTest.h is a gtest wrapper used only by tests, which now all live in
MRTest. Move source/MRMesh/MRGTest.h to source/MRTest/MRGTest.h and switch
its "config.h" include to <MRMesh/config.h> so it resolves from the new
location.
Update every MRTest .cpp to include the header locally ("MRGTest.h" instead
of <MRMesh/MRGTest.h>), and drop the now-stale MRGTest.h includes from the
MRMesh files that no longer use it (MRAABBTreePolyline, MRBestFit, MRBitSet,
MRCylinderObject). Remove its MRMesh.vcxproj/.filters entries.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add MRGTest.h as a ClInclude to MRTest.vcxproj and MRTest.vcxproj.filters (the move in the previous commit updated only the MRMesh project files). - Remove the now-dead `find_package(GTest)` + `GTest::gtest` link from MRMesh/CMakeLists.txt, since MRMesh no longer contains any gtest code. The MRMESH_NO_GTEST option is kept: it still feeds config_cmake.h.in (the macro read by MRGTest.h), MRMeshConfig.cmake.in, and MRPch/CMakeLists.txt. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Grantim
approved these changes
May 27, 2026
oitel
reviewed
May 27, 2026
Contributor
There was a problem hiding this comment.
Consider removing find_dependency(GTest) from MRMeshConfig.cmake.in as well.
Contributor
There was a problem hiding this comment.
This header is not required anymore, remove it and replace all its usages with <gtest/gtest.h>.
Per review feedback: - MRGTest.h is no longer needed now that all gtests live in MRTest (which always links GTest). Remove source/MRTest/MRGTest.h and replace every usage with <gtest/gtest.h>; drop its MRTest.vcxproj/.filters entry. - Remove the now-stale find_dependency(GTest) block from MRMeshConfig.cmake.in (MRMesh no longer depends on GTest). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
oitel
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes all GoogleTest code from the
MRMeshlibrary and consolidates it in theMRTestproject. After this PR,MRMeshcontains noTEST(...)cases, no test-only headers, and no dependency on GTest.Continues the ongoing effort started in #6132 (MeshBoolean) and #6145 (FixSelfIntersections).
Tests moved out of MRMesh
All remaining
TEST(MRMesh, …)cases (plus a few other suites such asTEST(MRFinally, …)) move fromsource/MRMesh/intosource/MRTest/:source/MRTest/<Name>Tests.cpp, wrapped innamespace MR, with<MRMesh/…>angle-bracket includes; test-only includes are dropped from the source.git mv(history preserved):MRMeshBuildDeleteTest.cpp,MRDistanceMapTests.cpp.TEST(MRMesh, SurfaceDistance)→MRSurfaceDistanceBuilderTests.cpp, enabled by exportinggetFieldAtC(MRMESH_API) so the test can reach it across the shared-library boundary.Template-instantiation compile-checks moved out
The
// verifies that template can be instantiated with typical parametersexplicit instantiations move intoMRTest(they carry noMRMESH_API, so nothing links against them; the check is now done by theMRTestbuild):AffineXf<Vector2<…>>/AffineXf<Vector3<…>>→MRAffineXf2Tests.cpp/MRAffineXf3Tests.cppBestFitParabola<float|double>→MRBestFitParabolaTests.cppQuadraticForm<Vector2|3<…>>→ newMRQuadraticFormTests.cpp(MRQuadraticForm.cppkeeps itsMRMESH_APIsum/sumAtinstantiations — those are genuine exported symbols)MRGTest.h removed
MRGTest.h(a gtest wrapper that stubbed the macros when GTest was unavailable) is no longer needed now that all tests live inMRTest, which always links GTest.source/MRMesh/MRGTest.his deleted and every usage is replaced with<gtest/gtest.h>. The staleMRGTest.hincludes are also dropped from the four MRMesh files that no longer used it (MRAABBTreePolyline,MRBestFit,MRBitSet,MRCylinderObject).Cleanup
MRMesh.cppfiles left after the moves are removed:MRAABBTreePolyline2,MRAABBTreePolyline3,MRAffineXf2,MRAffineXf3,MRBestFitParabola,MRFinally,MRId,MRIntersection,MRLine3,MRTupleBindings,MRViewportId.find_package(GTest)+GTest::gtestlink is removed fromMRMesh/CMakeLists.txt, and thefind_dependency(GTest)block fromMRMeshConfig.cmake.in.MRMesh.vcxproj/.filtersandMRTest.vcxproj/.filtersupdated accordingly. CMake discovers sources viafile(GLOB …).Notes / non-obvious bits
getNormalizedRadiusByAngle/cBaseHeight→MRConeObjectTests.cpp, andtriangleSolidAngle→MRDipoleTests.cpp.MRMESH_NO_GTESToption is kept inMRMesh/CMakeLists.txt: the CMake variable still gates GTest precompiled-header reuse inMRPch/CMakeLists.txt.Test plan
MRTestbuilds and runs all relocated cases on every platform (incl. Emscripten and the MSVC.vcxprojbuild)MRMeshbuilds with no gtest cases, noMRGTest.h, and no GTest dependency