Skip to content

test: Add DoomSystem unit tests (#488)#499

Merged
PipFoweraker merged 2 commits intomainfrom
feature/testing-and-doom
Dec 19, 2025
Merged

test: Add DoomSystem unit tests (#488)#499
PipFoweraker merged 2 commits intomainfrom
feature/testing-and-doom

Conversation

@PipFoweraker
Copy link
Owner

@PipFoweraker PipFoweraker commented Dec 19, 2025

Summary

This PR addresses two priority issues from the 48-hour sprint:

Issue #488: DoomSystem Unit Tests

  • Add comprehensive unit tests for the DoomSystem class
  • 33 test cases covering core doom mechanics:
    • Doom clamping (0-100 bounds)
    • calculate_doom_change() structure and behavior
    • apply_doom_modifier() and set_doom_multiplier() functionality
    • Momentum system capping
    • Status and trend getter functions
    • Event doom tracking
    • Serialization/deserialization
    • Unproductive doom calculations

Issue #424: Unmanaged Employee Productivity Fix

  • Fixed get_unmanaged_count() to use researchers array when available
  • Fixed double-counting bug in _calculate_unproductive_doom()
  • Added 3 tests for get_unmanaged_count() in test_game_state.gd

Test plan

  • CI runs test suite automatically
  • Tests follow existing pattern from test_game_state.gd
  • Verify tests pass in Godot editor (GUT panel)

Notes

  • Pre-commit hooks have pre-existing issues (ASCII converter crashes, Python syntax errors in unrelated scripts) that may need separate attention
  • Tests follow the established GUT framework pattern

Closes #488
Closes #424

🤖 Generated with Claude Code

PipFoweraker and others added 2 commits December 19, 2025 16:07
Add comprehensive unit tests for the DoomSystem class including:
- Doom clamping tests (0-100 bounds)
- calculate_doom_change() structure and behavior tests
- apply_doom_modifier() and set_doom_multiplier() tests
- Momentum system capping tests
- Status and trend getter tests
- Event doom tracking tests
- Serialization/deserialization tests

Total: 28 test cases covering core doom mechanics.
Follows pattern from test_game_state.gd.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixes two bugs in productivity/doom calculation:

1. game_state.gd: get_unmanaged_count() now uses researchers array
   - Previously only used legacy counts (safety_researchers, etc.)
   - Now checks researchers.size() first, falls back to legacy counts
   - Ensures consistency with individual researcher system

2. doom_system.gd: Fixed double-counting in _calculate_unproductive_doom()
   - Bug: (total_staff - productive) + unmanaged double-counted unmanaged
   - Fix: total_unproductive = total_staff - productive (correct formula)
   - Also updated to use researchers array when available

Added 8 new test cases:
- 5 tests in test_doom_system.gd for unproductive doom scenarios
- 3 tests in test_game_state.gd for get_unmanaged_count()

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@PipFoweraker PipFoweraker merged commit 128af87 into main Dec 19, 2025
20 of 21 checks passed
@PipFoweraker PipFoweraker deleted the feature/testing-and-doom branch December 19, 2025 05:14
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.

Add unit tests for DoomSystem Refactor Unmanaged Employee Productivity System

1 participant