14e56987cSopenharmony_ci/*
24e56987cSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
34e56987cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
44e56987cSopenharmony_ci * you may not use this file except in compliance with the License.
54e56987cSopenharmony_ci * You may obtain a copy of the License at
64e56987cSopenharmony_ci *
74e56987cSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
84e56987cSopenharmony_ci *
94e56987cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
104e56987cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
114e56987cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124e56987cSopenharmony_ci * See the License for the specific language governing permissions and
134e56987cSopenharmony_ci * limitations under the License.
144e56987cSopenharmony_ci */
154e56987cSopenharmony_ci
164e56987cSopenharmony_ci#ifndef CM_TEST_LOG_H
174e56987cSopenharmony_ci#define CM_TEST_LOG_H
184e56987cSopenharmony_ci
194e56987cSopenharmony_ci#define CM_TEST_ASSERT(test) \
204e56987cSopenharmony_ci    if (!(test)) { \
214e56987cSopenharmony_ci        printf("[ASSERT][%s](%d):fail\n", __func__, __LINE__); \
224e56987cSopenharmony_ci    }
234e56987cSopenharmony_ci
244e56987cSopenharmony_ci#define CM_TEST_LOG_E(fmt...) \
254e56987cSopenharmony_cido { \
264e56987cSopenharmony_ci    printf("[ERROR]\t[%s](%d): ", __func__, __LINE__); \
274e56987cSopenharmony_ci    printf(fmt); \
284e56987cSopenharmony_ci    printf("\r\n"); \
294e56987cSopenharmony_ci} while (0)
304e56987cSopenharmony_ci
314e56987cSopenharmony_ci#define CM_TEST_LOG_I(fmt...) \
324e56987cSopenharmony_cido { \
334e56987cSopenharmony_ci    printf("[INFO]\t[%s](%d): ", __func__, __LINE__); \
344e56987cSopenharmony_ci    printf(fmt); \
354e56987cSopenharmony_ci    printf("\r\n"); \
364e56987cSopenharmony_ci} while (0)
374e56987cSopenharmony_ci
384e56987cSopenharmony_ci#define CM_TEST_LOG_W(fmt...) \
394e56987cSopenharmony_cido { \
404e56987cSopenharmony_ci    printf("[WARN]\t[%s](%d): ", __func__, __LINE__); \
414e56987cSopenharmony_ci    printf(fmt); \
424e56987cSopenharmony_ci    printf("\r\n"); \
434e56987cSopenharmony_ci} while (0)
444e56987cSopenharmony_ci
454e56987cSopenharmony_ci#define CM_TEST_LOG_D(fmt...) \
464e56987cSopenharmony_cido { \
474e56987cSopenharmony_ci    printf("[DEBUG]\t[%s](%d): ", __func__, __LINE__); \
484e56987cSopenharmony_ci    printf(fmt); \
494e56987cSopenharmony_ci    printf("\r\n"); \
504e56987cSopenharmony_ci} while (0)
514e56987cSopenharmony_ci
524e56987cSopenharmony_ci#endif /* CM_TEST_LOG_H */