diff options
author | deva <deva> | 2011-02-17 11:00:14 +0000 |
---|---|---|
committer | deva <deva> | 2011-02-17 11:00:14 +0000 |
commit | db144840aba95affb3a6b5b2536059f49f0677ff (patch) | |
tree | 1c397a20aa5745c6bbb5dee6a4409f58c4542e87 /server/src/templateheaderparser.cc | |
parent | c8651b8c89673300477ab86962640c93216ea306 (diff) |
Rewrite of all old tests to new unittest framework. Also some work on testdb; more to come...
Diffstat (limited to 'server/src/templateheaderparser.cc')
-rw-r--r-- | server/src/templateheaderparser.cc | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/server/src/templateheaderparser.cc b/server/src/templateheaderparser.cc index 2cb3e84..e549035 100644 --- a/server/src/templateheaderparser.cc +++ b/server/src/templateheaderparser.cc @@ -143,6 +143,10 @@ Template *TemplateHeaderParser::getTemplate() } #ifdef TEST_TEMPLATEHEADERPARSER +//deps: saxparser.cc exception.cc debug.cc log.cc +//cflags: -I.. $(EXPAT_CFLAGS) +//libs: $(EXPAT_LIBS) +#include <test.h> #define XMLFILE "/tmp/test_templateheaderparser.xml" @@ -152,7 +156,7 @@ Template *TemplateHeaderParser::getTemplate() #include <string.h> #include <stdio.h> #include <memory.h> - +/* static char xml[] = "<?xml version='1.0' encoding='UTF-8'?>\n" "<template name=\"testtemplate\" version=\"1.0\">\n" @@ -176,15 +180,19 @@ static char xml_fail[] = " <someothertag/>\n" "</template>" ; +*/ +TEST_BEGIN; -int main() -{ +// TODO: Put some testcode here (see test.h for usable macros). +TEST_TRUE(false, "No tests yet!"); + +/* FILE *fp = fopen(XMLFILE, "w"); if(!fp) { printf("Could not write to %s\n", XMLFILE); return 1; } - fprintf(fp, xml); +fprintf(fp, "%s", xml); fclose(fp); { @@ -203,7 +211,7 @@ int main() printf("Could not write to %s\n", XMLFILE); return 1; } - fprintf(fp, xml_nontemplate); +fprintf(fp, "%s", xml_nontemplate); fclose(fp); // Test parsing of correct xml data, but not template (should throw an exception). @@ -224,7 +232,7 @@ int main() printf("Could not write to %s\n", XMLFILE); return 1; } - fprintf(fp, xml_fail); +fprintf(fp, "%s", xml_fail); fclose(fp); // Test parsing of invalid xml data (should throw an exception). @@ -241,8 +249,7 @@ int main() yetonandon: unlink(XMLFILE); - - return 0; -} +*/ +TEST_END; #endif/*TEST_TEMPLATEHEADERPARSER*/ |