//! Tests for hardware profiling functionality //! //! Following TDD methodology - write tests first, then fix implementation #![cfg(feature = "disabled_tests")] use anyhow::Result; use rtx_synthesis::hardware::{HardwareProfile, HardwareProfiler}; #[test] fn test_hardware_profile_creation() { // RED: Test that HardwareProfile can be created let profile = HardwareProfile::default(); // Verify basic properties exist assert!(profile.device_count() >= 0); assert!(profile.compute_capability() >= 0.0); } #[test] fn test_hardware_profiler_detection() { // RED: Test that HardwareProfiler can detect hardware let profiler = HardwareProfiler::new(); // Should be able to detect current hardware let result = profiler.detect_hardware(); assert!(result.is_ok()); if let Ok(profile) = result { // Should have reasonable values assert!(profile.compute_capability() > 0.0); assert!(profile.device_count() >= 0); } } #[test] fn test_hardware_profile_memory_info() { // RED: Test memory information retrieval let profile = HardwareProfile::default(); // Should provide memory information assert!(profile.total_memory() >= 0); assert!(profile.available_memory() >= 0); assert!(profile.available_memory() <= profile.total_memory()); } #[test] fn test_hardware_profiler_benchmarking() { // RED: Test benchmarking capabilities let profiler = HardwareProfiler::new(); // Should be able to run benchmarks let benchmark_result = profiler.run_benchmarks(); assert!(benchmark_result.is_ok()); if let Ok(metrics) = benchmark_result { // Should have performance metrics assert!(metrics.flops() > 0.0); assert!(metrics.memory_bandwidth() > 0.0); } } #[test] fn test_hardware_optimization_suggestions() { // RED: Test optimization suggestions based on hardware let profiler = HardwareProfiler::new(); let profile = HardwareProfile::default(); // Should provide optimization suggestions let suggestions = profiler.get_optimization_suggestions(&profile); assert!(suggestions.is_ok()); if let Ok(opts) = suggestions { // Should have at least some suggestions assert!(!opts.is_empty()); } }