#include "../shared/ModuleBase.h" #include "FactoryModule.cpp" #include using json = nlohmann::json; /** * @brief Standalone test for FactoryModule * * Claude Code can run this to test the module locally */ int main() { std::cout << "šŸ­ Testing Factory Module Standalone..." << std::endl; try { auto factory = std::make_unique(); // Initialize with basic config json config = { {"module_name", "Factory"}, {"debug", true} }; factory->initialize(config); // Test production json produce_cmd = { {"type", "produce"}, {"recipe", "steel_plate"}, {"quantity", 5} }; std::cout << "\nšŸ“¤ Input: " << produce_cmd.dump(2) << std::endl; // First attempt should fail (no materials) json result = factory->process(produce_cmd); std::cout << "šŸ“„ Result: " << result.dump(2) << std::endl; // Add some materials and try again json add_materials = { {"type", "add_inventory"}, {"materials", {{"iron_ore", 20}, {"coal", 10}}} }; // Test status json status_cmd = {{"type", "status"}}; json status = factory->process(status_cmd); std::cout << "\nšŸ“Š Status: " << status.dump(2) << std::endl; factory->shutdown(); std::cout << "\nāœ… Factory Module test completed successfully!" << std::endl; return 0; } catch (const std::exception& e) { std::cerr << "āŒ Factory Module test failed: " << e.what() << std::endl; return 1; } }