Tidy-up redesign unit test
Issue/feature addressed
Tidy-up redesign unit test. The operator-specific should be encapsulated in function to avoid code duplication. This MR simplifies and standardises the specification of unit tests to simplify future code development.
Proposed solution
With the proposed approach, unit test can be specified as follow
#define TEST_HELMSOLVE(test_name, test, tol) \
BOOST_FIXTURE_TEST_CASE(test_name, test) \
{ \
using ExecSpace = NektarSpaces::CUDA; \
using Impl = Operators::SumFac; \
Configure(); \
SetTestCase(); \
RunTestCase<ExecSpace, Impl>(); \
boost::test_tools::output_test_stream output; \
{ \
BOOST_TEST(Compare(tol)); \
} \
}
With the operator specific member RunTestCase() function defined as such:
template <typename ExecSpace, typename Impl> void RunTestCase()
{
auto HelmSolveOp =
HelmSolve<>::template create<ExecSpace, Impl>(fixt_explist);
auto DiagPreconOp =
DiagPrecon<>::template create<ExecSpace, Impl>(fixt_explist);
HelmSolveOp->setPrecon(DiagPreconOp);
HelmSolveOp->setLambda(1.0);
HelmSolveOp->apply(*fixt_in, *fixt_out);
}
Implementation
Tests
Suggested reviewers
Please suggest any people who would be appropriate to review your code.
Notes
Please add any other information that could be useful for reviewers.
Checklist
-
Functions and classes, or changes to them, are documented. [ ] User guide/documentation is updated.[ ] Changelog is updated.-
Suitable tests added for new functionality. -
Contributed code is correctly formatted. (See the contributing guidelines). -
License added to any new files. -
No extraneous files have been added (e.g. compiler output or test data files).
Edited by Jacques Xing