You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_charcase.c 771 B

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include <assert.h>
  2. #include <stddef.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include "json.h"
  7. #include "json_tokener.h"
  8. static void test_case_parse(void);
  9. int main(int argc, char **argv)
  10. {
  11. MC_SET_DEBUG(1);
  12. test_case_parse();
  13. return 0;
  14. }
  15. /* make sure only lowercase forms are parsed in strict mode */
  16. static void test_case_parse()
  17. {
  18. struct json_tokener *tok;
  19. json_object *new_obj;
  20. tok = json_tokener_new();
  21. json_tokener_set_flags(tok, JSON_TOKENER_STRICT);
  22. new_obj = json_tokener_parse_ex(tok, "True", 4);
  23. assert(new_obj == NULL);
  24. new_obj = json_tokener_parse_ex(tok, "False", 5);
  25. assert(new_obj == NULL);
  26. new_obj = json_tokener_parse_ex(tok, "Null", 4);
  27. assert(new_obj == NULL);
  28. printf("OK\n");
  29. json_tokener_free(tok);
  30. }