test detection of dual bit errors with hemming

This commit is contained in:
2026-03-22 15:54:53 +01:00
parent 87bd3abaca
commit f4381cffb8
+10
View File
@@ -343,4 +343,14 @@ mod base_type_tests {
assert_eq!(invalid_hemming^hc, hemming);
}
}
#[test]
fn hemming_dual_bit_error_detection() {
let data = 0x123456;
let hemming = calc_hemming(data);
let bit_error = 0x101;
let correction = check_hemming(data ^ bit_error, hemming).unwrap_err();
let (dc, hc) = correction.calc_correction_data();
assert!(check_hemming(data ^ dc, hemming ^ hc).is_err())
}
}