summaryrefslogtreecommitdiff
path: root/server/src/macroheaderparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/macroheaderparser.cc')
-rw-r--r--server/src/macroheaderparser.cc52
1 files changed, 31 insertions, 21 deletions
diff --git a/server/src/macroheaderparser.cc b/server/src/macroheaderparser.cc
index 0ad18d4..c8d5fb2 100644
--- a/server/src/macroheaderparser.cc
+++ b/server/src/macroheaderparser.cc
@@ -144,6 +144,10 @@ Macro *MacroHeaderParser::getMacro()
}
#ifdef TEST_MACROHEADERPARSER
+//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"
@@ -154,6 +158,7 @@ Macro *MacroHeaderParser::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"
@@ -177,34 +182,39 @@ static char xml_fail[] =
" <someothertag/>\n"
"</macro>"
;
+*/
+
+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, "%s", xml);
+fclose(fp);
-int main()
{
- FILE *fp = fopen(XMLFILE, "w");
- if(!fp) {
- printf("Could not write to %s\n", XMLFILE);
+ // Test parsing of correct macro xml data.
+ MacroHeaderParser parser(XMLFILE);
+ try {
+ parser.parse();
+ } catch(Exception &e) {
+ printf("Failed to parse: %s\n", e.what());
return 1;
}
- fprintf(fp, xml);
- fclose(fp);
-
- {
- // Test parsing of correct macro xml data.
- MacroHeaderParser parser(XMLFILE);
- try {
- parser.parse();
- } catch(Exception &e) {
- printf("Failed to parse: %s\n", e.what());
- return 1;
- }
- }
+}
fp = fopen(XMLFILE, "w");
if(!fp) {
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).
@@ -225,7 +235,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).
@@ -242,8 +252,8 @@ int main()
yetonandon:
unlink(XMLFILE);
+*/
- return 0;
-}
+TEST_END;
#endif/*TEST_MACROHEADERPARSER*/