|
|
@ -6,6 +6,9 @@ |
|
|
#include "../bigpoint_dyntype.h" |
|
|
#include "../bigpoint_dyntype.h" |
|
|
|
|
|
|
|
|
#define TEST_STR "this is a foo string" |
|
|
#define TEST_STR "this is a foo string" |
|
|
|
|
|
#define TEST_KEY1 "key1" |
|
|
|
|
|
#define TEST_KEY2 "key2" |
|
|
|
|
|
#define TEST_KEY3 "key3" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int |
|
|
int |
|
|
@ -43,6 +46,33 @@ main(int argc, char * argv[]) |
|
|
delete(dyn); |
|
|
delete(dyn); |
|
|
json_object_put(json); |
|
|
json_object_put(json); |
|
|
|
|
|
|
|
|
|
|
|
json = json_tokener_parse("{\"key1\":123,\"key2\":321,\"key3\":\"" TEST_STR "\"}"); |
|
|
|
|
|
dyn = newFromJson(BIGPOINT_DYNTYPE, json); |
|
|
|
|
|
json_object_put(json); |
|
|
|
|
|
|
|
|
|
|
|
json = toJson(dyn); |
|
|
|
|
|
printf("%s\n", json_object_to_json_string(json)); |
|
|
|
|
|
json_object_put(json); |
|
|
|
|
|
|
|
|
|
|
|
if (BIGPOINT_DYNTYPE_HASH == dyn->type) { |
|
|
|
|
|
struct BIGPOINT_HASH * hash = (dyn->data)._hash; |
|
|
|
|
|
struct BIGPOINT_DYNTYPE * value; |
|
|
|
|
|
|
|
|
|
|
|
value = bigpoint_hash_get(hash, TEST_KEY1); |
|
|
|
|
|
printf("%d\n", (value->data)._int); |
|
|
|
|
|
delete(value); |
|
|
|
|
|
|
|
|
|
|
|
value = bigpoint_hash_get(hash, TEST_KEY2); |
|
|
|
|
|
printf("%d\n", (value->data)._int); |
|
|
|
|
|
delete(value); |
|
|
|
|
|
|
|
|
|
|
|
value = bigpoint_hash_get(hash, TEST_KEY3); |
|
|
|
|
|
printf("%s\n", (value->data)._string); |
|
|
|
|
|
delete(value); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
delete(dyn); |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|