• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef WIFI_MESSAGE_TEST_H
10 #define WIFI_MESSAGE_TEST_H
11 #include "hdf_base.h"
12 
13 #define MSG_BREAK_IF(ERRCODE_VAR, CONDITION)                          \
14     if (CONDITION) {                                                  \
15         HDF_LOGE("%s:Line=%d:Check " #CONDITION, __func__, __LINE__); \
16         ERRCODE_VAR = HDF_FAILURE;                                             \
17         break;                                                        \
18     }
19 
20 #define MSG_RETURN_IF(CONDITION)                                          \
21     do {                                                                  \
22         if (CONDITION) {                                                  \
23             HDF_LOGE("%s:Line=%d:Check " #CONDITION, __func__, __LINE__); \
24             return HDF_FAILURE;                                                    \
25         }                                                                 \
26     } while (false)
27 
28 #define MSG_BREAK_IF_NOT_SUCCESS(ERROR_CODE)                                 \
29     if ((ERROR_CODE) != HDF_SUCCESS) {                                       \
30         HDF_LOGE("%s:Line=%d,errCode=%d", __func__, __LINE__, (ERROR_CODE)); \
31         errCode = HDF_FAILURE;                                                        \
32         break;                                                               \
33     }
34 
35 #define MSG_RETURN_IF_FUNCTION_FAILED(ERRCODE_VAR, FUNCTION_CALL)                                \
36     do {                                                                                         \
37         ERRCODE_VAR = FUNCTION_CALL;                                                             \
38         if ((ERRCODE_VAR) != 0) {                                                                \
39             HDF_LOGE("%s:Line=%d:Ret=%d,Call " #FUNCTION_CALL, __func__, __LINE__, ERRCODE_VAR); \
40             return ERRCODE_VAR;                                                                  \
41         }                                                                                        \
42     } while (false)
43 
44 #define MSG_BREAK_IF_FUNCTION_FAILED(ERRCODE_VAR, FUNCTION_CALL)                             \
45     ERRCODE_VAR = FUNCTION_CALL;                                                             \
46     if ((ERRCODE_VAR) != 0) {                                                                \
47         HDF_LOGE("%s:Line=%d:Ret=%d,Call " #FUNCTION_CALL, __func__, __LINE__, ERRCODE_VAR); \
48         break;                                                                               \
49     }
50 
51 
52 int32_t MessageQueueTest001(void);
53 int32_t MessageQueueTest002(void);
54 int32_t MessageQueueTest003(void);
55 int32_t MessageSingleNodeTest001(void);
56 int32_t MessageSingleNodeTest002(void);
57 int32_t MessageSingleNodeTest003(void);
58 int32_t MessageSingleNodeTest004(void);
59 int32_t MessageSingleNodeTest005(void);
60 
61 #endif