diablo2-web/TEST_INFRA.md

3.3 KiB
Raw Blame History

E2E Test Infra: Wilderness Map Generation Parity (Issue #455)

Test Philosophy

  • Opaque-box, requirement-driven. Derived from D2MOO v1.13c ground truth binary (d2moo_mapgen) and user requirements R1–R6.
  • Methodology: Category-Partition + Boundary Value Analysis + Benchmark Seed Workload Testing across outdoor levels (Level 2 Blood Moor, Level 3 Cold Plains, Level 4 Stony Field).

Feature Inventory & Test Coverage Goals

# Feature Requirement Tier 1 (Smoke & Sizing) Tier 2 (Boundaries & Edge Cases) Tier 3 (Cross-Feature Combinations) Tier 4 (Full Parity vs D2MOO)
1 Dynamic Sizing (R1) 96×56 horizontal vs 56×96 vertical 5 5 ✓ ✓
2 Level Flags (R1) OUTDOOR_SOUTHWEST, NORTHWEST, BRIDGE, RIVER 5 5 ✓ ✓
3 Outer River (R2) x = nGridWidth - 2, dual column URiverC/LRiverC 5 5 ✓ ✓
4 River Bridges (R2) BridgeU / BridgeL crossing & border suppression 5 5 ✓ ✓
5 Secondary Borders (R3) 4 passes: BorderCliffs, Middle, Corner, Border 5 5 ✓ ✓
6 2×3 Forest Closures (R3) Bord9..Bord12 interior enclosures 5 5 ✓ ✓
7 Town Transition (R4) 56×8 TownSTrans aligned to river edge 5 5 ✓ ✓
8 Landmark Presets (R4) DenEnt, Pond1, Cott1, Circle, Clover 5 5 ✓ ✓
9 FarAway Metric (R4) Den of Evil maximum distance from town 5 5 ✓ ✓
10 Orthogonal Roads (R5) Polyline vertex graph linking exits 5 5 ✓ ✓
11 Road LUT 256-Byte (R5) Width-2 Bresenham + byte_6FDCF958 styles 5 5 ✓ ✓
12 0x40002 Base Floor (R6) Uniform Style 0 Seq 0 grass initialization 5 5 ✓ ✓
13 LvlSub Cluster (R6) SubType 6 Pud, Trees, Stone, Swamp trials 5 5 ✓ ✓

Test Architecture

  • Test Runner: npx vitest run tests/wilderness-d2moo-parity.test.ts
  • Ground Truth Binary: /usr/local/google/home/taodao/tmp/d2moo_runner/d2moo_mapgen <levelId> <seed> <difficulty> <outJsonPath>
  • Golden Fixtures Directory: tests/fixtures/d2moo/
    • level2_seed_1.json (Blood Moor Vertical 56×96, no river)
    • level2_seed_42.json (Blood Moor Vertical 56×96)
    • level2_seed_12345.json (Blood Moor Horizontal 96×56, river @ column 10/11)
    • level2_seed_0x12345678.json (Blood Moor Horizontal 96×56, river @ column 10/11)
    • level3_seed_1.json (Cold Plains 80×80)
    • level3_seed_0x12345678.json (Cold Plains 80×80)
    • level4_seed_1.json (Stony Field 80×80)
    • level4_seed_0x12345678.json (Stony Field 80×80)

Pass/Fail Semantics

  1. Grid dimensions match D2MOO output exactly (width, height, room grid width/height).
  2. Outer river columns match exactly when river flags are present (x = nGridWidth - 2 and nGridWidth - 1).
  3. TownSTrans is placed at bx = 0 or bx = nGridWidth - 7 with exact size 7×1 blocks (56×8 tiles).
  4. All required landmark presets (DenEnt, Pond1, Cott1, Circle, Clover) are present with valid coordinates.
  5. Secondary border tiles and 2×3 interior closures (Bord9..Bord12) are formed.
  6. Dirt path connects town exit to den and wilderness exit without spline deviations.
  7. TypeScript typecheck passes with 0 errors.