1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00
libpsyc/test/var_is_routing.c

38 lines
1 KiB
C
Raw Normal View History

2011-10-31 19:04:16 +00:00
#include <psyc.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <lib.h>
int main() {
#if 0
2011-11-11 21:18:24 +00:00
const char* vars[] = {
"_source",
"_source_relay",
"_source_foo",
"_sourcherry",
"_foo",
"bar",
"_",
};
2011-10-31 19:04:16 +00:00
2011-11-11 21:18:24 +00:00
int i;
for (i = 0; i < sizeof(vars) / sizeof(*vars); i++) {
printf(">> %s: %d %d\n", vars[i], sizeof(vars[i]), sizeof(*vars[i]));
printf("%s: %d\n", vars[i], psyc_var_is_routing(vars[i], strlen(vars[i])));
}
2011-10-31 19:04:16 +00:00
#else
2011-11-11 21:18:24 +00:00
unless (psyc_var_is_routing(PSYC_C2ARG("_source"))) return 1;
unless (psyc_var_is_routing(PSYC_C2ARG("_source_relay"))) return 2;
if (psyc_var_is_routing(PSYC_C2ARG("_source_foo"))) return 3;
if (psyc_var_is_routing(PSYC_C2ARG("_sourcherry"))) return 4;
if (psyc_var_is_routing(PSYC_C2ARG("_sour"))) return 5;
if (psyc_var_is_routing(PSYC_C2ARG("_foo"))) return 6;
if (psyc_var_is_routing(PSYC_C2ARG("bar"))) return 7;
if (psyc_var_is_routing(PSYC_C2ARG("_"))) return 8;
2011-10-31 19:04:16 +00:00
2011-11-11 21:18:24 +00:00
puts("psyc_var_is_routing passed all tests.");
2011-10-31 19:04:16 +00:00
#endif
2011-11-11 21:18:24 +00:00
return 0; // passed all tests
2011-10-31 19:04:16 +00:00
}