main.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include <stdlib.h>
  4. #include "RyanJson.h"
  5. #include "valloc.h"
  6. void printfTitle(char *title)
  7. {
  8. printf("\r\n");
  9. printf("\r\n");
  10. printf("*****************************************************************************\r\n");
  11. printf("*************************** %s **************************\r\n", title);
  12. printf("*****************************************************************************\r\n");
  13. }
  14. extern int RyanJsonExample();
  15. extern int RyanJsonTest();
  16. extern int RyanJsonMemoryFootprintTest();
  17. extern int RFC8259JsonTest();
  18. int main(void)
  19. {
  20. int result = 0;
  21. printfTitle("RyanJson 示例程序");
  22. RyanJsonExample();
  23. printfTitle("RyanJson 接口测试程序");
  24. result = RyanJsonTest();
  25. if (0 != result)
  26. {
  27. printf("%s:%d RyanJsonTest fail\r\n", __FILE__, __LINE__);
  28. return -1;
  29. }
  30. printfTitle("RyanJson / cJSON / yyjson RFC8259标准测试");
  31. result = RFC8259JsonTest();
  32. if (0 != result)
  33. {
  34. printf("%s:%d RFC8259JsonTest fail\r\n", __FILE__, __LINE__);
  35. return -1;
  36. }
  37. printfTitle("RyanJson / cJSON / yyjson 内存对比程序");
  38. result = RyanJsonMemoryFootprintTest();
  39. displayMem();
  40. return 0;
  41. }