From 2a664a47c73e232b6ff0d261833e2561d4abc4d0 Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Tue, 26 Dec 2023 10:46:11 -0600 Subject: Support list --- lib/fixture.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/fixture.ml') 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 -- cgit v1.2.3