aboutsummaryrefslogtreecommitdiff
path: root/lib/fixture.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fixture.ml')
-rw-r--r--lib/fixture.ml5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/fixture.ml b/lib/fixture.ml
index 25f6a8f..2b17a02 100644
--- a/lib/fixture.ml
+++ b/lib/fixture.ml
@@ -22,12 +22,12 @@ let names =
let random_name () = List.nth names (Random.int (List.length names))
let%test "random_name" = List.mem (random_name ()) names
-(* TODO: Support names *)
type t =
| Name of string
| Uuidv4 of string
| Foreign of (string * string list)
| Int of string * int * int
+ | Const of string * string
(* (Name, foreign ids to pick from) *)
let add_name name fixtures = Name name :: fixtures
@@ -46,6 +46,7 @@ let generate_fixture fixture =
| Name _ -> random_name ()
| Uuidv4 _ -> Uuidm.v `V4 |> Uuidm.to_string
| Foreign (_, reference) -> random_value_in_list reference
+ | Const (_, value) -> value
| Int (_, min, max) -> Random.int (max - min) + min |> string_of_int
@@ -58,10 +59,10 @@ let id_of_fixture fixture =
| Name id -> id
| Uuidv4 id -> id
| Foreign (id, _) -> id
+ | Const (id, _) -> id
| Int (id, _, _) -> id
-(* TODO: Support const *)
(* TODO: Support email *)
(* TODO: Support list *)