Skip to content

Conversation

Copy link

Copilot AI commented Nov 4, 2025

GoogleTest fails to compile on recent clang versions and is years out of date. Migrated to doctest, a modern single-header testing library with no external dependencies.

Changes

  • Replaced GoogleTest with doctest (v2.4.12)

    • Removed UnitTest/GoogleTest/ directory (~30K lines)
    • Added UnitTest/doctest.h and doctest_main.cc
    • Updated UnitTestBase to include doctest instead of gtest
  • Converted test macros

    • TEST(Suite, Name)TEST_CASE("Suite - Name")
    • TEST_F(Fixture, Name)TEST_CASE_FIXTURE(Fixture, "Fixture - Name")
    • Added macro compatibility layer in UnitTest.h for EXPECT_*/ASSERT_*CHECK/REQUIRE
  • Updated test fixtures

    • Converted SetUp() → constructors, TearDown() → destructors
    • Removed override keywords and ::testing::Test base class
    • Affected: TimeoutTest, KEMFieldTest, KGeoBagShapeTest, and capacitance test fixtures
  • Documentation updates

    • Updated README.md and CMakeLists.txt to reference doctest

Test Status

All existing unit tests pass except 2 pre-existing failures in IntegratorsTest (unrelated to migration):

  • Kommon: 13/13 (89 assertions)
  • KGeoBag: 13/13 (101 assertions)
  • Kasper: 59/61 (306 assertions)

Example

Before:

TEST_F(KEMFieldCubeTest, Capacitance_GaussAnalytic) {
    // test body
}

After:

TEST_CASE_FIXTURE(KEMFieldCubeTest, "KEMFieldCubeTest - Capacitance_GaussAnalytic") {
    // test body
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Use doctest instead of GoogleTest</issue_title>
<issue_description>GoogleTest fails to compile on recent clang versions (see #85 ). GoogleTest currently considers to add a new dependency to the central Google base library "abseil" ( google/googletest#2883 ). Since our fork of GoogleTest is many years out of date and integrating a new version would be a significant effort anyways, it seems reasonable to move to the dependency-less single-header testing library doctest:
https://github.com/doctest/doctest</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits November 4, 2025 10:42
Co-authored-by: 2xB <31772910+2xB@users.noreply.github.com>
Co-authored-by: 2xB <31772910+2xB@users.noreply.github.com>
Co-authored-by: 2xB <31772910+2xB@users.noreply.github.com>
Co-authored-by: 2xB <31772910+2xB@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace GoogleTest with doctest for unit testing Replace GoogleTest with doctest for unit testing Nov 4, 2025
Copilot AI requested a review from 2xB November 4, 2025 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use doctest instead of GoogleTest

2 participants