]> begriffs open source - cmsis-driver-validation/blob - Include/DV_Typedefs.h
Improved robustness of SPI testing and SPI Server
[cmsis-driver-validation] / Include / DV_Typedefs.h
1 /*
2  * Copyright (c) 2015-2020 Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Licensed under the Apache License, Version 2.0 (the License); you may
7  * not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * -----------------------------------------------------------------------------
19  *
20  * Project:     CMSIS-Driver Validation
21  * Title:       Test framework type definitions and test macros header file
22  *
23  * -----------------------------------------------------------------------------
24  */
25
26
27 #ifndef __CMSIS_DV_TYPEDEFS_H__
28 #define __CMSIS_DV_TYPEDEFS_H__
29
30 #include <stdint.h>
31 #include <stdarg.h>
32 #include <string.h>
33 #include <stdio.h>
34
35 typedef unsigned int    BOOL;
36
37 #ifndef __TRUE
38  #define __TRUE         1
39 #endif
40 #ifndef __FALSE
41  #define __FALSE        0
42 #endif
43
44 #ifndef ENABLED
45  #define ENABLED        1
46 #endif
47 #ifndef DISABLED
48  #define DISABLED       0
49 #endif
50
51 #ifndef NULL
52  #ifdef __cplusplus              // EC++
53   #define NULL          0
54  #else
55   #define NULL          ((void *) 0)
56  #endif
57 #endif
58
59 #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof((arr)[0]))
60
61 /* Test group info macro */
62 #define TEST_GROUP_INFO(info)                   __tg_info (info)
63
64 /* Test macros */
65 #define TEST_FAIL()                             TEST_FAIL_MESSAGE(NULL)
66 #define TEST_FAIL_MESSAGE(message)              __set_result (__FILE__, __LINE__, message, FAILED)
67 #define TEST_PASS()                             TEST_PASS_MESSAGE(NULL)
68 #define TEST_PASS_MESSAGE(message)              __set_result (__FILE__, __LINE__, message, PASSED)
69
70 #define TEST_ASSERT(condition)                  TEST_ASSERT_MESSAGE(condition,"[FAILED]")
71 #define TEST_ASSERT_MESSAGE(condition,message)  if (condition) { __set_result (__FILE__, __LINE__, NULL, PASSED); } else { __set_result (__FILE__, __LINE__, message, FAILED); }
72
73 #define TEST_MESSAGE(message)                   __set_message(__FILE__, __LINE__, message)
74
75 #endif /* __CMSIS_DV_TYPEDEFS_H__ */