1
0
Fork 0

test func "symbol?"

This commit is contained in:
Alex Kotov 2023-05-04 23:23:59 +04:00
parent 2e700fc239
commit eaac69c8a5
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

78
main.c
View file

@ -151,6 +151,7 @@ static void test_nullQN();
static void test_numberQN();
static void test_pairQN();
static void test_stringQN();
static void test_symbolQN();
// Logical operators
static void test_not();
@ -165,6 +166,7 @@ void test()
test_numberQN();
test_pairQN();
test_stringQN();
test_symbolQN();
// Logical operators
test_not();
@ -702,6 +704,82 @@ void test_stringQN()
))));
}
void test_symbolQN()
{
// (symbol? '())
// #f
assert(Object_is_false(eval(Object_build_list(
2,
Object_new_symbol("symbol?"),
NULL
))));
// (symbol? #t)
// #f
assert(Object_is_false(eval(Object_build_list(
2,
Object_new_symbol("symbol?"),
Object_new_boolean(true)
))));
// (symbol? #f)
// #f
assert(Object_is_false(eval(Object_build_list(
2,
Object_new_symbol("symbol?"),
Object_new_boolean(false)
))));
// (symbol? #\n)
// #f
assert(Object_is_false(eval(Object_build_list(
2,
Object_new_symbol("symbol?"),
Object_new_char('\n')
))));
// (symbol? 'foo)
// #t
assert(Object_is_true(eval(Object_build_list(
2,
Object_new_symbol("symbol?"),
Object_build_list(
2,
Object_new_symbol("quote"),
Object_new_symbol("foo")
)
))));
// (symbol? "foo")
// #f
assert(Object_is_false(eval(Object_build_list(
2,
Object_new_symbol("symbol?"),
Object_new_string("foo")
))));
// (symbol? 123)
// #f
assert(Object_is_false(eval(Object_build_list(
2,
Object_new_symbol("symbol?"),
Object_new_number(123)
))));
// (symbol? (cons 123 456))
// #f
assert(Object_is_false(eval(Object_build_list(
2,
Object_new_symbol("symbol?"),
Object_build_list(
3,
Object_new_symbol("cons"),
Object_new_number(123),
Object_new_number(456)
)
))));
}
void test_not()
{
// (not '())