summaryrefslogtreecommitdiff
path: root/tiger-compiler/tests/unit/parse/tiger_factory/test_make_call_exp.cc
blob: 5c4b9bb38060408d8599436299a218dfcad33952 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <ast/exp.hh>
#include <ast/libast.hh>
#include <criterion/criterion.h>
#include <criterion/assert.h>
#include <parse/libparse.hh>
#include <ast/fwd.hh>
#include <ast/pretty-printer.hh>

TestSuite(BasicCall);

Test(BasicCall, SimpleCall)
{
    std::cout << "----- FunCall -----";
    ast::PrettyPrinter print(std::cout);
    ast::Exp* test = parse::parse("let "
                                  " function test(a : int, b : string) : int = "
                                  " a "
                                  " in "
                                  " test(1, \"2M, 22H->H, f.L, RS, RC, 55M, 632146M\") "
                                  " end \n");
    cr_assert_not_null(test);
    print(test);
    cr_assert_eq(1, 1);
}

TestSuite(RealisticCall);

Test(RealisticCall, Call_WExprs)
{
    ast::PrettyPrinter print(std::cout);
    // If someone get this and sends me a video proof, you have my utmost respect (the sequence in itself is not that hard tbh)
    ast::Exp* test = parse::parse("let "
                                  " function test(a : int, b : string) : int = "
                                  " a "
                                  " in "
                                  " test(1 + 2 + c + inexistant, \"2M, 22H->H, f.L, RS, RC, 55M, 632146M\")"
                                  " end \n");
    cr_assert_not_null(test);
    print(test);
    cr_assert_eq(1, 1);
}