Spaces:
No application file
No application file
sam133
Refactor: Restructure codebase with modular design patterns and fix orchestrator implementation
9529bc2
| """ | |
| Tests for core functionality. | |
| """ | |
| import pytest | |
| from core.robot_design import RobotDesign | |
| from core.orchestrator import Orchestrator | |
| def test_robot_design_creation(): | |
| """Test creating a robot design.""" | |
| design = RobotDesign( | |
| type="robot", | |
| components=["body", "wheels"], | |
| specifications={ | |
| "body": {"size": "medium"}, | |
| "wheels": {"count": 4} | |
| } | |
| ) | |
| assert design.type == "robot" | |
| assert "body" in design.components | |
| assert design.specifications["wheels"]["count"] == 4 | |
| def test_orchestrator_initialization(mock_physics_engine): | |
| """Test orchestrator initialization.""" | |
| orchestrator = Orchestrator(physics_engine=mock_physics_engine) | |
| assert orchestrator.physics_engine == mock_physics_engine | |
| assert not mock_physics_engine.initialized | |
| def test_orchestrator_simulation(mock_physics_engine, mock_llm_response): | |
| """Test orchestrator simulation workflow.""" | |
| orchestrator = Orchestrator(physics_engine=mock_physics_engine) | |
| design = RobotDesign(**mock_llm_response["design"]) | |
| result = orchestrator.simulate_design(design) | |
| assert result["success"] | |
| assert "metrics" in result | |
| assert "distance" in result["metrics"] |