1 /*
2  * Copyright (c) 2022 Meta
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include "_common.h"
8 
9 #ifdef CONFIG_POSIX_API
10 #include <dirent.h>
11 #else
12 #include <zephyr/posix/dirent.h>
13 #endif
14 
15 /**
16  * @brief existence test for `<dirent.h>`
17  *
18  * @see <a href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dirent.h.html">dirent.h</a>
19  */
ZTEST(posix_headers,test_dirent_h)20 ZTEST(posix_headers, test_dirent_h)
21 {
22 #ifdef CONFIG_POSIX_API
23 	zassert_not_equal((DIR *)-1, (DIR *)NULL);
24 
25 	zassert_not_equal(-1, offsetof(struct dirent, d_ino));
26 	zassert_not_equal(-1, offsetof(struct dirent, d_name));
27 
28 	/* zassert_not_null(alphasort); */ /* not implemented */
29 	zassert_not_null(closedir);
30 	/* zassert_not_null(dirfd); */     /* not implemented */
31 	/* zassert_not_null(fdopendir); */ /* not implemented */
32 	zassert_not_null(opendir);
33 	zassert_not_null(readdir);
34 	zassert_not_null(readdir_r);
35 	/* zassert_not_null(rewinddir); */ /* not implemented */
36 	/* zassert_not_null(scandir); */   /* not implemented */
37 	/* zassert_not_null(seekdir); */   /* not implemented */
38 	/* zassert_not_null(telldir); */   /* not implemented */
39 #endif
40 }
41