Sha256: b198ecb88037186598701b7b0c0650d5294ba6313df8801cbae7d20eb79ed380

Contents?: true

Size: 924 Bytes

Versions: 159

Compression:

Stored size: 924 Bytes

Contents

open Core
open OUnit2
open Codegen
open Model
open Yojson.Basic

let leap_template = "\"$description\" >:: ae $expected (leap_year $input);"

let edit_parameters (j: (string * json) list): (string * string) list = 
    List.map ~f:(fun (k,v) -> (k,to_string v)) j
let assert_fill_in_template exp cases = assert_equal exp
    ~printer:(fun xs -> "[" ^ (String.concat ~sep:";" xs) ^ "]")
    (fill_in_template edit_parameters leap_template "suite-name" cases |> List.map ~f:subst_to_string)
let ae exp cases _test_ctxt = assert_fill_in_template exp cases

let codegen_tests = [
  "if there are no cases then generate an empty string" >::
  ae [] [];

  "generates one function based on leap year for one case" >::(fun ctxt ->
      let c = {description = "leap_year"; parameters = [("input", `Int 1996); ("expected", `Bool true)];} in
      assert_fill_in_template ["\"leap_year\" >:: ae true (leap_year 1996);"] [c]
    );
]

Version data entries

159 entries across 159 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.179 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.178 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.177 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.176 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.175 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.174 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.173 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.172 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.171 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.170 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.169 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.167 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.166 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.165 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.164 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.163 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.162 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.161 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.160 tracks/ocaml/tools/test-generator/test/codegen_test.ml