meta: re-organise tests
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#include <fx/core/stringstream.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("-------------\n");
|
||||
fx_string *str = fx_string_create_from_cstr("Hello, world!\n");
|
||||
printf("%s\n", fx_string_get_cstr(str));
|
||||
printf("len:%zu, max:%zu\n", fx_string_get_size(str, FX_STRLEN_NORMAL),
|
||||
fx_string_get_capacity(str));
|
||||
|
||||
fx_string_insert_cstr(str, "WOW!", 4);
|
||||
|
||||
printf("-------------\n");
|
||||
printf("%s\n", fx_string_get_cstr(str));
|
||||
printf("len:%zu, max:%zu\n", fx_string_get_size(str, FX_STRLEN_NORMAL),
|
||||
fx_string_get_capacity(str));
|
||||
|
||||
fx_string_replace(str, 4, 4, "+");
|
||||
|
||||
printf("-------------\n");
|
||||
printf("%s\n", fx_string_get_cstr(str));
|
||||
printf("len:%zu, max:%zu\n", fx_string_get_size(str, FX_STRLEN_NORMAL),
|
||||
fx_string_get_capacity(str));
|
||||
printf("-------------\n");
|
||||
|
||||
fx_string_unref(str);
|
||||
|
||||
fx_stringstream *strv = fx_stringstream_create();
|
||||
fx_stream_write_cstr(strv, "Hello", NULL);
|
||||
fx_stream_write_cstr(strv, ", world", NULL);
|
||||
fx_stream_write_cstr(strv, "!", NULL);
|
||||
|
||||
char *s = fx_stringstream_steal(strv);
|
||||
fx_stringstream_unref(strv);
|
||||
|
||||
printf("%s\n", s);
|
||||
free(s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user