use anyhow::Result;
use crate::RuntimeOrchestrator;
pub async fn run_unified_test_suite() -> Result<()> {
let mut orchestrator = RuntimeOrchestrator::new();
orchestrator.add_runtime(Box::new(crate::native_tests::NativeRuntime::new()));
orchestrator.add_runtime(Box::new(crate::wasm_tests::WasmRuntimeTest::new().await?));
orchestrator.add_runtime(Box::new(crate::deno_tests::DenoRuntime::new()));
orchestrator.add_runtime(Box::new(crate::python_tests::PythonRuntime::new()));
orchestrator.add_runtime(Box::new(crate::docker_tests::DockerRuntime::new()));
let report = orchestrator.run_all_tests().await?;
println!("Unified Test Report:");
println!(" Total tests: {}", report.summary.total_tests);
println!(" Passed: {}", report.summary.passed);
println!(" Failed: {}", report.summary.failed);
println!(" Avg execution time: {:?}", report.summary.avg_execution_time);
Ok(())
}
pub async fn run_performance_comparison() -> Result<()> {
let mut orchestrator = RuntimeOrchestrator::new();
orchestrator.add_runtime(Box::new(crate::native_tests::NativeRuntime::new()));
orchestrator.add_runtime(Box::new(crate::wasm_tests::WasmRuntimeTest::new().await?));
orchestrator.add_runtime(Box::new(crate::deno_tests::DenoRuntime::new()));
orchestrator.add_runtime(Box::new(crate::python_tests::PythonRuntime::new()));
orchestrator.add_runtime(Box::new(crate::docker_tests::DockerRuntime::new()));
let comparison = orchestrator.compare_performance().await?;
println!("Performance Comparison:");
println!(" Fastest: {:?}", comparison.fastest_runtime);
println!(" Most efficient: {:?}", comparison.most_efficient);
println!(" Recommendations:");
for rec in comparison.recommendations {
println!(" - {}", rec);
}
Ok(())
}
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_unified_suite() {
let result = run_unified_test_suite().await;
assert!(result.is_ok() || result.is_err()); }
}