functional: add mntent test
[libc-test.git] / src / functional / argv.c
blob487f68dfbfb1374d65baeeae15da42512992e2ba
1 #include <limits.h>
2 #include <stdio.h>
3 #include "test.h"
5 #define TEST(c, ...) \
6 ( (c) || (t_error(#c " failed: " __VA_ARGS__),0) )
8 int main(int argc, char **argv)
10 char buf[PATH_MAX];
11 TEST(argc == 1, "argc should be 1\n");
12 TEST(argv[0] != 0, "argv[0] should not be NULL\n");
13 TEST(argv[1] == 0, "argv[1] should be NULL\n");
14 TEST(argv[0][0] != 0, "argv[0] should not be empty\n");
15 TEST(snprintf(buf, sizeof buf, "%s", argv[0]) < sizeof buf, "argv[0] is not a valid path\n");
16 return t_status;