userspace/test: implement more tests in libc_test

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
2025-02-13 01:14:11 +02:00
parent 6c3eefa85d
commit 3e656854bc
8 changed files with 119 additions and 8 deletions

View File

@ -16,5 +16,20 @@
*/
#include <dirent.h>
#include <stddef.h>
int test_closedir(void) { return 2; }
/* https://pubs.opengroup.org/onlinepubs/9799919799/functions/closedir.html */
int test_closedir(void)
{
DIR *dir = opendir(".");
if (closedir(dir) != 0)
return 0x101;
if (closedir(NULL) != -1)
return 0x102;
// if (closedir(dir) != -1) /* yeah... this will result in a core dump */
// return 0x103;
return 0;
}