FxLibcTest/src/sysstat/stat.c

34 lines
675 B
C

#include <ft/test.h>
#include <ft/all-tests.h>
#include <ft/util.h>
#include <gint/gint.h>
#include <errno.h>
#include <sys/stat.h>
static void _ft_sysstat_stat_switch(ft_test *t)
{
struct stat st;
int rc;
DO_E(rc, stat("@MainMem", &st), t, "%d");
ft_assert(t, rc == 0 && S_ISDIR(st.st_mode));
#ifdef FX9860G
DO_E(rc, stat("FxLibcT.g1a", &st), t, "%d");
#else
DO_E(rc, stat("FxLibcT.g3a", &st), t, "%d");
#endif
ft_assert(t, rc == 0 && S_ISREG(st.st_mode));
}
static void _ft_sysstat_stat(ft_test *t)
{
gint_world_switch(GINT_CALL(_ft_sysstat_stat_switch, (void *)t));
}
ft_test ft_sysstat_stat = {
.name = "stat() function",
.function = _ft_sysstat_stat,
};