Skip to content

[MED] Split tests.zig - Create tests/ directory with module-specific test files #274

@MichaelFisher1997

Description

@MichaelFisher1997

Problem

The src/tests.zig file has grown to 1400+ lines and contains tests for multiple unrelated modules:

  • Math (Vec3, Mat4, AABB, Frustum)
  • World (Chunk, BlockType, PackedLight)
  • Worldgen (Noise, generators)
  • Meshing (AO calculator, lighting sampler)
  • Texture atlas
  • Biome constraints

This monolithic test file is difficult to navigate and maintain.

Current State

One file (src/tests.zig) contains tests for 15+ different modules.

Proposed Solution

Create a src/tests/ directory with module-specific test files:

src/tests/
├── main.zig           # Test runner/imports
├── math.zig           # Vec3, Mat4, AABB tests
├── chunk.zig          # Chunk, BlockType, PackedLight tests
├── worldgen.zig       # Noise, generator tests
├── meshing.zig        # AO, lighting sampler tests
└── texture.zig        # TextureAtlas tests

Benefits

  • Tests are co-located by module
  • Easier to find and run specific test suites
  • Reduced merge conflicts in test files
  • Clearer organization

Acceptance Criteria

  • Create src/tests/ directory
  • Split tests into logical files by module
  • Update build.zig to run all tests
  • All existing tests preserved
  • Tests still pass
  • Document new test organization in README or AGENTS.md

Related Files

  • src/tests.zig
  • build.zig

Estimated Effort

Low-Medium (mostly moving code)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions