diff options
Diffstat (limited to '')
-rw-r--r-- | lib/fixture.ml | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/fixture.ml b/lib/fixture.ml index 189d2fb..8806692 100644 --- a/lib/fixture.ml +++ b/lib/fixture.ml @@ -22,12 +22,13 @@ let names = let random_name () = List.nth names (Random.int (List.length names)) let%test "random_name" = List.mem (random_name ()) names -(* Support arbitrary amount *) -(* Support names *) +(* TODO: Support arbitrary amount *) +(* TODO: Support names *) type t = | Name of string | Uuidv4 of string | Foreign of (string * string list) + | Int of string * int * int (* (Name, foreign ids to pick from) *) let add_name name fixtures = Name name :: fixtures @@ -46,6 +47,7 @@ let generate_fixture fixture = | Name _ -> random_name () | Uuidv4 _ -> Uuidm.v `V4 |> Uuidm.to_string | Foreign (_, reference) -> random_value_in_list reference + | Int (_, min, max) -> Random.int (max - min) + min |> string_of_int let%test "generate_uuid" = @@ -57,6 +59,7 @@ let id_of_fixture fixture = | Name id -> id | Uuidv4 id -> id | Foreign (id, _) -> id + | Int (id, _, _) -> id let rec replicate element n = |