CCSDS Synchronization and Channel Coding (131.0-B, 231.0-B)
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
+1 -3
test/interop/dariol83/test.ml
··· 16 16 17 17 let hex_of_bytes b = 18 18 let buf = Buffer.create (Bytes.length b * 2) in 19 - Bytes.iter 20 - (fun c -> Buffer.add_string buf (Fmt.str "%02x" (Char.code c))) 21 - b; 19 + Bytes.iter (fun c -> Buffer.add_string buf (Fmt.str "%02x" (Char.code c))) b; 22 20 Buffer.contents buf 23 21 24 22 (* -----------------------------------------------------------------------
+8 -17
test/test_coding.ml
··· 55 55 let seq = Scc.Coding.Randomizer.sequence 40 in 56 56 for i = 0 to 39 do 57 57 Alcotest.(check int) 58 - (Fmt.str "PN byte %d" i) 59 - ccsds_pn_first_40.(i) 58 + (Fmt.str "PN byte %d" i) ccsds_pn_first_40.(i) 60 59 (Char.code (Bytes.get seq i)) 61 60 done 62 61 ··· 66 65 for i = 0 to 254 do 67 66 let expected = Scc.Coding.Randomizer.next_byte r in 68 67 Alcotest.(check int) 69 - (Fmt.str "PN byte %d" i) 70 - expected 68 + (Fmt.str "PN byte %d" i) expected 71 69 (Char.code (Bytes.get seq i)) 72 70 done 73 71 ··· 119 117 let first_255 = Array.init 255 (fun _ -> Scc.Coding.Randomizer.next_byte r) in 120 118 let next_255 = Array.init 255 (fun _ -> Scc.Coding.Randomizer.next_byte r) in 121 119 for i = 0 to 254 do 122 - Alcotest.(check int) 123 - (Fmt.str "period byte %d" i) 124 - first_255.(i) next_255.(i) 120 + Alcotest.(check int) (Fmt.str "period byte %d" i) first_255.(i) next_255.(i) 125 121 done 126 122 127 123 let test_apply_with_offset () = ··· 183 179 Alcotest.(check string) 184 180 "RS corrects 16 errors" (Bytes.to_string data) 185 181 (Bytes.to_string recovered) 186 - | Error e -> 187 - Alcotest.fail (Fmt.str "RS failed to correct 16 errors: %s" e) 182 + | Error e -> Alcotest.fail (Fmt.str "RS failed to correct 16 errors: %s" e) 188 183 189 184 let test_rs_error_correction_interleaved () = 190 185 let data = Bytes.init 1115 (fun i -> Char.chr (((i * 11) + 7) land 0xFF)) in ··· 204 199 Alcotest.(check string) 205 200 "RS corrects interleaved errors" (Bytes.to_string data) 206 201 (Bytes.to_string recovered) 207 - | Error e -> 208 - Alcotest.fail (Fmt.str "RS interleaved decode failed: %s" e) 202 + | Error e -> Alcotest.fail (Fmt.str "RS interleaved decode failed: %s" e) 209 203 210 204 let test_rs_uncorrectable_17_errors () = 211 205 let data = Bytes.init 223 (fun i -> Char.chr (((i * 13) + 42) land 0xFF)) in ··· 487 481 let seq = Scc.Coding.Randomizer.sequence 255 in 488 482 for i = 0 to 254 do 489 483 Alcotest.(check int) 490 - (Fmt.str "PN byte %d" i) 491 - ccsds_pn_full_255.(i) 484 + (Fmt.str "PN byte %d" i) ccsds_pn_full_255.(i) 492 485 (Char.code (Bytes.get seq i)) 493 486 done 494 487 ··· 508 501 let conv_coded = Scc.Coding.Convolutional.encode rs_coded in 509 502 match Scc.Coding.Convolutional.decode conv_coded with 510 503 | Error e -> 511 - Alcotest.fail 512 - (Fmt.str "Convolutional decode failed in pipeline: %s" e) 504 + Alcotest.fail (Fmt.str "Convolutional decode failed in pipeline: %s" e) 513 505 | Ok rs_decoded_cw -> ( 514 506 match Scc.Coding.Reed_solomon.decode rs_decoded_cw with 515 - | Error e -> 516 - Alcotest.fail (Fmt.str "RS decode failed in pipeline: %s" e) 507 + | Error e -> Alcotest.fail (Fmt.str "RS decode failed in pipeline: %s" e) 517 508 | Ok recovered -> 518 509 Alcotest.(check string) 519 510 "pipeline RS+Conv roundtrip" (Bytes.to_string data)