#[test]
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))]
fn compare_with_cupid() {
let information = cupid::master().unwrap();
macro_rules! check_feature {
($core_detect_expr:expr, $cupid_expr:expr $(,)?) => {
if cfg!(allow_false_negative) {
if $core_detect_expr {
assert!($cupid_expr);
}
} else {
assert_eq!(
$core_detect_expr,
$cupid_expr,
"should be equal: {} == {}",
stringify!($core_detect_expr),
stringify!($cupid_expr),
);
}
};
}
check_feature!(
core_detect::is_x86_feature_detected!("aes"),
information.aesni()
);
check_feature!(
core_detect::is_x86_feature_detected!("pclmulqdq"),
information.pclmulqdq()
);
check_feature!(
core_detect::is_x86_feature_detected!("rdrand"),
information.rdrand()
);
check_feature!(
core_detect::is_x86_feature_detected!("rdseed"),
information.rdseed()
);
check_feature!(
core_detect::is_x86_feature_detected!("tsc"),
information.tsc()
);
check_feature!(
core_detect::is_x86_feature_detected!("sse"),
information.sse()
);
check_feature!(
core_detect::is_x86_feature_detected!("sse2"),
information.sse2()
);
check_feature!(
core_detect::is_x86_feature_detected!("sse3"),
information.sse3()
);
check_feature!(
core_detect::is_x86_feature_detected!("ssse3"),
information.ssse3()
);
check_feature!(
core_detect::is_x86_feature_detected!("sse4.1"),
information.sse4_1()
);
check_feature!(
core_detect::is_x86_feature_detected!("sse4.2"),
information.sse4_2()
);
check_feature!(
core_detect::is_x86_feature_detected!("sse4a"),
information.sse4a()
);
check_feature!(
core_detect::is_x86_feature_detected!("sha"),
information.sha()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx"),
information.avx()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx2"),
information.avx2()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx512f"),
information.avx512f()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx512cd"),
information.avx512cd()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx512er"),
information.avx512er()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx512pf"),
information.avx512pf()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx512bw"),
information.avx512bw()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx512dq"),
information.avx512dq()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx512vl"),
information.avx512vl()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx512ifma"),
information.avx512_ifma()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx512vbmi"),
information.avx512_vbmi()
);
check_feature!(
core_detect::is_x86_feature_detected!("avx512vpopcntdq"),
information.avx512_vpopcntdq()
);
check_feature!(
core_detect::is_x86_feature_detected!("fma"),
information.fma()
);
check_feature!(
core_detect::is_x86_feature_detected!("bmi1"),
information.bmi1()
);
check_feature!(
core_detect::is_x86_feature_detected!("bmi2"),
information.bmi2()
);
check_feature!(
core_detect::is_x86_feature_detected!("popcnt"),
information.popcnt()
);
check_feature!(
core_detect::is_x86_feature_detected!("abm"),
information.lzcnt()
);
check_feature!(
core_detect::is_x86_feature_detected!("tbm"),
information.tbm()
);
check_feature!(
core_detect::is_x86_feature_detected!("lzcnt"),
information.lzcnt()
);
check_feature!(
core_detect::is_x86_feature_detected!("xsave"),
information.xsave()
);
check_feature!(
core_detect::is_x86_feature_detected!("xsaveopt"),
information.xsaveopt()
);
check_feature!(
core_detect::is_x86_feature_detected!("xsavec"),
information.xsavec_and_xrstor()
);
check_feature!(
core_detect::is_x86_feature_detected!("xsaves"),
information.xsaves_xrstors_and_ia32_xss()
);
check_feature!(
core_detect::is_x86_feature_detected!("cmpxchg16b"),
information.cmpxchg16b(),
);
check_feature!(
core_detect::is_x86_feature_detected!("adx"),
information.adx(),
);
check_feature!(
core_detect::is_x86_feature_detected!("rtm"),
information.rtm(),
);
}