1 #include <assert.h> 2 #include <stddef.h> 3 #include <stdio.h> 4 #include <stdlib.h> 5 #include <string.h> 6 7 #include "json.h" 8 #include "json_tokener.h" 9 10 static void test_case_parse(void); 11 12 int main(int argc, char **argv) 13 { 14 MC_SET_DEBUG(1); 15 16 test_case_parse(); 17 18 return 0; 19 } 20 21 /* make sure only lowercase forms are parsed in strict mode */ 22 static void test_case_parse() 23 { 24 struct json_tokener *tok; 25 json_object *new_obj; 26 27 tok = json_tokener_new(); 28 json_tokener_set_flags(tok, JSON_TOKENER_STRICT); 29 30 new_obj = json_tokener_parse_ex(tok, "True", 4); 31 assert(new_obj == NULL); 32 33 new_obj = json_tokener_parse_ex(tok, "False", 5); 34 assert(new_obj == NULL); 35 36 new_obj = json_tokener_parse_ex(tok, "Null", 4); 37 assert(new_obj == NULL); 38 39 printf("OK\n"); 40 41 json_tokener_free(tok); 42 } 43
This page was automatically generated by LXR 0.3.1. • OpenWrt