Blame src/functional/argv.c
|
Szabolcs Nagy |
2f784e |
#include <limits.h>
|
|
Szabolcs Nagy |
2f784e |
#include <stdio.h>
|
|
Szabolcs Nagy |
2f784e |
#include "test.h"
|
|
Szabolcs Nagy |
2f784e |
|
|
Szabolcs Nagy |
2f784e |
#define TEST(c, ...) \
|
|
Szabolcs Nagy |
2f784e |
( (c) || (t_error(#c " failed: " __VA_ARGS__),0) )
|
|
Szabolcs Nagy |
2f784e |
|
|
Szabolcs Nagy |
2f784e |
int main(int argc, char **argv)
|
|
Szabolcs Nagy |
2f784e |
{
|
|
Szabolcs Nagy |
2f784e |
char buf[PATH_MAX];
|
|
Szabolcs Nagy |
2f784e |
TEST(argc == 1, "argc should be 1\n");
|
|
Szabolcs Nagy |
2f784e |
TEST(argv[0] != 0, "argv[0] should not be NULL\n");
|
|
Szabolcs Nagy |
2f784e |
TEST(argv[1] == 0, "argv[1] should be NULL\n");
|
|
Szabolcs Nagy |
2f784e |
TEST(argv[0][0] != 0, "argv[0] should not be empty\n");
|
|
Szabolcs Nagy |
2f784e |
TEST(snprintf(buf, sizeof buf, "%s", argv[0]) < sizeof buf, "argv[0] is not a valid path\n");
|
|
Szabolcs Nagy |
2f784e |
return t_status;
|
|
Szabolcs Nagy |
2f784e |
}
|