Skip to content

Add 5 test files for game module targeting dev#450

Closed
github-actions[bot] wants to merge 1 commit intodevfrom
opencode/schedule-509410-20260411130406
Closed

Add 5 test files for game module targeting dev#450
github-actions[bot] wants to merge 1 commit intodevfrom
opencode/schedule-509410-20260411130406

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Summary

Added 5 new test files with comprehensive unit tests for the game module targeting dev:

Tests Added

src/game/input_mapper_tests.zig (32 tests)

  • InputBinding.getName() for all key types and mouse buttons
  • InputBinding.eql() bidirectional key/key_alt equality
  • ActionBinding.init() and initWithAlt()
  • DEFAULT_BINDINGS verification for all GameAction values
  • InputMapper.setBinding(), setAlternateBinding(), resetToDefaults(), resetActionToDefault()
  • InputMapper.interface() vtable creation

src/game/settings/data_tests.zig (18 tests)

  • Settings.getShadowResolution() for all quality levels and invalid values
  • Settings.getResolutionIndex() and setResolutionByIndex() for all resolutions
  • SHADOW_QUALITIES array validation
  • RESOLUTIONS array ordering and common resolutions
  • ShadowDebugChannel enum values
  • resolveShadowDebugChannel() priority ordering (seam_diagnostics > caster_coverage > cascade_index > shadow_factor > off)

src/game/settings/presets_tests.zig (5 tests)

  • getPresetName() for valid and out-of-bounds indices
  • getIndex() returns len (Custom) for non-matching settings
  • apply() ignores out-of-bounds indices
  • apply() correctly sets all fields from preset

src/game/settings/apply_tests.zig (3 tests)

  • applyToRenderSettings() calls all 8 relevant setter methods
  • False values propagate correctly
  • Edge case values (min, max) handled correctly

src/game/settings/persistence_tests.zig (9 tests)

  • setTexturePack() early return when setting same value
  • setTexturePack() changes value when different
  • setTexturePack() multiple changes with proper memory management
  • setEnvironmentMap() same/different value handling
  • deinit() handles both static "default" and allocated strings
  • texture_pack and environment_map are independent

Verification

  • nix develop --command zig fmt src/ passes
  • nix develop --command zig build test passes (all 696 tests)
  • No non-test source files were modified

Triggered by scheduled workflow

New%20session%20-%202026-04-11T13%3A04%3A05.569Z
opencode session  |  github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant