Skip to content

Add negative-path test coverage for intentional guard throws (#11) - #122

Open
petlenz wants to merge 2 commits into
mainfrom
fix-11-negative-path-tests
Open

Add negative-path test coverage for intentional guard throws (#11)#122
petlenz wants to merge 2 commits into
mainfrom
fix-11-negative-path-tests

Conversation

@petlenz

@petlenz petlenz commented Jul 27, 2026

Copy link
Copy Markdown
Member

Fixes #11.

Every intentional error path could silently regress with no test failing. This adds tests/NegativePathTest.cpp, exercising the guards reachable through the public recipe / target API:

  • SymbolValidationPass: output references an undeclared symbol; declared name is not a C++ identifier.
  • MooseMaterialTarget: stateful input (roles::History); evolution equations without enable_local_newton; more than one consistent tangent; output named Jacobian_mult alongside a tangent; tensor rank ∉ {2, 4}.
  • Duplicate add (symbol / output) and symbol↔output name clashes.

Each test asserts both the throw and a substring identifying the offending symbol/op, and was checked to pin the intended throw (not an incidental earlier one).

The originally-listed NUMSIM_CODEGEN_TENSOR_STUB / tensor_inner_product_to_scalar rows are documented as retired/unreachable (all Phase-A tensor stubs have landed; the surviving t2s stub has no recipe-level path — :/dot maps to the implemented tensor_dot). The stateful-output guard is unit-tested in its own PR (#15, MooseTargetTest.cpp), so this suite has no dependency on that change.

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.

Negative-path test coverage: validate(), History throw, all tensor stubs, duplicate-add

1 participant