aboutsummaryrefslogtreecommitdiff
path: root/lib/fixture.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fixture.ml')
-rw-r--r--lib/fixture.ml10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/fixture.ml b/lib/fixture.ml
index dbd6297..18e2ff6 100644
--- a/lib/fixture.ml
+++ b/lib/fixture.ml
@@ -67,8 +67,8 @@ let show_compiled_csv fixture =
| Float f -> string_of_float f
-let random_email () =
- random_value_in_list email_handles ^ "@" ^ random_value_in_list email_hosts
+let random_email index () =
+ random_value_in_list email_handles ^ index ^ "@" ^ random_value_in_list email_hosts
let random_name () = List.nth names (Random.int (List.length names))
@@ -102,13 +102,14 @@ type t =
(* (Name, foreign ids to pick from) *)
let generate_fixture index fixture =
+ let str_index = string_of_int index in
match fixture with
- | Name _ -> String (random_name ())
+ | Name _ -> String (random_name () ^ str_index)
| Uuidv4 _ -> String (Uuidm.v `V4 |> Uuidm.to_string)
| Foreign (_, reference) -> random_value_in_list reference
| Increment _ -> Int (index + 1)
| Const (_, value) -> String value
- | Email _ -> String (random_email ())
+ | Email _ -> String (random_email str_index ())
| Int (_, min, max) -> Int (Random.int (max - min) + min)
| List (_, values) -> String (random_value_in_list values)
@@ -123,7 +124,6 @@ let%test "random_value_in_list" =
List.mem result values
-(* TODO: Support email *)
(* TODO: Support "hashed" password *)
(* TODO: Support dates *)
(* TODO: Support variables using @ *)