test func "symbol?"
This commit is contained in:
parent
2e700fc239
commit
eaac69c8a5
1 changed files with 78 additions and 0 deletions
78
main.c
78
main.c
|
@ -151,6 +151,7 @@ static void test_nullQN();
|
||||||
static void test_numberQN();
|
static void test_numberQN();
|
||||||
static void test_pairQN();
|
static void test_pairQN();
|
||||||
static void test_stringQN();
|
static void test_stringQN();
|
||||||
|
static void test_symbolQN();
|
||||||
// Logical operators
|
// Logical operators
|
||||||
static void test_not();
|
static void test_not();
|
||||||
|
|
||||||
|
@ -165,6 +166,7 @@ void test()
|
||||||
test_numberQN();
|
test_numberQN();
|
||||||
test_pairQN();
|
test_pairQN();
|
||||||
test_stringQN();
|
test_stringQN();
|
||||||
|
test_symbolQN();
|
||||||
// Logical operators
|
// Logical operators
|
||||||
test_not();
|
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()
|
void test_not()
|
||||||
{
|
{
|
||||||
// (not '())
|
// (not '())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue