Skip to content

Commit af77f37

Browse files
committed
feat(testlib): allow ?long arg
1 parent 8b75175 commit af77f37

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/testlib/containers_testlib.ml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module Test = struct
4444

4545
[@@@endif]
4646

47-
let run ~seed (self : t) : _ result =
47+
let run ?(long = false) ~seed (self : t) : _ result =
4848
match
4949
let what = CCOption.map_or ~default:"" (fun s -> s ^ " ") self.name in
5050
match self.run with
@@ -113,7 +113,7 @@ module Test = struct
113113
in
114114

115115
(* TODO: if verbose, print stats, etc. *)
116-
let res = Q.Test.check_cell ~rand cell in
116+
let res = Q.Test.check_cell ~long ~rand cell in
117117

118118
(match get_state res with
119119
| QCheck.TestResult.Success -> Ok ()
@@ -229,7 +229,12 @@ let make ~__FILE__ () : (module S) =
229229

230230
let getenv_opt s = try Some (Sys.getenv s) with _ -> None
231231

232-
let run_all ?seed:seed_hex ~descr (l : Test.t list list) : unit =
232+
let long =
233+
match getenv_opt "LONG" with
234+
| Some ("true" | "1") -> true
235+
| _ -> false
236+
237+
let run_all ?seed:seed_hex ?(long = long) ~descr (l : Test.t list list) : unit =
233238
let start = Unix.gettimeofday () in
234239

235240
(* generate or parse seed *)
@@ -264,7 +269,7 @@ let run_all ?seed:seed_hex ~descr (l : Test.t list list) : unit =
264269
NOTE: we probably want this to be silent?
265270
Format.printf "> run %s@." (Test.str_loc t);
266271
*)
267-
match Test.run ~seed t with
272+
match Test.run ~long ~seed t with
268273
| Ok () -> ()
269274
| Error msg ->
270275
Format.printf "FAILED: %s@." (Test.str_loc t);

src/testlib/containers_testlib.mli

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ module type S = sig
3232
end
3333

3434
val make : __FILE__:string -> unit -> (module S)
35-
val run_all : ?seed:string -> descr:string -> Test.t list list -> unit
35+
36+
val run_all :
37+
?seed:string -> ?long:bool -> descr:string -> Test.t list list -> unit

0 commit comments

Comments
 (0)