Skip to content

Conversation

cc-a
Copy link
Contributor

@cc-a cc-a commented Aug 28, 2024

This PR is in draft as I wouldn't recommended merging as is but I wanted to circulate to the group before going any further down this road.

This PR provides a quick and dirty adoption of the pFUnit framework and its application to a couple of trivial test cases.

See unit_tests/README.md for instructions on how to build and run the tests.

The test cases are provided in unit_tests/test_simple.pf. The pf suffix indicates that these files are fortran with the addition of pre-processor directives provided by pFUnit. The pre-processing is taken care of by the changes made to CMakeLists.txt and run as part of the standard build process for the code base (just for purposes of this demo).

The preprocessor directives make it possible to write tests with minimal boiler plate. There are two tests; the first is a trivial demonstration of some of the assert preprocessor directives, whilst the second demonstrates testing a function from uDALES.

Copy link
Contributor

@dc2917 dc2917 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of initial thoughts:

  1. Is it worth adding something like:
...
option(UDALES_TESTS "Build with tests" OFF)
...
if(UDALES_TESTS)
    find_package(
        PFUNIT ...
    )
endif()
etc.

as presumably not everyone who builds uDALES will be running/writing unit tests? i.e. developers can pass -DUDALES_TESTS=ON to cmake

  1. As uDALES is making use of git submodules, should pfunit be pulled in that way?

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