Skip to content

Commit 96e82bd

Browse files
committed
correct typo
add arbitrary_uint128 function for ipv6
1 parent f7ee4d7 commit 96e82bd

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

quickcheck/Arbitrary_Base.ml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
open QuickCheck
22
module Gen = QuickCheck_gen
33

4+
type int128 = int64 * int64
5+
46
(* arbitrary instance for usigned integers, using `int` type. *)
57
let arbitrary_uint = Gen.sized (fun n -> Gen.choose_int (0, n))
68

@@ -42,7 +44,7 @@ let arbitrary_uint48 =
4244
let lo = of_int c in
4345
ret_gen Int64.(logor (logor hi mid) lo)
4446

45-
(* arbitrary instance for unsigned int48, using the `int64` type. *)
47+
(* arbitrary instance for unsigned int68, using the `int64` type. *)
4648
let arbitrary_uint64 =
4749
let open Gen in
4850
arbitrary_uint16 >>= fun a ->
@@ -56,6 +58,13 @@ let arbitrary_uint64 =
5658
let lo = of_int d in
5759
ret_gen Int64.(logor (logor hi (logor mid1 mid2)) lo)
5860

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+
5968

6069
(* arbitrary instance for option type, favoring `Some` rather than `None` *)
6170
let arbitrary_option arb =

quickcheck/Arbitrary_Base.mli

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
open QuickCheck
22

3+
type int128 = int64 * int64
4+
35
(* arbitrary instance for usigned integers. Still uses the `int` type. *)
46
val arbitrary_uint : int arbitrary
57

@@ -27,5 +29,8 @@ val arbitrary_uint48 : int64 arbitrary
2729
(* arbitrary instance for unsigned int64, using the `int64` type. *)
2830
val arbitrary_uint64 : int64 arbitrary
2931

32+
(* arbitrary instance for unsigned int64, using the `int64` type. *)
33+
val arbitrary_uint128 : int128 arbitrary
34+
3035
(* arbitrary instance for option type, favoring `Some` rather than `None` *)
3136
val arbitrary_option : 'a arbitrary -> 'a option arbitrary

0 commit comments

Comments
 (0)