| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #ifndef RYANJSON_TEST_COMMON_H
- #define RYANJSON_TEST_COMMON_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <stdio.h>
- #include <stdint.h>
- #include <stdlib.h>
- #include <math.h>
- #include <time.h>
- #include <ctype.h>
- #include <inttypes.h>
- #include "FreeRTOS.h"
- #include "task.h"
- #include "unity.h"
- #include "valloc.h"
- #include "RyanJson.h"
- #include "cJSON.h"
- #include "yyjson.h"
- #include "testPlatform.h"
- #ifndef RyanJsonTestAllocHeaderSize
- #define RyanJsonTestAllocHeaderSize RyanJsonMallocHeaderSize
- #endif
- #ifndef RyanJsonTestAllocAlignSize
- #define RyanJsonTestAllocAlignSize RyanJsonMallocAlign
- #endif
- static inline void delay(uint32_t ms)
- {
- testPlatformSleepMs(ms);
- }
- #define getArraySize(arr) ((int32_t)(sizeof(arr) / sizeof((arr)[0])))
- #define checkMemory \
- do \
- { \
- if (0 != unityTestGetUse()) \
- { \
- testLog("内存泄漏\r\n"); \
- while (1) \
- { \
- showMemoryInfo(); \
- delay(3000); \
- } \
- } \
- } while (0)
- // 定义枚举类型
- extern void *unityTestMalloc(size_t size);
- extern void unityTestFree(void *block);
- extern void *unityTestRealloc(void *block, size_t size);
- extern void unityTestSetAllocSimulation(uint8_t isEnable);
- extern uint8_t unityTestGetAllocSimulation(void);
- extern int32_t unityTestGetUse(void);
- extern void showMemoryInfo(void);
- extern void logTaskStackRuntimeInfoByHandle(const char *tag, const char *taskName, TaskHandle_t taskHandle);
- // 定义结构体类型
- extern uint64_t platformUptimeMs(void);
- extern RyanJsonBool_e RyanJsonExample(void);
- extern RyanJsonBool_e RyanJsonTestFun(void);
- extern void ryanJsonTestSetup(void);
- extern void ryanJsonTestTeardown(void);
- #ifdef __cplusplus
- }
- #endif
- #endif
|