]> git.lizzy.rs Git - nothing.git/blob - test/builtins_suite.h
(#427) Fix svg2rects failure on newlines in labels
[nothing.git] / test / builtins_suite.h
1 #ifndef BUILTINS_SUITE_H_
2 #define BUILTINS_SUITE_H_
3
4 #include "test.h"
5 #include "script/gc.h"
6
7 TEST(lambda_p_test)
8 {
9     Gc *gc = create_gc();
10
11     ASSERT_TRUE(!lambda_p(NIL(gc)),
12                 "nil should not be lambda");
13     ASSERT_TRUE(!lambda_p(list(gc, 1, SYMBOL(gc, "lambda"))),
14                 "(lambda) should not be lambda");
15     ASSERT_TRUE(!lambda_p(list(gc, 2,
16                                 SYMBOL(gc, "lambda"),
17                                 list(gc, 1, NUMBER(gc, 1)))),
18                 "(lambda (1)) should not be lambda");
19     ASSERT_TRUE(lambda_p(list(gc, 2,
20                                  SYMBOL(gc, "lambda"),
21                                  list(gc, 1, SYMBOL(gc, "a")))),
22                 "(lambda (a)) should be lambda");
23     ASSERT_TRUE(lambda_p(list(gc, 3,
24                                 SYMBOL(gc, "lambda"),
25                                 list(gc, 1, SYMBOL(gc, "a")),
26                                 STRING(gc, "hello"))),
27                 "(lambda (a) \"hello\") should be lambda");
28
29     destroy_gc(gc);
30
31     return 0;
32 }
33
34 TEST_SUITE(builtins_suite)
35 {
36     TEST_RUN(lambda_p_test);
37
38     return 0;
39 }
40
41 #endif  // BUILTINS_SUITE_H_