CCSDS USLP (Unified Space Link Protocol) Transfer Frame- unified TM/TC/AOS
0
fork

Configure Feed

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

refactor(crowbar): Alcotest-style API with suite exports and grouped run

- Change `run` signature to `string -> (string * test_case list) list -> unit`
matching Alcotest's grouping convention
- Fix `_name` bug: pass the name through to Alcotest.run_with_args
- Each fuzz module now exports `let suite = ("name", [test_case ...])`
- Entry points (fuzz.ml) collect suites: `Crowbar.run "pkg" [Fuzz_X.suite]`
- Remove stale `add_test`/`suite` API, keep only `test_case`/`run`
- Remove `let run () = ()` from fuzz_common.ml files
- Update merlint E725 rule to match new `let suite = ("name", ...)` pattern
- Update E725 test fixtures and expected output

+23 -18
+23 -18
fuzz/fuzz_uslp.ml
··· 5 5 6 6 open Crowbar 7 7 8 - let () = 9 - add_test ~name:"uslp roundtrip" 10 - [ range 0x10000; range 64; range 16; bytes ] 11 - (fun scid_val vcid_val map_id_val data -> 12 - match 13 - (Uslp.scid scid_val, Uslp.vcid vcid_val, Uslp.map_id map_id_val) 14 - with 15 - | Some scid, Some vcid, Some map_id -> ( 16 - let frame = Uslp.v ~scid ~vcid ~map_id ~vcfc:0 ~vcfc_len:0 data in 17 - let encoded = Uslp.encode frame in 18 - match Uslp.decode encoded with 19 - | Error e -> fail (Fmt.str "decode failed: %a" Uslp.pp_error e) 20 - | Ok frame' -> check_eq ~pp:Uslp.pp ~eq:Uslp.equal frame frame') 21 - | _ -> ()) 8 + let test_roundtrip scid_val vcid_val map_id_val data = 9 + match (Uslp.scid scid_val, Uslp.vcid vcid_val, Uslp.map_id map_id_val) with 10 + | Some scid, Some vcid, Some map_id -> ( 11 + let frame = Uslp.v ~scid ~vcid ~map_id ~vcfc:0 ~vcfc_len:0 data in 12 + let encoded = Uslp.encode frame in 13 + match Uslp.decode encoded with 14 + | Error e -> fail (Fmt.str "decode failed: %a" Uslp.pp_error e) 15 + | Ok frame' -> check_eq ~pp:Uslp.pp ~eq:Uslp.equal frame frame') 16 + | _ -> () 17 + 18 + let test_decode_random buf = 19 + (* Just check decode doesn't crash on random input *) 20 + ignore (Uslp.decode buf) 21 + 22 + let suite = 23 + ( "crowbar", 24 + [ 25 + test_case "uslp roundtrip" 26 + [ range 0x10000; range 64; range 16; bytes ] 27 + test_roundtrip; 28 + test_case "uslp decode random bytes" [ bytes ] test_decode_random; 29 + ] ) 22 30 23 - let () = 24 - add_test ~name:"uslp decode random bytes" [ bytes ] (fun buf -> 25 - (* Just check decode doesn't crash on random input *) 26 - ignore (Uslp.decode buf)) 31 + let () = run "crowbar" [ suite ]