From 3e388d178b1cfbac5e77ec9c2bad94183e19f71b Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Sun, 24 May 2026 18:04:46 -0400 Subject: [PATCH] clarify SCENARIO/SECTION guidance: shared fixture, distinct paths, fewer SECTIONs --- continue.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/continue.md b/continue.md index bad57b5..f98fc33 100644 --- a/continue.md +++ b/continue.md @@ -5,8 +5,9 @@ ### 1. Structure - One `SCENARIO("description")` per logical test group, with `[tag1][tag2]` annotations - Run `./build/orbit_test --list-tags` to see tags used by other tests. Original tags from the old test file are a useful starting point, but the implementor has discretion to choose appropriate tags. -- **Use SCENARIO to share setup/teardown across multiple SECTIONs.** Catch2 re-initializes the fixture before each SECTION, so declare shared constants, structs, and variables in the SCENARIO body (between the opening `{` and the first `SECTION`). These persist across all SECTIONs within the SCENARIO. -- Example: a `SimulationState* sim` created once in the SCENARIO body, then each SECTION mutates and tests it independently. +- **Use SCENARIO as a shared fixture** for setup/initialization. SECTIONs represent **different test scenarios** that branch from that fixture with distinct operations. Avoid using SECTIONs as section headers to group assertions about the same result — group related assertions into fewer SECTIONs instead. +- Catch2 re-initializes the fixture before each SECTION, so shared constants, structs, and variables declared in the SCENARIO body run fresh per SECTION. This is intentional: each SECTION should test a different code path or mutation of the fixture. +- Example: one SECTION checks the initial state before modification; a separate SECTION applies a burn and checks all post-burn results. - Embed expected values directly in `WithinAbs()` calls (see Section 4 for precalc script usage). No need to declare named constants unless the value is reused. - **No decorative comments.** Do not add `// (Old: ...)` comments, `===` separators, `---` separators, or any other decorative annotations. The SECTION description string is the documentation. - **Use `REQUIRE()` for integer comparisons**, `WithinAbs()` only for floating-point. E.g., `REQUIRE(sim->body_count == 2)` not `REQUIRE_THAT(sim->body_count, WithinAbs(2.0, 0.001))`.