CV_Report.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. #include "CV_Config.h"
  10. #include "CV_Typedefs.h"
  11. /*-----------------------------------------------------------------------------
  12. * Test report global definitions
  13. *----------------------------------------------------------------------------*/
  14. #define REP_TC_FAIL 0
  15. #define REP_TC_WARN 1
  16. #define REP_TC_PASS 2
  17. #define REP_TC_NOEX 3
  18. /* Test case result definition */
  19. typedef enum {
  20. PASSED = 0,
  21. WARNING,
  22. FAILED,
  23. NOT_EXECUTED
  24. } TC_RES;
  25. /* Assertion result info */
  26. typedef struct {
  27. const char *module; /* Module name */
  28. uint32_t line; /* Assertion line */
  29. } AS_INFO;
  30. /* Test case callback interface definition */
  31. typedef struct {
  32. BOOL (* Result) (TC_RES res);
  33. BOOL (* Dbgi) (TC_RES res, const char *fn, uint32_t ln, char *desc);
  34. } TC_ITF;
  35. /* Assert interface to the report */
  36. extern TC_ITF tcitf;
  37. /* Assertion result buffer */
  38. typedef struct {
  39. AS_INFO passed[BUFFER_ASSERTIONS];
  40. AS_INFO failed[BUFFER_ASSERTIONS];
  41. AS_INFO warnings[BUFFER_ASSERTIONS];
  42. } AS_T_INFO;
  43. /* Assertion statistics */
  44. typedef struct {
  45. uint32_t passed; /* Total assertions passed */
  46. uint32_t failed; /* Total assertions failed */
  47. uint32_t warnings; /* Total assertions warnings */
  48. AS_T_INFO info; /* Detailed assertion info */
  49. } AS_STAT;
  50. /* Test global statistics */
  51. typedef struct {
  52. uint32_t tests; /* Total test cases count */
  53. uint32_t executed; /* Total test cases executed */
  54. uint32_t passed; /* Total test cases passed */
  55. uint32_t failed; /* Total test cases failed */
  56. uint32_t warnings; /* Total test cases warnings */
  57. AS_STAT assertions; /* Total assertions statistics */
  58. } TEST_REPORT;
  59. /* Test report interface */
  60. typedef struct {
  61. BOOL (* Init) (void);
  62. BOOL (* Open) (const char *title, const char *date, const char *time, const char *fn);
  63. BOOL (* Close) (void);
  64. BOOL (* Open_TC) (uint32_t num, const char *fn);
  65. BOOL (* Close_TC) (void);
  66. } REPORT_ITF;
  67. /* Test report statistics */
  68. extern TEST_REPORT test_report;
  69. /* Test report interface */
  70. extern REPORT_ITF ritf;
  71. /* Assertions and test results */
  72. extern TC_RES __set_result (const char *fn, uint32_t ln, TC_RES res, char* desc);
  73. extern TC_RES __assert_true (const char *fn, uint32_t ln, uint32_t cond);
  74. #endif /* __REPORT_H__ */