Sha256: d8185024079779c60dd70ee75164d40c9e7cf8dc8501c596c7d4fb658bffde91

Contents?: true

Size: 927 Bytes

Versions: 8

Compression:

Stored size: 927 Bytes

Contents

open Core.Std

open Utils

type parameter =
  | String of string
  | Float of float
  | Int of int
  | Bool of bool
  | StringList of (string list)
  | IntStringMap of ((string * int) list) [@@deriving eq, show]

type 'a elements = (string * 'a) list [@@deriving eq, show]

type case = {
  description: string;
  parameters: parameter elements;
  expected: parameter;
} [@@deriving eq, show]

let surround (ch: char) (s: string): string =
  Char.to_string ch ^ s ^ Char.to_string ch

let parameter_to_string = function
  | String s -> String.escaped s
  | Float f -> Float.to_string f
  | Int n -> Int.to_string n
  | Bool b -> Bool.to_string b
  | StringList xs -> "[" ^ String.concat ~sep:"; " (List.map ~f:(surround '\"' >> String.escaped) xs) ^ "]"
  | IntStringMap xs -> "[" ^ String.concat ~sep:"; "
                         (List.map xs ~f:(fun (k,v) -> "(\"" ^ String.escaped k ^ "\", " ^ Int.to_string v ^ ")")) ^ "]"

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
trackler-2.0.3.2 tracks/ocaml/tools/test-generator/src/model.ml
trackler-2.0.3.1 tracks/ocaml/tools/test-generator/src/model.ml
trackler-2.0.3.0 tracks/ocaml/tools/test-generator/src/model.ml
trackler-2.0.2.0 tracks/ocaml/tools/test-generator/src/model.ml
trackler-2.0.1.2 tracks/ocaml/tools/test-generator/src/model.ml
trackler-2.0.1.1 tracks/ocaml/tools/test-generator/src/model.ml
trackler-2.0.1.0 tracks/ocaml/tools/test-generator/src/model.ml
trackler-2.0.0.10 tracks/ocaml/tools/test-generator/src/model.ml