Add defun without evaluation

This commit is contained in:
2022-11-03 09:46:23 -04:00
parent 37a614515e
commit ddb5a8f842
17 changed files with 291 additions and 129 deletions

View File

@@ -5,6 +5,7 @@
#include "uclisp.h"
#include "internal.h"
#include "utility.h"
#include "state.h"
#include "testing_helpers.h"
static struct ucl_object *input;
@@ -194,6 +195,38 @@ static void test_list_nth_bounds_2() {
TEST_ASSERT_OBJ_ERROR(response);
}
static void test_truthy_0() {
response = ucl_truthy(ucl_int_create(0));
TEST_ASSERT_NIL(response);
}
static void test_truthy_1() {
response = ucl_truthy(ucl_int_create(1));
TEST_ASSERT_T(response);
}
static void test_truthy_nil() {
response = ucl_truthy(ucl_nil_create());
TEST_ASSERT_NIL(response);
}
static void test_truthy_list_w_elem() {
struct ucl_object *list = ucl_nil_create();
ucl_list_append(list, ucl_int_create(0));
response = ucl_truthy(list);
TEST_ASSERT_T(response);
}
static void test_truthy_sym() {
response = ucl_truthy(ucl_symbol_create("t"));
TEST_ASSERT_T(response);
}
int main(void) {
UNITY_BEGIN();
@@ -221,6 +254,11 @@ int main(void) {
RUN_TEST(test_list_nth_bounds_0);
RUN_TEST(test_list_nth_bounds_1);
RUN_TEST(test_list_nth_bounds_2);
RUN_TEST(test_truthy_0);
RUN_TEST(test_truthy_1);
RUN_TEST(test_truthy_nil);
RUN_TEST(test_truthy_list_w_elem);
RUN_TEST(test_truthy_sym);
return UNITY_END();
}