aboutsummaryrefslogtreecommitdiff
path: root/lib/fixture.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fixture.ml')
-rw-r--r--lib/fixture.ml6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/fixture.ml b/lib/fixture.ml
index 2b17a02..d5c77fa 100644
--- a/lib/fixture.ml
+++ b/lib/fixture.ml
@@ -25,9 +25,10 @@ let%test "random_name" = List.mem (random_name ()) names
type t =
| Name of string
| Uuidv4 of string
- | Foreign of (string * string list)
+ | Foreign of string * string list
| Int of string * int * int
| Const of string * string
+ | List of string * string list
(* (Name, foreign ids to pick from) *)
let add_name name fixtures = Name name :: fixtures
@@ -48,6 +49,7 @@ let generate_fixture fixture =
| Foreign (_, reference) -> random_value_in_list reference
| Const (_, value) -> value
| Int (_, min, max) -> Random.int (max - min) + min |> string_of_int
+ | List (_, values) -> random_value_in_list values
let%test "generate_uuid" =
@@ -61,10 +63,10 @@ let id_of_fixture fixture =
| Foreign (id, _) -> id
| Const (id, _) -> id
| Int (id, _, _) -> id
+ | List (id, _) -> id
(* TODO: Support email *)
-(* TODO: Support list *)
let rec replicate element n =
match n with