Skip to content

Add WorldGen determinism tests #39

Description

@MichaelFisher1997

Parent Issue

Part of #26 (Full Codebase Audit v3)

Category

Testing & Validation (1 day)

Problem

WorldGen should produce identical output for the same seed, but this isn't verified by tests.

Current State

Proposed Tests

test "WorldGen same seed produces identical chunks" {
    const gen1 = TerrainGenerator.init(12345, allocator);
    const gen2 = TerrainGenerator.init(12345, allocator);
    
    var chunk1 = Chunk.init(0, 0);
    var chunk2 = Chunk.init(0, 0);
    
    gen1.generate(&chunk1, null);
    gen2.generate(&chunk2, null);
    
    // Compare block data
    try testing.expectEqualSlices(BlockType, &chunk1.blocks, &chunk2.blocks);
}

test "WorldGen different seeds produce different chunks" {
    // ...
}

test "WorldGen golden output for known seed" {
    // Compare against saved expected output
}

Files to Create

  • src/tests/worldgen_determinism.zig or add to src/tests.zig

Risk

None - pure test addition

Acceptance Criteria

  • Determinism test: same seed → same output
  • Different seed test: different seeds → different output
  • Optional: golden output test for regression detection

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions