|
Packit Service |
def718 |
#include <assert.h>
|
|
Packit Service |
def718 |
#include <stdio.h>
|
|
Packit Service |
def718 |
#include <string.h>
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
#include "json.h"
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
int main(int argc, char **argv)
|
|
Packit Service |
def718 |
{
|
|
Packit Service |
def718 |
json_object *tmp=json_object_new_int(123);
|
|
Packit Service |
def718 |
assert (json_object_get_int(tmp)==123);
|
|
Packit Service |
def718 |
json_object_set_int(tmp,321);
|
|
Packit Service |
def718 |
assert (json_object_get_int(tmp)==321);
|
|
Packit Service |
def718 |
printf("INT PASSED\n");
|
|
Packit Service |
def718 |
json_object_set_int64(tmp,(int64_t)321321321);
|
|
Packit Service |
def718 |
assert (json_object_get_int64(tmp)==321321321);
|
|
Packit Service |
def718 |
json_object_put(tmp);
|
|
Packit Service |
def718 |
printf("INT64 PASSED\n");
|
|
Packit Service |
def718 |
tmp=json_object_new_boolean(TRUE);
|
|
Packit Service |
def718 |
assert (json_object_get_boolean(tmp)==TRUE);
|
|
Packit Service |
def718 |
json_object_set_boolean(tmp,FALSE);
|
|
Packit Service |
def718 |
assert (json_object_get_boolean(tmp)==FALSE);
|
|
Packit Service |
def718 |
json_object_set_boolean(tmp,TRUE);
|
|
Packit Service |
def718 |
assert (json_object_get_boolean(tmp)==TRUE);
|
|
Packit Service |
def718 |
json_object_put(tmp);
|
|
Packit Service |
def718 |
printf("BOOL PASSED\n");
|
|
Packit Service |
def718 |
tmp=json_object_new_double(12.34);
|
|
Packit Service |
def718 |
assert (json_object_get_double(tmp)==12.34);
|
|
Packit Service |
def718 |
json_object_set_double(tmp,34.56);
|
|
Packit Service |
def718 |
assert (json_object_get_double(tmp)==34.56);
|
|
Packit Service |
def718 |
json_object_set_double(tmp,6435.34);
|
|
Packit Service |
def718 |
assert (json_object_get_double(tmp)==6435.34);
|
|
Packit Service |
def718 |
json_object_put(tmp);
|
|
Packit Service |
def718 |
printf("DOUBLE PASSED\n");
|
|
Packit Service |
def718 |
#define SHORT "SHORT"
|
|
Packit Service |
def718 |
#define MID "A MID STRING"
|
|
Packit Service |
def718 |
// 12345678901234567890123456789012....
|
|
Packit Service |
def718 |
#define HUGE "A string longer than 32 chars as to check non local buf codepath"
|
|
Packit Service |
def718 |
tmp=json_object_new_string(SHORT);
|
|
Packit Service |
def718 |
assert (strcmp(json_object_get_string(tmp),SHORT)==0);
|
|
Packit Service |
def718 |
json_object_set_string(tmp,MID);
|
|
Packit Service |
def718 |
assert (strcmp(json_object_get_string(tmp),MID)==0);
|
|
Packit Service |
def718 |
json_object_set_string(tmp,HUGE);
|
|
Packit Service |
def718 |
assert (strcmp(json_object_get_string(tmp),HUGE)==0);
|
|
Packit Service |
def718 |
json_object_set_string(tmp,SHORT);
|
|
Packit Service |
def718 |
assert (strcmp(json_object_get_string(tmp),SHORT)==0);
|
|
Packit Service |
def718 |
json_object_put(tmp);
|
|
Packit Service |
def718 |
printf("STRING PASSED\n");
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
printf("PASSED\n");
|
|
Packit Service |
def718 |
return 0;
|
|
Packit Service |
def718 |
}
|