iosdiag / tests /integration_test.rs
meccatronis's picture
Upload tests/integration_test.rs with huggingface_hub
de411fb verified
// Integration tests for iOSDiag
#[cfg(test)]
mod tests {
use std::path::PathBuf;
#[test]
fn test_project_structure() {
// Verify core library exists
let core_cargo = PathBuf::from("crates/iosdiag-core/Cargo.toml");
assert!(core_cargo.exists(), "Core library Cargo.toml not found");
// Verify CLI exists
let cli_cargo = PathBuf::from("crates/iosdiag-cli/Cargo.toml");
assert!(cli_cargo.exists(), "CLI Cargo.toml not found");
// Verify knowledge base exists
let kb_version = PathBuf::from("kb/kb_version.json");
assert!(kb_version.exists(), "KB version file not found");
}
#[test]
fn test_knowledge_base_rules() {
// Verify rule files exist
let battery_rules = PathBuf::from("kb/rules/battery.yaml");
assert!(battery_rules.exists(), "Battery rules not found");
let storage_rules = PathBuf::from("kb/rules/storage.yaml");
assert!(storage_rules.exists(), "Storage rules not found");
let thermal_rules = PathBuf::from("kb/rules/thermal.yaml");
assert!(thermal_rules.exists(), "Thermal rules not found");
let wifi_rules = PathBuf::from("kb/rules/wifi.yaml");
assert!(wifi_rules.exists(), "Wi-Fi rules not found");
let reboot_rules = PathBuf::from("kb/rules/reboot.yaml");
assert!(reboot_rules.exists(), "Reboot rules not found");
let charging_rules = PathBuf::from("kb/rules/charging.yaml");
assert!(charging_rules.exists(), "Charging rules not found");
}
#[test]
fn test_documentation_exists() {
// Verify documentation files exist
let readme = PathBuf::from("README.md");
assert!(readme.exists(), "README.md not found");
let architecture = PathBuf::from("docs/ARCHITECTURE.md");
assert!(architecture.exists(), "ARCHITECTURE.md not found");
let protocol_guide = PathBuf::from("docs/PROTOCOL_GUIDE.md");
assert!(protocol_guide.exists(), "PROTOCOL_GUIDE.md not found");
let developer_guide = PathBuf::from("docs/DEVELOPER_GUIDE.md");
assert!(developer_guide.exists(), "DEVELOPER_GUIDE.md not found");
}
#[test]
fn test_module_organization() {
// Verify core module structure
let transport_mod = PathBuf::from("crates/iosdiag-core/src/transport/mod.rs");
assert!(transport_mod.exists(), "Transport module not found");
let security_mod = PathBuf::from("crates/iosdiag-core/src/security/mod.rs");
assert!(security_mod.exists(), "Security module not found");
let services_mod = PathBuf::from("crates/iosdiag-core/src/services/mod.rs");
assert!(services_mod.exists(), "Services module not found");
let collectors_mod = PathBuf::from("crates/iosdiag-core/src/collectors/mod.rs");
assert!(collectors_mod.exists(), "Collectors module not found");
let normalize_mod = PathBuf::from("crates/iosdiag-core/src/normalize/mod.rs");
assert!(normalize_mod.exists(), "Normalize module not found");
let inference_mod = PathBuf::from("crates/iosdiag-core/src/inference/mod.rs");
assert!(inference_mod.exists(), "Inference module not found");
let report_mod = PathBuf::from("crates/iosdiag-core/src/report/mod.rs");
assert!(report_mod.exists(), "Report module not found");
}
#[test]
fn test_utility_modules() {
// Verify utility modules
let util_mod = PathBuf::from("crates/iosdiag-core/src/util/mod.rs");
assert!(util_mod.exists(), "Util module not found");
let time_util = PathBuf::from("crates/iosdiag-core/src/util/time.rs");
assert!(time_util.exists(), "Time utility not found");
let retry_util = PathBuf::from("crates/iosdiag-core/src/util/retry.rs");
assert!(retry_util.exists(), "Retry utility not found");
let bytes_util = PathBuf::from("crates/iosdiag-core/src/util/bytes.rs");
assert!(bytes_util.exists(), "Bytes utility not found");
let plist_util = PathBuf::from("crates/iosdiag-core/src/util/plist.rs");
assert!(plist_util.exists(), "Plist utility not found");
let zip_util = PathBuf::from("crates/iosdiag-core/src/util/zip.rs");
assert!(zip_util.exists(), "Zip utility not found");
}
#[test]
fn test_error_handling() {
// Verify error module exists
let error_mod = PathBuf::from("crates/iosdiag-core/src/error.rs");
assert!(error_mod.exists(), "Error module not found");
}
#[test]
fn test_configuration() {
// Verify configuration module exists
let config_mod = PathBuf::from("crates/iosdiag-core/src/config.rs");
assert!(config_mod.exists(), "Config module not found");
}
#[test]
fn test_logging() {
// Verify logging module exists
let logging_mod = PathBuf::from("crates/iosdiag-core/src/logging.rs");
assert!(logging_mod.exists(), "Logging module not found");
}
#[test]
fn test_cli_structure() {
// Verify CLI main file exists
let cli_main = PathBuf::from("crates/iosdiag-cli/src/main.rs");
assert!(cli_main.exists(), "CLI main.rs not found");
}
#[test]
fn test_workspace_configuration() {
// Verify workspace Cargo.toml exists
let workspace_cargo = PathBuf::from("Cargo.toml");
assert!(workspace_cargo.exists(), "Workspace Cargo.toml not found");
}
}