Tests Directory (tests/)
This directory contains all unit tests, integration tests, and test utilities for the Pokemon battle simulator.
Planned Structure
tests/
├── unit/ # Unit tests for individual components
│ ├── core/ # Core system tests
│ │ ├── test_pokemon.cpp
│ │ ├── test_battle.cpp
│ │ ├── test_move.cpp
│ │ └── test_type.cpp
│ ├── data/ # Data loading tests
│ │ ├── test_loader.cpp
│ │ └── test_validator.cpp
│ ├── ai/ # AI system tests
│ │ ├── test_random_ai.cpp
│ │ └── test_minimax_ai.cpp
│ └── utils/ # Utility tests
│ ├── test_random.cpp
│ └── test_stats.cpp
├── integration/ # Integration tests
│ ├── test_full_battle.cpp
│ ├── test_ai_battles.cpp
│ └── test_data_loading.cpp
├── fixtures/ # Test data and fixtures
│ ├── sample_pokemon.json
│ ├── sample_moves.json
│ └── test_battles.json
├── helpers/ # Test helper utilities
│ ├── test_utils.h
│ ├── mock_pokemon.h
│ └── battle_builder.h
└── CMakeLists.txt # Test build configuration
Testing Framework
- Google Test (gtest): Primary testing framework
- Google Mock (gmock): For mocking dependencies
- Test Coverage: Aim for >90% code coverage
- Continuous Integration: Tests run on every commit
Test Categories
Unit Tests
- Test individual classes and functions in isolation
- Fast execution (< 1ms per test)
- Mock external dependencies
- Focus on edge cases and error conditions
Integration Tests
- Test component interactions
- Use real data files
- Validate complete battle flows
- Performance regression testing
Property-Based Testing
- Random battle scenarios
- Invariant checking (HP never negative, etc.)
- Stress testing with large numbers of battles
Test Data
The fixtures/ directory contains minimal, controlled test data separate from the main game data, ensuring tests are:
- Deterministic: Same results every run
- Fast: Minimal data loading overhead
- Isolated: Independent of main data changes