33 lines
1.1 KiB
OCaml
33 lines
1.1 KiB
OCaml
|
|
open Vanity
|
||
|
|
|
||
|
|
let assert_true msg b =
|
||
|
|
if not b then failwith msg
|
||
|
|
|
||
|
|
let find_case name =
|
||
|
|
match List.find_opt (fun (case : Corpus.case) -> String.equal case.name name) Corpus.all with
|
||
|
|
| Some case -> case
|
||
|
|
| None -> failwith ("missing case " ^ name)
|
||
|
|
|
||
|
|
let () =
|
||
|
|
List.iter
|
||
|
|
(fun (case : Corpus.case) ->
|
||
|
|
assert_true
|
||
|
|
("ill-typed corpus case " ^ case.name)
|
||
|
|
(Typecheck.is_well_typed case.ty case.source))
|
||
|
|
Corpus.all;
|
||
|
|
let repr = Audit.audit_case (find_case "free-theorem-fails-after-unsafe-inlining") in
|
||
|
|
assert_true
|
||
|
|
"expected representation exposure witness"
|
||
|
|
(repr.failure_mode = Audit.Representation_exposure);
|
||
|
|
let strict = Audit.audit_case (find_case "strictness-induced-termination-change") in
|
||
|
|
assert_true
|
||
|
|
"expected strictness shift witness"
|
||
|
|
(strict.failure_mode = Audit.Strictness_shift);
|
||
|
|
let generated = Gen.sample_terms ~count:80 ~max_depth:4 () in
|
||
|
|
List.iter
|
||
|
|
(fun specimen ->
|
||
|
|
assert_true
|
||
|
|
("ill-typed generated specimen " ^ Source.string_of_term specimen.Gen.term)
|
||
|
|
(Typecheck.is_well_typed specimen.Gen.ty specimen.Gen.term))
|
||
|
|
generated
|