Skip to content

Commit 97b030a

Browse files
committed
update tests
1 parent 14d4c3c commit 97b030a

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

example/QCheck_test.ml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
let (|>) x f = f x
2+
13
let passing =
24
QCheck.Test.make ~count:1000 ~long_factor:2
35
~name:"list_rev_is_involutive"
@@ -6,18 +8,36 @@ let passing =
68

79
let failing =
810
QCheck.Test.make ~count:10
9-
~name:"fail_sort_id"
10-
QCheck.(list small_int)
11+
~name:"should_fail_sort_id"
12+
QCheck.(small_list small_int)
1113
(fun l -> l = List.sort compare l);;
1214

1315
exception Error
1416

1517
let error =
1618
QCheck.Test.make ~count:10
17-
~name:"error_raise_exn"
19+
~name:"should_error_raise_exn"
1820
QCheck.int
1921
(fun _ -> raise Error)
2022

23+
open OUnit
24+
25+
let regression_23 =
26+
"issue_23" >::
27+
(fun () ->
28+
let l = QCheck.Gen.(generate ~n:100_000 char) in
29+
OUnit.assert_bool "must contain '\255'"
30+
(List.exists (fun c->c = '\255') l)
31+
)
32+
33+
let regressions = [ regression_23 ]
34+
let others =
35+
[passing; failing; error]
36+
|> List.map (fun t -> QCheck_runner.to_ounit_test t)
37+
38+
let suite =
39+
"tests" >::: (regressions @ others)
40+
2141
let () =
22-
QCheck_runner.run_tests_main [passing; failing; error]
42+
exit (QCheck_runner.run suite)
2343

0 commit comments

Comments
 (0)