summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index fec5fc4..cf8ede9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -44,4 +44,15 @@ mod tests {
assert_eq!(errloc[0], 30);
assert_eq!(errloc[1], 0);
}
+
+ #[test]
+ fn test_sync_codeword() {
+ let mut bch = BCH::init(5, 2, 1897);
+ let msg: [u8; 21] = [0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0];
+ let ecc: [u8; 10] = [1, 0, 1, 1, 1, 0, 1, 1, 0, 0];
+ let mut errloc: [u32; 2] = [0, 0];
+ bch.decode(&msg, &ecc, &mut errloc);
+ assert_eq!(errloc[0], 0);
+ assert_eq!(errloc[1], 0);
+ }
}