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.58 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.57 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.56 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.55 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.54 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.53 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.52 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.51 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.50 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.49 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.48 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.47 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.46 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.45 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.44 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.43 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.42 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.41 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.40 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.39 tracks/ocaml/tools/test-generator/test/codegen_test.ml