2019-05-13 00:56:22 +04:00
|
|
|
(* -*- compile-command: "cd .. ; dune runtest" -*- *)
|
|
|
|
|
2019-06-05 10:43:33 +04:00
|
|
|
open Test_helpers
|
|
|
|
|
|
|
|
let rec test_height : test -> int = fun t ->
|
|
|
|
match t with
|
|
|
|
| Test _ -> 1
|
|
|
|
| Test_suite (_ , lst) -> (List.fold_left max 1 @@ List.map test_height lst) + 1
|
|
|
|
|
|
|
|
let extract_test : test -> test_case = fun t ->
|
|
|
|
match t with
|
|
|
|
| Test tc -> tc
|
|
|
|
| _ -> assert false
|
|
|
|
|
|
|
|
let extract_param : test -> (string * (string * test_case list) list) =
|
|
|
|
let extract_element = extract_test in
|
|
|
|
let extract_group : test -> (string * test_case list) = fun t ->
|
|
|
|
match t with
|
|
|
|
| Test tc -> ("isolated" , [ tc ])
|
|
|
|
| Test_suite (name , lst) -> (name , List.map extract_element lst) in
|
|
|
|
fun t ->
|
|
|
|
match t with
|
|
|
|
| Test tc -> ("" , [ ("isolated" , [ tc ] ) ])
|
|
|
|
| Test_suite (name , lst) -> (name , List.map extract_group lst)
|
|
|
|
|
|
|
|
let x : _ -> (unit Alcotest.test) = fun x -> x
|
|
|
|
|
|
|
|
(*
|
|
|
|
Alcotest.run parameters:
|
|
|
|
string * (string * f list) list
|
|
|
|
*)
|
|
|
|
|
|
|
|
let rec run_test ?(prefix = "") : test -> unit = fun t ->
|
|
|
|
match t with
|
|
|
|
| Test case -> Alcotest.run "isolated test" [ ("" , [ case ]) ]
|
|
|
|
| Test_suite (name , lst) -> (
|
|
|
|
if (test_height t <= 3) then (
|
|
|
|
let (name , tests) = extract_param t in
|
|
|
|
Alcotest.run (prefix ^ name) tests
|
|
|
|
) else (
|
|
|
|
List.iter (run_test ~prefix:(prefix ^ name ^ "_")) lst
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2019-05-13 00:56:22 +04:00
|
|
|
let () =
|
|
|
|
(* Printexc.record_backtrace true ; *)
|
2019-06-05 10:43:33 +04:00
|
|
|
run_test @@ test_suite "LIGO" [
|
2019-05-13 00:56:22 +04:00
|
|
|
Integration_tests.main ;
|
|
|
|
Compiler_tests.main ;
|
|
|
|
Transpiler_tests.main ;
|
|
|
|
Typer_tests.main ;
|
|
|
|
Heap_tests.main ;
|
|
|
|
Coase_tests.main ;
|
|
|
|
Bin_tests.main ;
|
|
|
|
] ;
|
|
|
|
()
|