scfg/test/fuzz/fuzz.ml
2026-03-16 23:53:42 +01:00

18 lines
658 B
OCaml

open Scfg
let () = Random.self_init ()
let () =
Crowbar.add_test ~name:"Print and parse fuzzing" [ Gen.config ] (fun config ->
let printed = Fmt.str "%a" Pp.config config in
match Parse.from_string printed with
| Error (`Msg msg) ->
Crowbar.failf "%s on the given input@\n***`%S`@\n***`%s`@\n" msg printed
printed
| Ok config -> (
let printed = Fmt.str "%a" Pp.config config in
match Parse.from_string printed with
| Error (`Msg msg) ->
Crowbar.failf "%s on the given input@\n***`%S`@\n***`%s`@\n" msg printed
printed
| Ok parsed -> Crowbar.check_eq ~pp:Pp.config config parsed ) )