#include <iostream>
#include <string>
#include <assert.h>
#include <stdlib.h>
#include "XmlRpcUtil.h"
Go to the source code of this file.
Defines | |
#define | WIN32_LEAN_AND_MEAN |
Functions | |
int | main (int argc, char *argv[]) |
#define WIN32_LEAN_AND_MEAN |
Definition at line 5 of file TestXml.cpp.
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 19 of file TestXml.cpp.
References s, and deljobs::string.
00020 { 00021 // Basic tests 00022 std::string empty; 00023 assert(empty == XmlRpcUtil::xmlEncode(empty)); 00024 assert(empty == XmlRpcUtil::xmlDecode(empty)); 00025 assert(empty == XmlRpcUtil::xmlEncode("")); 00026 assert(empty == XmlRpcUtil::xmlDecode("")); 00027 00028 std::string raw("<>&'\""); 00029 assert(XmlRpcUtil::xmlDecode(XmlRpcUtil::xmlEncode(raw)) == raw); 00030 00031 std::cout << "Basic tests passed.\n"; 00032 00033 // Interactive tests 00034 std::string s; 00035 for (;;) { 00036 std::cout << "\nEnter line of raw text to encode:\n"; 00037 std::getline(std::cin, s); 00038 if (s.empty()) break; 00039 00040 std::cout << XmlRpcUtil::xmlEncode(s) << std::endl; 00041 } 00042 00043 for (;;) { 00044 std::cout << "\nEnter line of xml-encoded text to decode:\n"; 00045 std::getline(std::cin, s); 00046 if (s.empty()) break; 00047 00048 std::cout << XmlRpcUtil::xmlDecode(s) << std::endl; 00049 } 00050 00051 return 0; 00052 }