summaryrefslogtreecommitdiff
path: root/server/src/xml_encode_decode.cc
diff options
context:
space:
mode:
authordeva <deva>2011-02-17 11:00:14 +0000
committerdeva <deva>2011-02-17 11:00:14 +0000
commitdb144840aba95affb3a6b5b2536059f49f0677ff (patch)
tree1c397a20aa5745c6bbb5dee6a4409f58c4542e87 /server/src/xml_encode_decode.cc
parentc8651b8c89673300477ab86962640c93216ea306 (diff)
Rewrite of all old tests to new unittest framework. Also some work on testdb; more to come...
Diffstat (limited to 'server/src/xml_encode_decode.cc')
-rw-r--r--server/src/xml_encode_decode.cc29
1 files changed, 14 insertions, 15 deletions
diff --git a/server/src/xml_encode_decode.cc b/server/src/xml_encode_decode.cc
index 427e451..1c0e377 100644
--- a/server/src/xml_encode_decode.cc
+++ b/server/src/xml_encode_decode.cc
@@ -82,23 +82,22 @@ std::string xml_decode(std::string str)
}
#ifdef TEST_XML_ENCODE_DECODE
+//deps:
+//cflags:
+//libs:
+#include <test.h>
-int main()
-{
- std::string in = "&A<B>C\"D\'<>\"&amp;E<>";
- std::string enc = xml_encode(in);
- std::string denc = xml_encode(enc);
- std::string dec = xml_decode(denc);
- std::string ddec = xml_decode(dec);
+TEST_BEGIN;
- printf("Input: \"%s\" %d\n", in.c_str(), in.length());
- printf("Encoded: \"%s\" %d\n", enc.c_str(), enc.length());
- printf("DoubleEncoded: \"%s\" %d\n", denc.c_str(), denc.length());
- printf("Decoded: \"%s\" %d\n", dec.c_str(), dec.length());
- printf("DoubleDecoded: \"%s\" %d\n", ddec.c_str(), ddec.length());
+std::string in = "&A<B>C\"D\'<>\"&amp;E<>";
+std::string enc = xml_encode(in);
+std::string denc = xml_encode(enc);
+std::string dec = xml_decode(denc);
+std::string ddec = xml_decode(dec);
- if( in == ddec && enc == dec) return 0;
- return 1;
-}
+TEST_EQUAL_STR(in, ddec, "compare");
+TEST_EQUAL_STR(enc, dec, "compare");
+
+TEST_END;
#endif/*TEST_XML_ENCODE_DECODE*/