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/macroparser.cc | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'server/src/macroparser.cc') diff --git a/server/src/macroparser.cc b/server/src/macroparser.cc index 2bd482e..bf6ff13 100644 --- a/server/src/macroparser.cc +++ b/server/src/macroparser.cc @@ -358,6 +358,10 @@ Macro *MacroParser::getMacro() } #ifdef TEST_MACROPARSER +//deps: debug.cc log.cc saxparser.cc exception.cc +//cflags: -I.. $(EXPAT_CFLAGS) +//libs: $(EXPAT_LIBS) +#include #define XMLFILE "/tmp/test_macroheaderparser.xml" @@ -368,6 +372,7 @@ Macro *MacroParser::getMacro() #include #include +/* static char xml[] = "\n" "\n" @@ -394,15 +399,20 @@ static char xml_fail[] = " \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); { @@ -421,7 +431,7 @@ int main() printf("Could not write to %s\n", XMLFILE); return 1; } - fprintf(fp, xml_nonmacro); +fprintf(fp, "%s", xml_nonmacro); fclose(fp); // Test parsing of correct xml data, but not macro (should throw an exception). @@ -442,7 +452,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). @@ -459,8 +469,8 @@ int main() yetonandon: unlink(XMLFILE); +*/ - return 0; -} +TEST_END; #endif/*TEST_MACROPARSER*/ -- cgit v1.2.3