Summary
tests/MooseTargetTest.cpp is purely textual ("does this string appear in the emitted source?"). The compile-check driver only exercises StandaloneCxxTarget. There is no test that:
- Constructs a MOOSE-like buffer.
- Runs the generated MOOSE-target compute function through it.
- Verifies the arithmetic.
Result: the entire cluster of bugs in issues #6 (arg-order), #7 (dim drift), #9 (layout) are undetectable in CI.
Fix
Add tests/moose_mock/ containing a minimal stand-in:
struct RankTwoTensor { double _coords[3][3]; double const* dataPointer() const { return &_coords[0][0]; } /* + non-const */ };
struct RankFourTensor { double _data[81]; /* + dataPointer() */ };
struct MaterialProperty<T> { std::vector<T> _vals; T const& operator[](size_t qp) const { return _vals[qp]; } /* + non-const */ };
- Just enough surface for
_qp, MaterialProperty<T>::operator[], dataPointer().
Then:
- Build a
ConstitutiveModel (e.g. linear elasticity).
- Generate the MOOSE
.h + .C via MooseMaterialTarget.
- Compile and link them against the mock headers.
- Drive a few QP evaluations and assert the computed stresses match an analytic reference.
This catches arg-order, dim, and layout regressions in one test.
Refs
Summary
tests/MooseTargetTest.cppis purely textual ("does this string appear in the emitted source?"). The compile-check driver only exercisesStandaloneCxxTarget. There is no test that:Result: the entire cluster of bugs in issues #6 (arg-order), #7 (dim drift), #9 (layout) are undetectable in CI.
Fix
Add
tests/moose_mock/containing a minimal stand-in:struct RankTwoTensor { double _coords[3][3]; double const* dataPointer() const { return &_coords[0][0]; } /* + non-const */ };struct RankFourTensor { double _data[81]; /* + dataPointer() */ };struct MaterialProperty<T> { std::vector<T> _vals; T const& operator[](size_t qp) const { return _vals[qp]; } /* + non-const */ };_qp,MaterialProperty<T>::operator[],dataPointer().Then:
ConstitutiveModel(e.g. linear elasticity)..h+.CviaMooseMaterialTarget.This catches arg-order, dim, and layout regressions in one test.
Refs
add_*calls #9 landing first (otherwise this test would currently fail for the wrong reasons)