-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
open QCheck2 | ||
open Helpers | ||
|
||
(* Here we check that deriving qcheck2 works in signature, and cover the cases | ||
where the type is named "t" and when it is not. *) | ||
|
||
module T : sig | ||
type t = int [@@deriving_inline qcheck2] | ||
include sig | ||
[@@@ocaml.warning "-32"] | ||
val gen : t QCheck2.Gen.t | ||
end | ||
[@@ocaml.doc "@inline"] | ||
[@@@deriving.end] | ||
|
||
type string' = string [@@deriving_inline qcheck2] | ||
include sig | ||
[@@@ocaml.warning "-32"] | ||
val gen_string' : string' QCheck2.Gen.t | ||
end | ||
[@@ocaml.doc "@inline"] | ||
[@@@deriving.end] | ||
end = struct | ||
type t = int [@@deriving qcheck2] | ||
|
||
type string' = string [@@deriving qcheck2] | ||
end | ||
|
||
let test_int () = | ||
test_compare ~msg:"Gen.int <=> deriving int" ~eq:Alcotest.int Gen.int T.gen | ||
|
||
let test_string () = | ||
test_compare ~msg:"Gen.string <=> deriving string" ~eq:Alcotest.string Gen.string T.gen_string' | ||
|
||
(** {2. Execute tests} *) | ||
|
||
let () = Alcotest.run "Test_Primitives" | ||
[("Primitives", | ||
Alcotest.[ | ||
test_case "test_int" `Quick test_int; | ||
test_case "test_unit" `Quick test_string; | ||
])] |