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/macroparser.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/macroparser.cc')
-rw-r--r-- | server/src/macroparser.cc | 24 |
1 files changed, 17 insertions, 7 deletions
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 <test.h> #define XMLFILE "/tmp/test_macroheaderparser.xml" @@ -368,6 +372,7 @@ Macro *MacroParser::getMacro() #include <stdio.h> #include <memory.h> +/* static char xml[] = "<?xml version='1.0' encoding='UTF-8'?>\n" "<macro name=\"testmacro\" version=\"1.0\">\n" @@ -394,15 +399,20 @@ static char xml_fail[] = " <someothertag/>\n" "</macro>" ; +*/ -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*/ |