warfactoryracine/tests/war/test_combat_api.cpp
StillHammer 3d6f6abc81 Add comprehensive test structure for all engines
🧪 Created complete API testing architecture:
- Organized tests/ directory with folder per engine
- Google Test framework setup for each engine
- API validation tests for all 10 autonomous engines

 Test coverage includes:
- Factory Engine: Production API, 60fps performance, material flow
- War Engine: Multi-chunk combat, auto-battler, 500 units capacity
- Designer Engine: Global 1-2 designs/tick rate, design evolution
- Map Engine: 218 procedural elements, FOW chunk granularity
- Intelligence Engine: 3.1GB adaptive metrics, satellite reconnaissance
- MacroEntity Engine: Company features, diplomacy, admin points
- Operation Engine: AI generals, ML adaptation, strategic planning
- Logistic Engine: Supply chains, convoy management, route optimization
- Economy Engine: Market simulation, pricing, geopolitical events
- Event Engine: Breakthrough system, global events, scheduling

🎯 Each test validates:
- Engine API correctness and functionality
- Performance targets and specifications
- Inter-engine communication patterns
- Technical requirements from documentation

📋 Added helpers/ directory for build utilities and tools
🚀 Ready for TDD implementation and continuous validation
2025-09-19 02:12:44 +08:00

55 lines
1.6 KiB
C++

#include <gtest/gtest.h>
#include "war/WarEngine.h"
using namespace Warfactory::War;
class WarEngineAPITest : public ::testing::Test {
protected:
void SetUp() override {
engine = std::make_unique<WarEngine>();
ASSERT_TRUE(engine->initialize());
}
void TearDown() override {
engine->shutdown();
}
std::unique_ptr<WarEngine> engine;
};
TEST_F(WarEngineAPITest, BattleCreation) {
// Test multi-chunk battle creation
std::vector<int> chunks = {1, 2, 3, 4}; // Multi-chunk battle
engine->createBattle("test_battle", chunks);
EXPECT_EQ(engine->getActiveBattles(), 1);
}
TEST_F(WarEngineAPITest, AutoBattlerControl) {
// Test auto-battler functionality
std::vector<int> chunks = {1};
engine->createBattle("auto_battle", chunks);
engine->enableAutoBattler("auto_battle");
engine->setPlayerOversight("auto_battle", true);
// Should allow player oversight while auto-battling
EXPECT_EQ(engine->getActiveBattles(), 1);
}
TEST_F(WarEngineAPITest, ThermalManagement) {
// Test automatic thermal management (fire & scoot)
// TODO: Create units with thermal properties
// TODO: Verify automatic retreat/advance on overheating
}
TEST_F(WarEngineAPITest, PerformanceWith500Units) {
// Test performance target: 500 units simultaneous
std::vector<int> chunks = {1, 2, 3};
engine->createBattle("large_battle", chunks);
// TODO: Add 500 units to battle
// TODO: Verify 60fps maintained
EXPECT_GE(engine->getTickRate(), 55.0); // Allow some tolerance
}