Make it easier to integrate test scripts
This commit is contained in:
+24
-17
@@ -95,6 +95,24 @@
|
||||
} \
|
||||
} \
|
||||
|
||||
#define invoke_test_script(name) \
|
||||
printf("" name ":"); \
|
||||
if (test_file("tests/" name ".slime") == pass) { \
|
||||
for(size_t i = strlen(name); i < 70; ++i) \
|
||||
printf((i%3==1)? "." : " "); \
|
||||
printf("%spassed%s\n", console_green, console_normal); \
|
||||
} \
|
||||
else { \
|
||||
result = false; \
|
||||
for(int i = -1; i < 70; ++i) \
|
||||
printf((i%3==1)? "." : " "); \
|
||||
printf("%sfailed%s\n", console_red, console_normal); \
|
||||
if(error) { \
|
||||
free(error); \
|
||||
error = nullptr; \
|
||||
} \
|
||||
}
|
||||
|
||||
proc test_eval_operands() -> testresult {
|
||||
char operands_string[] = "((eval 1) (+ 1 2) \"okay\" (eval :haha))";
|
||||
Lisp_Object* operands = Parser::parse_single_expression(operands_string);
|
||||
@@ -460,26 +478,14 @@ proc test_singular_t_and_nil() -> testresult {
|
||||
return pass;
|
||||
}
|
||||
|
||||
proc test_class_macro() -> testresult {
|
||||
proc test_file(char* file) -> testresult {
|
||||
Memory::reset();
|
||||
Environment* env = Memory::create_built_ins_environment();
|
||||
|
||||
Parser::init(env);
|
||||
|
||||
built_in_load(Memory::create_string("pre.slime"), env);
|
||||
Lisp_Object* result = built_in_load(Memory::create_string("tests/class_macro.slime"), env);
|
||||
|
||||
assert_no_error();
|
||||
|
||||
return pass;
|
||||
}
|
||||
|
||||
proc test_lexical_scope() -> testresult {
|
||||
Memory::reset();
|
||||
Environment* env = Memory::create_built_ins_environment();
|
||||
Parser::init(env);
|
||||
|
||||
built_in_load(Memory::create_string("pre.slime"), env);
|
||||
Lisp_Object* result = built_in_load(Memory::create_string("tests/lexical_scope.slime"), env);
|
||||
Lisp_Object* result = built_in_load(Memory::create_string(file), env);
|
||||
|
||||
assert_no_error();
|
||||
return pass;
|
||||
@@ -521,8 +527,9 @@ proc run_all_tests() -> bool {
|
||||
printf("\n-- Macros --\n");
|
||||
|
||||
printf("\n-- Test Files --\n");
|
||||
invoke_test(test_class_macro);
|
||||
invoke_test(test_lexical_scope);
|
||||
|
||||
invoke_test_script("lexical_scope");
|
||||
invoke_test_script("class_macro");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -13,14 +13,3 @@
|
||||
;; should output 6
|
||||
;; outputs 0
|
||||
#+END_SRC
|
||||
* SSO
|
||||
|
||||
#+begin_src c
|
||||
Symbol* symbol; // { String* identifier }
|
||||
Keyword* keyword; // { String* identifier }
|
||||
Number* number; // { double value }
|
||||
String* string; // has to stay a pointer
|
||||
Pair* pair; // { Lisp_Object* first; Lisp_Object* rest }
|
||||
Function* function; //
|
||||
cFunction* cFunction; // has to stay a pointer
|
||||
#+end_src
|
||||
|
||||
Reference in New Issue
Block a user