1 /*----------------------------------------------------------------------------- 2 * Name: CV_Typedefs.h 3 * Purpose: Test framework filetypes and structures description 4 *---------------------------------------------------------------------------- 5 * Copyright (c) 2017 - 2018 Arm Limited. All rights reserved. 6 *----------------------------------------------------------------------------*/ 7 #ifndef __TYPEDEFS_H__ 8 #define __TYPEDEFS_H__ 9 10 #include <stdint.h> 11 #include <stdarg.h> 12 #include <string.h> 13 #include <stdio.h> 14 15 typedef unsigned int BOOL; 16 17 #ifndef __TRUE 18 #define __TRUE 1 19 #endif 20 #ifndef __FALSE 21 #define __FALSE 0 22 #endif 23 24 #ifndef ENABLED 25 #define ENABLED 1 26 #endif 27 #ifndef DISABLED 28 #define DISABLED 0 29 #endif 30 31 #ifndef NULL 32 #ifdef __cplusplus // EC++ 33 #define NULL 0 34 #else 35 #define NULL ((void *) 0) 36 #endif 37 #endif 38 39 #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof((arr)[0])) 40 41 #if defined( __GNUC__ ) || defined ( __clang__ ) 42 static const int PATH_DELIMITER = '/'; 43 #else 44 static const int PATH_DELIMITER = '\\'; 45 #endif 46 47 //lint -emacro(9016,__FILENAME__) allow pointer arithmetic for truncating filename 48 //lint -emacro(613,__FILENAME__) null pointer is checked 49 #define __FILENAME__ ((strrchr(__FILE__, PATH_DELIMITER) != NULL) ? (strrchr(__FILE__, PATH_DELIMITER) + 1) : __FILE__) 50 51 /* Assertions and test results */ 52 #define SET_RESULT(res, desc) (void)__set_result(__FILENAME__, __LINE__, (res), (desc)); 53 54 //lint -emacro(9031,ASSERT_TRUE) allow boolean condition as parameter 55 //lint -emacro(613,ASSERT_TRUE) null pointer is checked 56 #define ASSERT_TRUE(cond) (void)__assert_true (__FILENAME__, __LINE__, (cond) ? 1U : 0U) 57 58 #endif /* __TYPEDEFS_H__ */ 59