Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add google test for unittests #360

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bugrahantemur
Copy link
Contributor

With this PR, I'd like to introduce Googletest for writing unit tests in ExaDG.

The discussion on whether Googletest is desired is planned to take place in #359. This PR should be an example of what it may look like if we do.

To make the case for Googletest, I have written two test suites with it.

  1. An exact transfer of the test cases for Elementwise::SolverGMRES which we already had. Aside from reducing the number of lines, especially duplicated lines, I found that the tests would also run considerably faster with the new framework. The time required for this test suite dropped from about 17 seconds to no more than 10 seconds on my local machine.

  2. A typed-test suite for the newly implemented generalized VariableCoefficients class (Generalize variable coefficients to arbitrary types #353). A typed-test in this context means that multiple tests are created automatically for templated types. In this case, I tested VariableCoefficients with three different coefficient types.

Part of #359
Follows #353

- Introduce new template parameter `coefficient_t` to `VariableCoefficients` (and to the related `VariableCoefficientsCell`) in order to hold arbitrary coefficient types (like tensors of different ranks). (Closes exadg#289)
- Extend the interface to get the `quad_index` alongside a `MatrixFree` object to correctly obtain the number of quadrature points that are needed. Previous calculation of the number of q points falsely relied on the polynomial degree. (Closes exadg#128)

Also:
- Refactor two separate methods `reinit` and `fill` out of the `initialize` method.
- Remove the propagated n_q_points_1d variable in the structure module, which is not needed anymore.
- Pass in the quad_index into the viscous kernel initializer as it is needed to get the correct quadrature formula.
Add Googletest dependency for unit test development (Part of exadg#359).

- Add a unit test suite for VariableCoefficients
- Rewrite the existing ElementwiseGMRES test with Googletest (keep the old one as well)
@nfehn nfehn added the testing Issue or pull request related to tests. label Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Issue or pull request related to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants