1 #include <gtest/gtest.h> 8 int main(
int argc,
char **argv)
10 ::testing::InitGoogleTest(&argc, argv);
11 return RUN_ALL_TESTS();
19 return XmlRpcValue(const_cast<char *>(&data[0]), data.size());
30 data.erase(std::remove(data.begin(), data.end(),
'\n'), data.end());
36 std::string xml =
"<value><base64>" + base64 +
"</base64></value>";
38 std::string generated_xml = value.
toXml();
41 std::stringstream buffer;
43 std::string streamed = buffer.str();
45 ASSERT_EQ(streamed, base64);
47 ASSERT_EQ(generated_xml,
"<value><base64>" + base64 +
"</base64></value>");
48 ASSERT_EQ(parsed_value, value);
52 TEST(xmlrpcvalue_base64, empty_string)
57 TEST(xmlrpcvalue_base64, hello_world)
63 TEST(xmlrpcvalue_base64, random)
66 std::string(
"\261", 1),
70 std::string(
"\341\370", 2),
74 std::string(
"\206\262J", 3),
78 std::string(
"|5Q%", 4),
82 std::string(
"5\220,+X", 5),
86 std::string(
"\247\342\007M@\270", 6),
90 std::string(
"\012\247e\013;\232*", 7),
94 std::string(
"U\374\336w\351-\2503", 8),
98 std::string(
"\264\204`\310\001\306\253g\026", 9),
102 std::string(
"\224\307\217\336|J^\223\237v", 10),
106 std::string(
"~%\305\024\264P)\206\224\247N", 11),
110 std::string(
"-4\355\215Q|\367\332j\013\027\006", 12),
114 std::string(
"\026Q\304\204\244s%\203\023?\364\320\005", 13),
115 "FlHEhKRzJYMTP/TQBQ==" 118 std::string(
"G0\306B\251\351;mwM\312i(\000", 14),
119 "RzDGQqnpO213TcppKAA=" 122 std::string(
"\031kpC)[t\205\026\230\343S\367\016\263", 15),
123 "GWtwQylbdIUWmONT9w6z" 126 std::string(
"B&\134a\013\246u^V\001\260a\247\231}U\3278\367=G\317g\020{\277\042\373", 28),
127 "QiZcYQumdV5WAbBhp5l9Vdc49z1Hz2cQe78i+w==" 130 std::string(
"[>\303\210`\270o\023FJ\004r\360\361\357\2517\345\204|\245\267P \247V\251v\025", 29),
131 "Wz7DiGC4bxNGSgRy8PHvqTflhHylt1Agp1apdhU=" 134 std::string(
"\264\245\360=\273E%8\023\3138\227k\222WS\227uf\314\345Y\031\365Q\024\331.\210&", 30),
135 "tKXwPbtFJTgTyziXa5JXU5d1ZszlWRn1URTZLogm" 138 std::string(
"II\036\326\353\232T\221/\021\3265F}\2647A)O\2302CLY?\367O\261E\246\332\376\333\230\343\326_\373\303\225\343\351\354[\326~\264\034\305\035V\227\034\331[\012\263Y", 58),
139 "SUke1uuaVJEvEdY1Rn20N0EpT5gyQ0xZP/dPsUWm2v7bmOPWX/vDlePp7FvWfrQcxR1WlxzZWwqzWQ==" 142 std::string(
"\353\317\000-\333\230\2701\251\310&J\225\347+\221q\245tb\336\225\350\323\310\327*q\261&;\2448\033X\346\277\245GM\216Oz\365\025K1\341w\230\277\272*\365\343\204\376\334E", 59),
143 "688ALduYuDGpyCZKlecrkXGldGLelejTyNcqcbEmO6Q4G1jmv6VHTY5PevUVSzHhd5i/uir144T+3EU=" 146 std::string(
"\235\232\352\362\304\351n\244\227\220\202hh\226\346\271\042\021d\362c\267\260\310`\000\034\247\215\350\013;#2\204(^_\333w\2233\374\337\205\253y\372\352\305F-\200v\034\331\216\205\011", 60),
147 "nZrq8sTpbqSXkIJoaJbmuSIRZPJjt7DIYAAcp43oCzsjMoQoXl/bd5Mz/N+Fq3n66sVGLX+AdhzZjoUJ"
RPC method arguments and results are represented by Values.
TEST(xmlrpcvalue_base64, empty_string)
int main(int argc, char **argv)
XmlRpcValue base64Value(std::string const &data)
std::string toXml() const
Encode the Value in xml.
std::ostream & write(std::ostream &os) const
Write the value (no xml encoding)
void assertEncodeDecode(std::string const &raw, std::string const &base64)
XmlRpcValue fromXml(std::string const &data)
void removeNewlines(std::string &data)