CCSDS Command Link Control Word (CLCW) for spacecraft command
0
fork

Configure Feed

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

fix(lint): resolve E205, E331, E405, E415, E600, E605, E715, E718, E725

Standardize fuzz and test conventions across 30+ packages:

- E715/E718: Add fuzz.ml runners referencing Fuzz_*.suite instead of
calling Fuzz_*.run() directly; update dune files accordingly
- E725: Fix fuzz_paseto suite name from "crowbar" to "paseto"
- E600: Create .mli interfaces for test modules (test_firmware,
test_remoteproc, test_pbkdf2, test_paseto) with single-group suites
- E605: Add missing test files (test_skills, test_monitor, test_openamp,
test_xrpc_server) with proper module extraction from inline test.ml
- E415: Add pp pretty-printer to xrpc_server type t
- E405: Add doc comment for pp_sync_action in skills.mli
- E205: Replace Printf with Fmt in fuzz_paseto and gen_corpus
- E331: Rename make_key to key in fuzz_paseto

+43 -51
+43 -51
fuzz/fuzz_diff.ml
··· 81 81 82 82 (** {1 Fuzz Tests} *) 83 83 84 + let test_decode buf = 85 + let buf = pad_to_4 buf in 86 + let orig = original_decode buf in 87 + let wire = wire_decode buf in 88 + match (orig, wire) with 89 + | None, None -> () 90 + | Some o, Some d -> 91 + if not (clcw_equal o d) then 92 + Cr.fail (Fmt.str "values differ for input %s" (String.escaped buf)) 93 + | Some _, None -> Cr.fail "original decoded but wire failed" 94 + | None, Some _ -> Cr.fail "wire decoded but original failed" 95 + 96 + let test_encode buf = 97 + let buf = pad_to_4 buf in 98 + match (original_decode buf, wire_decode buf) with 99 + | Some orig, Some wire -> 100 + let orig_bytes = original_encode orig in 101 + let wire_bytes = wire_encode wire in 102 + if orig_bytes <> wire_bytes then 103 + Cr.fail 104 + (Fmt.str "encoded bytes differ: orig=%s wire=%s" 105 + (String.escaped orig_bytes) 106 + (String.escaped wire_bytes)) 107 + | _ -> () 108 + 109 + let test_roundtrip decode encode buf = 110 + let buf = pad_to_4 buf in 111 + let expected = mask_reserved_bytes buf in 112 + match decode buf with 113 + | None -> () 114 + | Some t -> 115 + let encoded = encode t in 116 + if encoded <> expected then 117 + Cr.fail 118 + (Fmt.str "roundtrip changed bytes: in=%s out=%s" 119 + (String.escaped expected) (String.escaped encoded)) 120 + 84 121 let suite = 85 122 ( "diff", 86 123 [ 87 - (* Test: decode produces same result *) 88 - Cr.test_case "decode original vs wire" [ Cr.bytes ] (fun buf -> 89 - let buf = pad_to_4 buf in 90 - let orig = original_decode buf in 91 - let wire = wire_decode buf in 92 - match (orig, wire) with 93 - | None, None -> () 94 - | Some o, Some d -> 95 - if not (clcw_equal o d) then 96 - Cr.fail 97 - (Fmt.str "values differ for input %s" (String.escaped buf)) 98 - | Some _, None -> Cr.fail "original decoded but wire failed" 99 - | None, Some _ -> Cr.fail "wire decoded but original failed"); 100 - (* Test: encode produces same bytes *) 101 - Cr.test_case "encode original vs wire" [ Cr.bytes ] (fun buf -> 102 - let buf = pad_to_4 buf in 103 - match (original_decode buf, wire_decode buf) with 104 - | Some orig, Some wire -> 105 - let orig_bytes = original_encode orig in 106 - let wire_bytes = wire_encode wire in 107 - if orig_bytes <> wire_bytes then 108 - Cr.fail 109 - (Fmt.str "encoded bytes differ: orig=%s wire=%s" 110 - (String.escaped orig_bytes) 111 - (String.escaped wire_bytes)) 112 - | _ -> ()); 113 - (* Test: roundtrip preserves non-reserved bytes. 114 - Reserved bits (CCSDS 14-15, 23) are zeroed per spec, so we compare 115 - against the input with reserved bits masked out. *) 116 - Cr.test_case "roundtrip original" [ Cr.bytes ] (fun buf -> 117 - let buf = pad_to_4 buf in 118 - let expected = mask_reserved_bytes buf in 119 - match original_decode buf with 120 - | None -> () 121 - | Some t -> 122 - let encoded = original_encode t in 123 - if encoded <> expected then 124 - Cr.fail 125 - (Fmt.str "roundtrip changed bytes: in=%s out=%s" 126 - (String.escaped expected) (String.escaped encoded))); 127 - Cr.test_case "roundtrip wire" [ Cr.bytes ] (fun buf -> 128 - let buf = pad_to_4 buf in 129 - let expected = mask_reserved_bytes buf in 130 - match wire_decode buf with 131 - | None -> () 132 - | Some t -> 133 - let encoded = wire_encode t in 134 - if encoded <> expected then 135 - Cr.fail 136 - (Fmt.str "roundtrip changed bytes: in=%s out=%s" 137 - (String.escaped expected) (String.escaped encoded))); 124 + Cr.test_case "decode original vs wire" [ Cr.bytes ] test_decode; 125 + Cr.test_case "encode original vs wire" [ Cr.bytes ] test_encode; 126 + Cr.test_case "roundtrip original" [ Cr.bytes ] 127 + (test_roundtrip original_decode original_encode); 128 + Cr.test_case "roundtrip wire" [ Cr.bytes ] 129 + (test_roundtrip wire_decode wire_encode); 138 130 ] )