StringBuilder rewrote

This commit is contained in:
2022-04-20 19:25:19 +03:00
parent 2434a126da
commit 0309f0a3d0
9 changed files with 138 additions and 76 deletions

View File

@@ -5,12 +5,10 @@ void test_string(){
optime(__func__,1,({
printf("\e[96m-------------[test_string]-------------\n");
char c[]="0123456789abcdef";
string s=string_cpFromCharPtr(c);
printf("\e[92m\"%s\" \e[94m-> string_cpFromCharPtr()\n",c);
if(s.length!=16) throw("string created with incorrect length");
char* p=string_cpToCptr(s);
printf("\e[94mstring_cpToCptr() -> \e[92m\"%s\"\n",p);
string s={.ptr=c, .length=cptr_length(c)};
if(s.length!=sizeof(c)-1) throw("string created with incorrect length");
char* p=string_extract(s);
printf("\e[94mstring_extract() -> \e[92m\"%s\"\n",p);
free(p);
free(s.ptr);
}));
}