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

psyc_is_var_routing() -> psyc_var_routing()

This commit is contained in:
tg(x) 2012-01-31 19:34:11 +01:00
parent 8fcceff88f
commit eaeab8c226
7 changed files with 76 additions and 76 deletions

View file

@ -3,7 +3,7 @@ DEBUG = 2
CFLAGS = -I../include -I../src -Wall -std=c99 ${OPT}
LDFLAGS = -L../lib
LOADLIBES = -lpsyc -lm
TARGETS = test_psyc test_psyc_speed test_parser test_match test_render test_text var_is_routing var_type uniform_parse test_list test_table test_packet_id method
TARGETS = test_psyc test_psyc_speed test_parser test_match test_render test_text var_routing var_type uniform_parse test_list test_table test_packet_id method
O = test.o
WRAPPER =
DIET = diet
@ -45,7 +45,7 @@ test: ${TARGETS}
./test_render
./test_match
./test_text
./var_is_routing
./var_routing
./var_type
./uniform_parse
./test_list

View file

@ -1,37 +0,0 @@
#include <psyc.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <lib.h>
int main() {
#if 0
const char* vars[] = {
"_source",
"_source_relay",
"_source_foo",
"_sourcherry",
"_foo",
"bar",
"_",
};
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])));
}
#else
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;
puts("psyc_var_is_routing passed all tests.");
#endif
return 0; // passed all tests
}

23
test/var_routing.c Normal file
View file

@ -0,0 +1,23 @@
#include <psyc.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <lib.h>
int main() {
int i;
for (i = 0; i < psyc_rvars_num; i++)
if (psyc_var_routing(PSYC_S2ARG(psyc_rvars[i].key)) != psyc_rvars[i].value)
return i + 1;
if (psyc_var_routing(PSYC_C2ARG("_source_foo"))) return 3;
if (psyc_var_routing(PSYC_C2ARG("_sourcherry"))) return 4;
if (psyc_var_routing(PSYC_C2ARG("_sour"))) return 5;
if (psyc_var_routing(PSYC_C2ARG("_foo"))) return 6;
if (psyc_var_routing(PSYC_C2ARG("bar"))) return 7;
if (psyc_var_routing(PSYC_C2ARG("_"))) return 8;
puts("psyc_var_routing passed all tests.");
return 0;
}