ParseValue()
This commit is contained in:
@@ -4,28 +4,13 @@
|
||||
|
||||
void printuni(Unitype v){
|
||||
switch (v.type) {
|
||||
case Null: printf("{%s}",typename(v.type));break;
|
||||
case Null: printf("{Null}");break;
|
||||
case Double: printf("{%s:%lf}",typename(v.type),v.Double);break;
|
||||
case Float: printf("{%s:%f}",typename(v.type),v.Float);break;
|
||||
case Char: printf("{%s:%c}",typename(v.type),v.Int8);break;
|
||||
case UInt8:
|
||||
case UInt16: printf("{%s:%u}",typename(v.type),v.UInt16);break;
|
||||
case UInt32:
|
||||
case Char: printf("{%s:%c}",typename(v.type),v.Char);break;
|
||||
case Bool:
|
||||
case UInt64: printf("{%s:%lu}",typename(v.type),v.UInt64);break;
|
||||
case Bool:
|
||||
case Int8:
|
||||
case Int16: printf("{%s:%d}",typename(v.type),v.Int16);break;
|
||||
case Int32:
|
||||
case Int64: printf("{%s:%ld}",typename(v.type),v.Int64);break;
|
||||
case Int8Ptr:
|
||||
case UInt8Ptr:
|
||||
case Int16Ptr:
|
||||
case UInt16Ptr:
|
||||
case Int32Ptr:
|
||||
case UInt32Ptr:
|
||||
case Int64Ptr:
|
||||
case UInt64Ptr: printf("{%s:%p}",typename(v.type),v.VoidPtr);break;
|
||||
default: throw(ERR_WRONGTYPE);break;
|
||||
default: printf("{%s:%p}",typename(v.type),v.VoidPtr);break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,5 +15,9 @@ void test_dtsod(){
|
||||
" text: \"_$\\\"\\\\'''\n\ta ыыы000;2;=:%d;```\";\n"
|
||||
"};\n";
|
||||
Hashtable* dtsod=DtsodV24_deserialize(text);
|
||||
Unitype msg=Hashtable_get(dtsod,"message");
|
||||
printuni(msg);
|
||||
Unitype id=Hashtable_get(msg.VoidPtr,"message_id");
|
||||
printf("\e[92mid: %lu",id.UInt64);
|
||||
}));
|
||||
}
|
||||
@@ -45,7 +45,7 @@ void fill(Hashtable* ht){
|
||||
for(uint32 i=0;i<100000;i++){
|
||||
char* key=malloc(12);
|
||||
sprintf(key,"key__%u",i);
|
||||
Hashtable_add(ht,key,Uni(UInt32,i));
|
||||
Hashtable_add(ht,key,Uni(UInt64,i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@ void test_searchtree(){
|
||||
STNode* node=STNode_create();
|
||||
printf("\e[92mnode created\n");
|
||||
printf("push:\e[94m\n ");
|
||||
Unitype u={.type=Int16,.Int16=-3};
|
||||
Unitype u={.type=Int64,.Int64=-3};
|
||||
printuni(u);
|
||||
ST_push(node,"type", u);
|
||||
printf(" -> type\n ");
|
||||
u=(Unitype){.type=Int16,.Int16=25};
|
||||
u=(Unitype){.type=Int64,.Int64=25};
|
||||
printuni(u);
|
||||
ST_push(node,"time", u);
|
||||
printf(" -> time\n ");
|
||||
@@ -41,7 +41,7 @@ void test_searchtree(){
|
||||
printuni(u);
|
||||
ST_push(node,"channel_id", u);
|
||||
printf(" -> channel_id\n ");
|
||||
u=(Unitype){.type=Float,.Float=32.2004};
|
||||
u=(Unitype){.type=Double,.Double=32.2004};
|
||||
printuni(u);
|
||||
ST_push(node,"message_id", u);
|
||||
printf(" -> message_id\n ");
|
||||
|
||||
Reference in New Issue
Block a user