1 /* Copyright 2020-2021 IGEL 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
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef TEST_HELPERS_H
17 #define TEST_HELPERS_H
21 #define UNUSED(x) (void)(x)
22 #define ARRAY_LEN(x) ((int)(sizeof(x) / sizeof(x[0])))
24 /* Get a vaild fd to use a a placeholder.
25 * The dummy fd should never be used for anything other
26 * than comparing the fd value or the referenced file description. */
27 int get_dummy_fd(void);
29 void check_fd_equality(int fd1, int fd2);
30 void check_fd_is_open(int fd);
31 void check_fd_is_closed(int fd);
33 void check_uint_array_eq(const uint32_t *a, const uint32_t *b, int cnt);