• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *    http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HKS_TEST_LOG_H
17 #define HKS_TEST_LOG_H
18 
19 #include "stdint.h"
20 #include "stdbool.h"
21 
22 #define HKS_TEST_ASSERT(test) \
23     if (!(test)) { \
24         printf("[ASSERT][%s](%d):fail\n", __func__, __LINE__); \
25     }
26 
27 #ifndef _CUT_LOG_
28 #define HKS_TEST_LOG_E(fmt...) \
29 do { \
30     printf("[ERROR]\t[%s](%d): ", __func__, __LINE__); \
31     printf(fmt); \
32     printf("\r\n"); \
33 } while (0)
34 
35 #define HKS_TEST_LOG_I(fmt...) \
36 do { \
37     printf("[INFO]\t[%s](%d): ", __func__, __LINE__); \
38     printf(fmt); \
39     printf("\r\n"); \
40 } while (0)
41 
42 #define HKS_TEST_LOG_W(fmt...) \
43 do { \
44     printf("[WARN]\t[%s](%d): ", __func__, __LINE__); \
45     printf(fmt); \
46     printf("\r\n"); \
47 } while (0)
48 
49 #define HKS_TEST_LOG_D(fmt...) \
50 do { \
51     printf("[DEBUG]\t[%s](%d): ", __func__, __LINE__); \
52     printf(fmt); \
53     printf("\r\n"); \
54 } while (0)
55 #else
56 #define HKS_TEST_LOG_E(...)
57 #define HKS_TEST_LOG_I(...)
58 #define HKS_TEST_LOG_W(...)
59 #define HKS_TEST_LOG_D(...)
60 #endif
61 
62 #endif /* HKS_TEST_LOG_H */
63