From db144840aba95affb3a6b5b2536059f49f0677ff Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 17 Feb 2011 11:00:14 +0000 Subject: Rewrite of all old tests to new unittest framework. Also some work on testdb; more to come... --- server/src/templateparser.cc | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'server/src/templateparser.cc') diff --git a/server/src/templateparser.cc b/server/src/templateparser.cc index b34f280..20270c6 100644 --- a/server/src/templateparser.cc +++ b/server/src/templateparser.cc @@ -161,6 +161,10 @@ Template *TemplateParser::getTemplate() } #ifdef TEST_TEMPLATEPARSER +//deps: saxparser.cc debug.cc log.cc exception.cc +//cflags: -I.. $(EXPAT_CFLAGS) +//libs: $(EXPAT_LIBS) +#include #define XMLFILE "/tmp/test_templateparser.xml" @@ -170,7 +174,7 @@ Template *TemplateParser::getTemplate() #include #include #include - +/* static char xml[] = "\n" "" ; +*/ -int main() -{ +TEST_BEGIN; + +// 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); { @@ -221,7 +230,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). @@ -242,7 +251,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). @@ -259,8 +268,7 @@ int main() yetonandon: unlink(XMLFILE); - - return 0; -} +*/ +TEST_END; #endif/*TEST_TEMPLATEPARSER*/ -- cgit v1.2.3