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 810 B

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