test detection of dual bit errors with hemming
This commit is contained in:
@@ -343,4 +343,14 @@ mod base_type_tests {
|
|||||||
assert_eq!(invalid_hemming^hc, hemming);
|
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())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user