LDPC codes with belief propagation decoding
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

pus: rename test_ functions, fix service_type doc (merlint E330/E410)

+9 -20
+5 -12
test/interop/ccsds131/test.ml
··· 24 24 25 25 let bytes_to_hex b = 26 26 let buf = Buffer.create (Bytes.length b * 2) in 27 - Bytes.iter 28 - (fun c -> Buffer.add_string buf (Fmt.str "%02x" (Char.code c))) 29 - b; 27 + Bytes.iter (fun c -> Buffer.add_string buf (Fmt.str "%02x" (Char.code c))) b; 30 28 Buffer.contents buf 31 29 32 30 (* {1 Trace parsing} *) ··· 87 85 Alcotest.run "ldpc-interop" 88 86 [ 89 87 ( "encode", 90 - List.map 91 - (fun r -> Alcotest.test_case r.name `Quick (encode r)) 92 - rows ); 88 + List.map (fun r -> Alcotest.test_case r.name `Quick (encode r)) rows ); 93 89 ( "decode", 94 - List.map 95 - (fun r -> Alcotest.test_case r.name `Quick (decode r)) 96 - rows ); 90 + List.map (fun r -> Alcotest.test_case r.name `Quick (decode r)) rows ); 97 91 ( "roundtrip", 98 - List.map 99 - (fun r -> Alcotest.test_case r.name `Quick (roundtrip r)) 100 - rows ); 92 + List.map (fun r -> Alcotest.test_case r.name `Quick (roundtrip r)) rows 93 + ); 101 94 ]
+4 -8
test/test_ldpc.ml
··· 57 57 Alcotest.(check string) 58 58 "LDPC corrects 5 bit errors" (Bytes.to_string data) 59 59 (Bytes.to_string recovered) 60 - | Error e -> 61 - Alcotest.fail (Fmt.str "LDPC error correction failed: %s" e) 60 + | Error e -> Alcotest.fail (Fmt.str "LDPC error correction failed: %s" e) 62 61 63 62 (** LDPC roundtrip with all-zeros data. *) 64 63 let test_ldpc_all_zeros () = ··· 244 243 (Bytes.to_string data) 245 244 (Bytes.to_string recovered) 246 245 | Error e -> 247 - Alcotest.fail 248 - (Fmt.str "syndrome check failed for seed %d: %s" seed e)) 246 + Alcotest.fail (Fmt.str "syndrome check failed for seed %d: %s" seed e)) 249 247 seeds 250 248 251 249 (* --- BP convergence: test max_iter=1,5,50 on same corrupted codeword --- *) ··· 387 385 Alcotest.(check string) 388 386 "oversized input: data recovered" (Bytes.to_string data) 389 387 (Bytes.to_string recovered) 390 - | Error e -> 391 - Alcotest.fail (Fmt.str "oversized input decode failed: %s" e) 388 + | Error e -> Alcotest.fail (Fmt.str "oversized input decode failed: %s" e) 392 389 393 390 (** Encode with oversized input: extra bytes beyond k bits should be ignored. *) 394 391 let test_encode_oversized_input () = ··· 407 404 Alcotest.(check string) 408 405 "oversized encode: roundtrip" (Bytes.to_string data) 409 406 (Bytes.to_string recovered) 410 - | Error e -> 411 - Alcotest.fail (Fmt.str "oversized encode roundtrip failed: %s" e) 407 + | Error e -> Alcotest.fail (Fmt.str "oversized encode roundtrip failed: %s" e) 412 408 413 409 let suite = 414 410 ( "ldpc",