fixed a lot of broken stuff

This commit is contained in:
2022-08-26 01:45:02 +06:00
parent d62405ccff
commit b627affbde
22 changed files with 380 additions and 238 deletions

View File

@@ -13,6 +13,9 @@ void test_all(){
int main(){
setlocale(LC_ALL, "en-US.Unicode");
kerepTypeDescriptors_beginInit();
kerepTypeDescriptors_initKerepTypes();
kerepTypeDescriptors_endInit();
printf("\e[92mkerep tests are starting!\e[97m\n");
optime("test_all",1,test_all());
printf("\e[0m\n");

View File

@@ -47,7 +47,7 @@ void test_autoarr(){
resetar(ar);
printf("\e[92mautoarr values reset\n");
printallval(ar);
Autoarr_free(ar);
Autoarr_free(ar, true);
printf("\e[92mautoarr deleted\n");
}));
}

View File

@@ -18,7 +18,7 @@ void print_dtsod(Hashtable* dtsod){
printf("\e[92m");
Hashtable_foreach(dtsod, p,({
printkvp(p);
if(p.value.type==HashtablePtr){
if(p.value.typeId==kerepTypeId_HashtablePtr){
printf(": {\n");
Hashtable* sub=p.value.VoidPtr;
Hashtable_foreach(sub, _p,({

View File

@@ -33,7 +33,7 @@ char data[]="iojihiojopijiugbjmoihftytryfdrh";
}\
printf("\e[93m%u \e[94mcollisions detected in %u hashes\n", collisions, COLLISION_TESTS);\
}));\
Autoarr_free(hashes);\
Autoarr_free(hashes, true);\
printf("\e[96m--------------------------------------\n");\
})

View File

@@ -4,7 +4,7 @@ EXPORT void CALL test_marshalling(char* text, KVPair** kptr){
KVPair* k=malloc(sizeof(KVPair));
k->key="message";
char* tc=cptr_copy(text);
Unitype u={.VoidPtr=tc, .type=CharPtr};
Unitype u=UniPtrHeap(kerepTypeId_CharPtr,tc);
k->value=u;
*kptr=k;
}

View File

@@ -27,27 +27,27 @@ void test_searchtree(){
STNode* node=STNode_create();
printf("\e[92mnode created\n");
printf("push:\e[94m\n ");
Unitype u={.type=Int64,.Int64=-3};
Unitype u=UniInt64(-3);
printuni(u);
ST_push(node,"type", u);
printf(" -> type\n ");
u=(Unitype){.type=Int64,.Int64=25};
u=UniInt64(25);
printuni(u);
ST_push(node,"time", u);
printf(" -> time\n ");
u=(Unitype){.type=Float64,.Float64=-542.00600};
u=UniFloat64(-542.00600);
printuni(u);
ST_push(node,"author_id", u);
printf(" -> author_id\n ");
u=(Unitype){.type=Int64,.Int64=-31255};
u=UniInt64(-31255);
printuni(u);
ST_push(node,"channel_id", u);
printf(" -> channel_id\n ");
u=(Unitype){.type=Float64,.Float64=32.2004};
u=UniPtrHeap(kerepTypeId_CharPtr, cptr_copy("32.2004"));
printuni(u);
ST_push(node,"message_id", u);
printf(" -> message_id\n ");
u=(Unitype){.type=CharPtr,.VoidPtr=cptr_copy("some text UwU")};
u=UniPtrStack(kerepTypeId_CharPtr,"some text UwU");
printuni(u);
ST_push(node,"text", u);
printf(" -> text\n");