From 79c4a21c91544d0d63f489da911a6dc0c50bffa4 Mon Sep 17 00:00:00 2001 From: jpoly1219 Date: Mon, 19 Feb 2024 16:47:07 -0500 Subject: [PATCH] add snehole tests --- test/Test_syn.re | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/Test_syn.re b/test/Test_syn.re index 012ad3f..25b0db3 100644 --- a/test/Test_syn.re +++ b/test/Test_syn.re @@ -106,6 +106,22 @@ let test_shole_2 = () => { check(htyp_typ, "same option(Hazelnut.Htyp.t)", given, expected); }; +let test_snehole_1 = () => { + let ctx: typctx = TypCtx.empty; + let he: Hazelnut.Hexp.t = NEHole(EHole); + let given: option(Hazelnut.Htyp.t) = Hazelnut.syn(ctx, he); + let expected: option(Hazelnut.Htyp.t) = Some(Hazelnut.Htyp.Hole); + check(htyp_typ, "same option(Hazelnut.Htyp.t)", given, expected); +}; + +let test_snehole_2 = () => { + let ctx: typctx = TypCtx.singleton("incr", Hazelnut.Htyp.Arrow(Num, Num)); + let he: Hazelnut.Hexp.t = NEHole(Asc(Ap(Var("incr"), Lit(1)), Num)); + let given: option(Hazelnut.Htyp.t) = Hazelnut.syn(ctx, he); + let expected: option(Hazelnut.Htyp.t) = Some(Hazelnut.Htyp.Hole); + check(htyp_typ, "same option(Hazelnut.Htyp.t)", given, expected); +}; + let syn_tests = [ ("test_sasc_1", `Quick, test_sasc_1), ("test_sasc_2", `Quick, test_sasc_2), @@ -119,4 +135,6 @@ let syn_tests = [ ("test_splus_2", `Quick, test_splus_2), ("test_shole_1", `Quick, test_shole_1), ("test_shole_2", `Quick, test_shole_2), + ("test_snehole_1", `Quick, test_snehole_1), + ("test_snehole_2", `Quick, test_snehole_2), ];