File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1
1
open QuickCheck
2
2
module Gen = QuickCheck_gen
3
3
4
+ type int128 = int64 * int64
5
+
4
6
(* arbitrary instance for usigned integers, using `int` type. *)
5
7
let arbitrary_uint = Gen. sized (fun n -> Gen. choose_int (0 , n))
6
8
@@ -42,7 +44,7 @@ let arbitrary_uint48 =
42
44
let lo = of_int c in
43
45
ret_gen Int64. (logor (logor hi mid) lo)
44
46
45
- (* arbitrary instance for unsigned int48 , using the `int64` type. *)
47
+ (* arbitrary instance for unsigned int68 , using the `int64` type. *)
46
48
let arbitrary_uint64 =
47
49
let open Gen in
48
50
arbitrary_uint16 >> = fun a ->
@@ -56,6 +58,13 @@ let arbitrary_uint64 =
56
58
let lo = of_int d in
57
59
ret_gen Int64. (logor (logor hi (logor mid1 mid2)) lo)
58
60
61
+ (* arbitrary instance for unsigned int128, using the `int64` type. *)
62
+ let arbitrary_uint128 =
63
+ let open Gen in
64
+ arbitrary_uint64 >> = fun a ->
65
+ arbitrary_uint64 >> = fun b ->
66
+ ret_gen (a,b)
67
+
59
68
60
69
(* arbitrary instance for option type, favoring `Some` rather than `None` *)
61
70
let arbitrary_option arb =
Original file line number Diff line number Diff line change 1
1
open QuickCheck
2
2
3
+ type int128 = int64 * int64
4
+
3
5
(* arbitrary instance for usigned integers. Still uses the `int` type. *)
4
6
val arbitrary_uint : int arbitrary
5
7
@@ -27,5 +29,8 @@ val arbitrary_uint48 : int64 arbitrary
27
29
(* arbitrary instance for unsigned int64, using the `int64` type. *)
28
30
val arbitrary_uint64 : int64 arbitrary
29
31
32
+ (* arbitrary instance for unsigned int64, using the `int64` type. *)
33
+ val arbitrary_uint128 : int128 arbitrary
34
+
30
35
(* arbitrary instance for option type, favoring `Some` rather than `None` *)
31
36
val arbitrary_option : 'a arbitrary -> 'a option arbitrary
You can’t perform that action at this time.
0 commit comments