Skip to content

add googletest harness and update CI#93

Open
gknapp1 wants to merge 10 commits into
ORNL:candidate-v2.0.0from
gknapp1:test-harness
Open

add googletest harness and update CI#93
gknapp1 wants to merge 10 commits into
ORNL:candidate-v2.0.0from
gknapp1:test-harness

Conversation

@gknapp1
Copy link
Copy Markdown
Collaborator

@gknapp1 gknapp1 commented May 8, 2026

While we had an integration/smoke test in the CI by running the tutorial case, there are no unit tests for AdditiveFOAM. This adds a doctest framework for unit test.

I chose doctest because it is lightweight enough to not add much of a burden on compiling and can be compiled easily with wmake. This does mean that AdditiveFOAM would vendor (i.e., distribute) the doctest header and associated MIT License file to be compatible with the doctest license, which is common practice.

After further consideration, GoogleTest (gtest) was fairly easy to integrate and doesn't require a great deal of overhead in terms of installing for developers without vendoring it. While I don't think vendoring an MIT license code (doctest) is a bad thing, avoiding it does sidestep any licensing questions down the line.

New features:

  • GoogleTest (gtest) initial framework to provide a place to add unit tests
  • basic unit tests focused largely on the heat source and moving beam functionality
  • update CI to use a OpenFOAM-13 container (third-party, since openfoam.org does not distribute an official OpenFOAM-13 container)
  • update CI to include building and running the unit tests

Minor change to solver source code:

  • Change Foam::string.replace call to Foam::string.replaceAll in graph utility to have expected behavior on string normalization

AI usage statement: AIA Human-AI blend, Content edits, Human-initiated, Reviewed, GPT 5.4 v1.0

@gknapp1 gknapp1 self-assigned this May 8, 2026
@gknapp1 gknapp1 marked this pull request as ready for review May 11, 2026 15:36
@gknapp1 gknapp1 requested review from colemanjs and streeve May 11, 2026 15:38
@gknapp1
Copy link
Copy Markdown
Collaborator Author

gknapp1 commented May 11, 2026

Reviewer requests

@colemanjs: Can you review to check that these tests make sense to you? I think they cover the basic intended behavior of the scan path logic (at least how it is in v1.* releases). I can also add in coverage here if there are glaring holes.

@streeve: Does doctest integration seem like a good option here? I know gtest is also popular (used in Kokkos, for example), but seems a bit heavy for the kind of testing that we need.

@streeve
Copy link
Copy Markdown
Collaborator

streeve commented May 11, 2026

Does doctest integration seem like a good option here? I know gtest is also popular (used in Kokkos, for example), but seems a bit heavy for the kind of testing that we need.

I agree with you; doctest seems to make more sense here. What about https://github.com/FoamScience/foamUT (just a quick search, no idea about it) ?

I try very hard to avoid embedding external code. But I understand why you want to do it here

@gknapp1
Copy link
Copy Markdown
Collaborator Author

gknapp1 commented May 18, 2026

Does doctest integration seem like a good option here? I know gtest is also popular (used in Kokkos, for example), but seems a bit heavy for the kind of testing that we need.

I agree with you; doctest seems to make more sense here. What about https://github.com/FoamScience/foamUT (just a quick search, no idea about it) ?

I try very hard to avoid embedding external code. But I understand why you want to do it here

After looking into GoogleTest implementation a little more, honestly it wasn't much more work to implement it and include some brief instructions for installing it. The syntax is pretty much identical to doctest, with some minor vocabulary swaps. Current version of the PR is now with gtest--agree that it is probably better to not have to worry about vendoring.

@gknapp1 gknapp1 changed the title add doctest harness and update CI add googletest harness and update CI May 19, 2026
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.

2 participants