You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.1 KiB
59 lines
1.1 KiB
#include <libse.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <internal/exstring.h>
|
|
|
|
void test_exs()
|
|
{
|
|
exString *test= exs_new(NULL);
|
|
|
|
printf("New success\n");
|
|
|
|
exs_append(test, "Hello");
|
|
exs_append(test, " world.");
|
|
|
|
exs_append(test, " Test, ");
|
|
exs_append(test, "two, three. FOUR FIVE.");
|
|
|
|
exs_reduce(test, 5);
|
|
|
|
EXS(test)[strlen(EXS(test))-5] = 0;
|
|
|
|
exs_recalc(test);
|
|
|
|
exs_append(test, " Scream: ");
|
|
|
|
exs_appendtimes(test, 'A', 6);
|
|
|
|
exs_appendf(test, "\nCurrent size: %d -> %d", strlen(EXS(test)), exs_realsize(test));
|
|
exs_appendf(test, "AOISDJOAIJS%s", "sokdok");
|
|
|
|
printf("%s\n", EXS(test));
|
|
|
|
printf("strlen() %d, ->currentSize %d\n", strlen(EXS(test)), exs_realsize(test));
|
|
|
|
exs_free(test);
|
|
}
|
|
|
|
void test_parse()
|
|
{
|
|
const char* parse = "hello (there (firend) (i) (love (you a lot))) how are (you (doing today?))";
|
|
list_t* list = se_parse(parse);
|
|
|
|
printf("Parse okay\n");
|
|
|
|
se_print(NULL, list);
|
|
printf("\n");
|
|
// printf("(car list) -> %s\n", (char*)list->ptr);
|
|
// printf("(cadr list) -> %s\n", (list->cdr?(char*)list->cdr->ptr:"nil"));
|
|
|
|
se_free(list);
|
|
}
|
|
|
|
int main()
|
|
{
|
|
// test_exs();
|
|
test_parse();
|
|
return 0;
|
|
}
|