#endif // typecheck
char* fs = unquote(fst)->value.str;
char* ss = unquote(snd)->value.str;
- char* out = malloc(sizeof(char)*(strlen(fs)+strlen(ss)));
+ char* out = malloc(sizeof(char)*(strlen(fs)+strlen(ss)+1));
strcpy(out, fs);
strcat(out, ss);
sexpr_free(snd);
}
+void diagnose_strcat() {
+ Sexpr* env = init_dict();
+ env = load_env(env);
+ assert_eq(env, "strcat \"hell\" \"o\"", "\"hello\"");
+ sexpr_free(env);
+}
+
void many_asserts() {
Sexpr* env = init_dict();
env = load_env(env);
assert_eq(env, "strexpand \"test\"", "list \"t\" \"e\" \"s\" \"t\"");
assert_eq(env, "substr \"oo\" \"looopy", "list 2 3");
assert_eq(env, "strtok \" /\" \"this is/a test\"", "list \"this\" \"is\" \"a\" \"test\"");
+ assert_eq(env, "strlen \"hey\"", "3");
+ assert_eq(env, "strcat \"hey \" \"there\"", "\"hey there\"");
printf("meta\n");
assert_eq(env, "utob 512", "+");
//test_string_parsing();
//eval_tests();
many_asserts();
+ //diagnose_strcat();
//memtest_eval();
//mem_testing();
//mem_parser();