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