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/xml_encode_decode.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/xml_encode_decode.cc')
-rw-r--r-- | server/src/xml_encode_decode.cc | 29 |
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\'<>\"&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\'<>\"&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*/ |