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.98 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.97 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.96 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.95 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.94 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.93 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.92 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.91 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.90 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.89 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.88 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.87 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.86 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.85 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.84 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.83 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.82 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.81 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.80 tracks/ocaml/tools/test-generator/test/codegen_test.ml
trackler-2.2.1.79 tracks/ocaml/tools/test-generator/test/codegen_test.ml