1/*
2 * Copyright (c) 2023 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 DISPLAY_TEST_H
17#define DISPLAY_TEST_H
18#include <cstring>
19#include <cstdio>
20#include <hdf_log.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#define __FILENAME__ (strrchr(__FILE__, '/') ? (strrchr(__FILE__, '/') + 1) : __FILE__)
27
28#ifndef DISPLAY_TEST_CHK_RETURN_NOT_VALUE
29#define DISPLAY_TEST_CHK_RETURN_NOT_VALUE(val, ret, ...) \
30    do {                                                 \
31        if (val) {                                       \
32            __VA_ARGS__;                                 \
33            return;                                      \
34        }                                                \
35    } while (0)
36#endif
37
38#ifndef DISPLAY_TEST_CHK_RETURN
39#define DISPLAY_TEST_CHK_RETURN(val, ret, ...) \
40    do {                                       \
41        if (val) {                             \
42            __VA_ARGS__;                       \
43            return (ret);                      \
44        }                                      \
45    } while (0)
46#endif
47
48#define DISPLAY_TEST_LOGE(format, ...)                                                        \
49    do {                                                                                      \
50        HDF_LOGE("%{public}s:%{public}d " format "", __FUNCTION__, __LINE__, ##__VA_ARGS__);  \
51    } while (0)
52
53#define DISPLAY_TEST_LOGE(format, ...)                                                        \
54    do {                                                                                      \
55        HDF_LOGE("%{public}s:%{public}d " format "", __FUNCTION__, __LINE__, ##__VA_ARGS__);  \
56    } while (0)
57
58#ifdef __cplusplus
59}
60#endif
61#endif // DISPLAY_TEST_H
62