use key_vault::tee::{Detection, detect_tee_capabilities};
#[test]
fn detect_completes_and_returns_consistent_snapshot() {
let first = detect_tee_capabilities();
let second = detect_tee_capabilities();
assert_eq!(first, second);
}
#[test]
fn detection_variants_are_self_consistent() {
let caps = detect_tee_capabilities();
for d in [
caps.sgx,
caps.tdx,
caps.sev,
caps.sev_snp,
caps.trustzone,
caps.secure_enclave,
caps.nitro,
] {
if d.is_detected() {
assert!(matches!(d, Detection::Detected));
} else {
assert!(matches!(d, Detection::NotDetected | Detection::Unknown));
}
}
}
#[cfg(target_arch = "x86_64")]
#[test]
fn x86_64_returns_known_detection_for_intel_amd_probes() {
let caps = detect_tee_capabilities();
for d in [caps.sgx, caps.tdx, caps.sev, caps.sev_snp] {
assert_ne!(d, Detection::Unknown);
}
}