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

automizable psyc_isRoutingVar tests

This commit is contained in:
psyc://psyced.org/~lynX 2011-04-25 23:58:07 +02:00
parent b5f604c352
commit a214bb2cae
3 changed files with 22 additions and 6 deletions

View file

@ -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

View file

@ -2,9 +2,10 @@
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#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
}

View file

@ -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;
}