1 /*----------------------------------------------------------------------------- 2 * Name: CV_Report.h 3 * Purpose: Report statistics and layout header 4 *---------------------------------------------------------------------------- 5 * Copyright (c) 2017 ARM Limited. All rights reserved. 6 *----------------------------------------------------------------------------*/ 7 #ifndef __REPORT_H__ 8 #define __REPORT_H__ 9 10 #include "CV_Config.h" 11 #include "CV_Typedefs.h" 12 13 /*----------------------------------------------------------------------------- 14 * Test report global definitions 15 *----------------------------------------------------------------------------*/ 16 17 #define REP_TC_FAIL 0 18 #define REP_TC_WARN 1 19 #define REP_TC_PASS 2 20 #define REP_TC_NOEX 3 21 22 /* Test case result definition */ 23 typedef enum { 24 PASSED = 0, 25 WARNING, 26 FAILED, 27 NOT_EXECUTED 28 } TC_RES; 29 30 /* Assertion result info */ 31 typedef struct { 32 const char *module; /* Module name */ 33 uint32_t line; /* Assertion line */ 34 } AS_INFO; 35 36 /* Test case callback interface definition */ 37 typedef struct { 38 BOOL (* Result) (TC_RES res); 39 BOOL (* Dbgi) (TC_RES res, const char *fn, uint32_t ln, char *desc); 40 } TC_ITF; 41 42 /* Assert interface to the report */ 43 extern TC_ITF tcitf; 44 45 /* Assertion result buffer */ 46 typedef struct { 47 AS_INFO passed[BUFFER_ASSERTIONS]; 48 AS_INFO failed[BUFFER_ASSERTIONS]; 49 AS_INFO warnings[BUFFER_ASSERTIONS]; 50 } AS_T_INFO; 51 52 /* Assertion statistics */ 53 typedef struct { 54 uint32_t passed; /* Total assertions passed */ 55 uint32_t failed; /* Total assertions failed */ 56 uint32_t warnings; /* Total assertions warnings */ 57 AS_T_INFO info; /* Detailed assertion info */ 58 } AS_STAT; 59 60 /* Test global statistics */ 61 typedef struct { 62 uint32_t tests; /* Total test cases count */ 63 uint32_t executed; /* Total test cases executed */ 64 uint32_t passed; /* Total test cases passed */ 65 uint32_t failed; /* Total test cases failed */ 66 uint32_t warnings; /* Total test cases warnings */ 67 AS_STAT assertions; /* Total assertions statistics */ 68 } TEST_REPORT; 69 70 /* Test report interface */ 71 typedef struct { 72 BOOL (* Init) (void); 73 BOOL (* Open) (const char *title, const char *date, const char *time, const char *fn); 74 BOOL (* Close) (void); 75 BOOL (* Open_TC) (uint32_t num, const char *fn); 76 BOOL (* Close_TC) (void); 77 } REPORT_ITF; 78 79 /* Test report statistics */ 80 extern TEST_REPORT test_report; 81 82 /* Test report interface */ 83 extern REPORT_ITF ritf; 84 85 /* Assertions and test results */ 86 extern TC_RES __set_result (const char *fn, uint32_t ln, TC_RES res, char* desc); 87 extern TC_RES __assert_true (const char *fn, uint32_t ln, uint32_t cond); 88 89 #endif /* __REPORT_H__ */ 90