Testing
AuraScore 79/100

Scientific Computing Property-Based Test Harness Generator

Generate a property-based test script to verify numerical stability and mathematical invariants across floating-point boundaries.

Use this template when validating mathematical functions, scientific algorithms, or numerical libraries against precision limits and edge cases. It provides a production-grade test harness using property-based testing and ULP assertions.

Template

Role: Principal Research Software Engineer specializing in Numerical Stability and Scientific Computing.

Context

  • Target mathematical function: {{target_math_function}}
  • Invariants and algebraic properties: {{mathematical_invariants}}
  • Floating-point precision target: {{floating_point_precision}}
  • Testing framework and language: {{framework_language}}
  • Edge-case domains and boundaries: {{edge_case_domains}}
  • Failure tolerance threshold: {{failure_tolerance_threshold}}

Task

Develop an end-to-end property-based testing script that rigorously verifies mathematical invariants, edge-case handling, and numerical precision stability across extreme dynamic ranges for scientific research synthesis algorithms.

Method

  1. Parse {{target_math_function}} against the formal mathematical invariants defined in {{mathematical_invariants}}.
  2. Define parameter sampling strategies in {{framework_language}} to cover {{edge_case_domains}}, including denormalized numbers, infinities, and NaN boundaries.
  3. Formulate metamorphic relations and invariant properties as parameterized test assertions.
  4. Implement numerical stability assertion checks enforcing {{floating_point_precision}} limits with ULP (Unit in the Last Place) comparison logic.
  5. Structure shrinkers and custom generators to isolate the minimal failing inputs when invariants break.
  6. Inject bounded perturbation tests to evaluate error propagation under {{failure_tolerance_threshold}}.
  7. Embed automated report logging capturing failure distributions, seed reproducibility, and floating-point condition numbers.

Constraints

  • Generated code MUST compile and run directly within {{framework_language}} without placeholder implementations.
  • Numerical comparisons MUST NOT rely on raw equality (==) for floating-point calculations; explicit epsilon or ULP bounds are mandatory.
  • Include explicit setup fixtures, parameterized strategy generators, and tear-down harnesses.
  • Inline documentation MUST explain the mathematical rationale behind every property assertion.

Output format

Provide a single executable test script organized into:

  1. Strategy and Custom Generator Definitions
  2. Precision Comparator Utility Functions
  3. Parametric Property Assertion Test Cases (minimum 4 distinct property tests)
  4. Execution Harness with Reproducible Seed Configuration

Self-review

  • Ensure all properties in {{mathematical_invariants}} map to distinct test functions.
  • Verify that {{floating_point_precision}} bounds use correct tolerance tolerances.
  • Confirm no mock imports or pseudo-code exist in the script.
AuraScore breakdown
79/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering10/12 · Adequate

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-testing
complex-reasoning-analysis-math
numerical-analysis
property-testing
scientific-computing