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.139 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.138 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.137 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.136 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.135 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.134 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.133 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.132 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.131 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.130 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.129 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.128 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.127 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.126 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.125 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.124 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.123 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.122 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.121 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.120 tracks/ocaml/tools/test-generator/test/codegen_test.ml