Skip to content

Lesson 11 — Prove invariants and run deliberately ​

Where this lesson fits: the core loop works. This lesson turns "it seemed fine when I played" into a repeatable verification and launch routine.

Time: 2–3 hours

Prerequisites and outcomes ​

Complete lessons 01–10. By the end, you can select the narrowest relevant test, run the solution and smoke checks, and tell a build problem from a runtime problem.

Prepare and run ​

  1. Reuse the tutorial chapter 08 project prepared in lesson 10. Read tutorial chapter 09; it adds no files and shares chapter 08's build.

  2. From your learner project's solution folder, run:

    powershell
    dotnet test --filter FullyQualifiedName~LearningPlan3CaptureTests
    dotnet build
    dotnet test
    dotnet run --project Platforms\DesktopVK -- --smoke-test-seconds 2
  3. Confirm the focused filter discovers both tests from lesson 07. The total dotnet test count will be two higher than the unmodified snapshot if you kept those tests.

  4. For a repository-maintenance link check, open a separate terminal at the course repository root, then run:

    powershell
    python scripts\check_doc_links.py

    The checker covers tracked Markdown, not untracked LP3 files.

  5. Optional contributor operation: .\scripts\TestChapterProjects.ps1, run from the repository root, first regenerates chapter snapshots and then builds, tests, and smoke-runs them. It writes generated repository files and can take a long time. Do not run it if you have snapshot changes you need to keep; back up work and read getting started first.

Guided operations ​

  1. In Tests\Systems\LearningPlan3CaptureTests.cs, temporarily change the expected region size from 10 to 11. Run dotnet test --filter FullyQualifiedName~MultipleEnemyFreeRegions_ChooseTheSmallest and observe the failure. Restore 10, rerun the same command, and identify the region-selection operation.
  2. Run a focused system suite before the full solution suite.
  3. Build, run the bounded smoke check, and inspect exit status separately. A successful build alone does not prove a graphical host starts.
  4. In the course repository, open scripts\chapter-manifest.json and scripts\generate_chapters.py. Generated source is not edited by hand.
  5. Run the Markdown link check after documentation edits.

Checkpoint ​

Record the exact command, pass/fail result, and invariant checked. Demonstrate that a failure can be reproduced without relying on an unspecified manual sequence.

Common mistakes ​

  • Running only the full test suite and losing the fast feedback of a focused test.
  • Treating a compile pass as proof that the game window can launch.
  • Editing generated snapshot files instead of their source or manifest and regenerating.

Questions and extension ​

Which critical app-level operations currently have fewer automated checks than pure systems? Propose one behavior-focused test for death/respawn, pause flow, or level completion.