diff --git a/test/Makefile b/test/Makefile index 459d777..4de85e1 100644 --- a/test/Makefile +++ b/test/Makefile @@ -4,6 +4,9 @@ LOADLIBES=-lpsyc -lm TARGETS=testParser testMatch testRender isRoutingVar all: $(TARGETS) + ./testRender + ./testMatch + ./isRoutingVar test: for f in packets/*; do echo -e "\n>> $$f"; ./testParser $$f; done diff --git a/test/isRoutingVar.c b/test/isRoutingVar.c index 02b1fd8..c0eacd8 100644 --- a/test/isRoutingVar.c +++ b/test/isRoutingVar.c @@ -2,9 +2,10 @@ #include #include #include +#include "../include/psyc/lib.h" -int main(int argc, char** argv) -{ +int main() { +#if 0 const char* vars[] = { "_source", @@ -22,6 +23,17 @@ int main(int argc, char** argv) printf(">> %s: %d %d\n", vars[i], sizeof(vars[i]), sizeof(*vars[i])); printf("%s: %d\n", vars[i], psyc_isRoutingVar(vars[i], strlen(vars[i]))); } +#else + unless (psyc_isRoutingVar(PSYC_C2ARG("_source"))) return -1; + unless (psyc_isRoutingVar(PSYC_C2ARG("_source_relay"))) return -2; + if (psyc_isRoutingVar(PSYC_C2ARG("_source_foo"))) return -3; + if (psyc_isRoutingVar(PSYC_C2ARG("_sourcherry"))) return -4; + if (psyc_isRoutingVar(PSYC_C2ARG("_sour"))) return -5; + if (psyc_isRoutingVar(PSYC_C2ARG("_foo"))) return -6; + if (psyc_isRoutingVar(PSYC_C2ARG("bar"))) return -7; + if (psyc_isRoutingVar(PSYC_C2ARG("_"))) return -8; - return 0; + puts("psyc_isRoutingVar passed all tests."); +#endif + return 0; // passed all tests } diff --git a/test/testRender.c b/test/testRender.c index 58d86ca..c51c4d2 100644 --- a/test/testRender.c +++ b/test/testRender.c @@ -38,12 +38,13 @@ int testPresence(const char *avail, int availlen, const char *desc, int desclen, } int main() { - return testPresence(PSYC_C2ARG("_here"), PSYC_C2ARG("I'm omnipresent right now"), "\ -:_context\tpsyc://10.100.1000/~ludwig\n\ + int rc = testPresence(PSYC_C2ARG("_here"), PSYC_C2ARG("I'm omnipresent right now"), "\ +:_context\t" myUNI "\n\ \n\ =_degree_availability\t_here\n\ =_description_presence\tI'm omnipresent right now\n\ _notice_presence\n\ |\n"); - + unless (rc) puts("psyc_render passed the test."); + return rc; }