File: test-root-user.c

package info (click to toggle)
libzt 0.3.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 936 kB
  • sloc: ansic: 3,217; sh: 211; awk: 12; makefile: 10
file content (20 lines) | stat: -rw-r--r-- 501 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <pwd.h>
#include <sys/types.h>

#include <zt.h>

static void test_root_user(zt_t t)
{
    struct passwd* p = getpwnam("root");
    zt_assert(t, ZT_NOT_NULL(p));
    zt_check(t, ZT_CMP_CSTR(p->pw_name, ==, "root"));
    zt_check(t, ZT_CMP_INT(p->pw_uid, ==, 0));
    zt_check(t, ZT_CMP_INT(p->pw_gid, ==, 0));
}

static void test_suite(zt_visitor v) { ZT_VISIT_TEST_CASE(v, test_root_user); }

int main(int argc, char** argv, char** envp)
{
    return zt_main(argc, argv, envp, test_suite);
}