3#define _CRTDBG_MAP_ALLOC
22 XmlRpcValue booleanFalseXml(
"<value><boolean>0</boolean></value>", &offset);
24 XmlRpcValue booleanTrueXml(
"<value><boolean>1</boolean></value>", &offset);
25 assert(booleanFalse != booleanTrue);
26 assert(booleanFalse == booleanFalseXml);
27 assert(booleanFalse == booleanFalseXml);
45 XmlRpcValue int0Xml(
"<value><int>0</int></value>", &offset);
47 XmlRpcValue int9Xml(
"<value><i4>9</i4></value>", &offset);
48 assert(int0 == int0Xml);
49 assert(
int(int10) -
int(int1) ==
int(int9Xml));
50 assert(9 ==
int(int9Xml));
51 assert(
int(int10) +
int(int_1) ==
int(int9Xml));
59 XmlRpcValue dXml(
"<value><double>56.3</double></value>", &offset);
60 assert(
double(d) +
double(dXml) == 100.0);
67 char csxml[] =
"<value><string>Now is the time <&</string></value>";
68 std::string ssxml = csxml;
80 std::string emptyStringXml(
"<value></value>");
82 XmlRpcValue emptyStringVal1(emptyStringXml, &offset);
84 assert(emptyStringVal1 == emptyStringVal2);
86 emptyStringXml =
"<value> </value>";
88 XmlRpcValue blankStringVal(emptyStringXml, &offset);
89 assert(std::string(blankStringVal) ==
" ");
97 XmlRpcValue dateTime(
"<value><dateTime.iso8601>19040101T03:12:35</dateTime.iso8601></value>", &offset);
98 struct tm &
t = dateTime;
99 assert(
t.tm_year == 1904 &&
t.tm_min == 12);
109 a[1] = std::string(
"two");
112 assert(
int(a[0]) == 1);
118 " <value><i4>1</i4></value> \n"
119 " <value> <string>two</string></value>\n"
120 " <value><double>43.7</double></value>\n"
121 " <value>four</value>\n"
135 struct1[
"str"] =
"two";
141 a[1] = std::string(
"two");
145 assert(struct1[
"d"] == a[2]);
150 " <name>i4</name> \n"
151 " <value><i4>1</i4></value> \n"
155 " <value><double>43.7</double></value>\n"
158 " <name>str</name> \n"
159 " <value> <string>two</string></value>\n"
165 assert(struct1 == structXml);
168 astruct[
"array"] = a;
169 assert(astruct[
"array"][2] == struct1[
"d"]);
171 for (
int i=0; i<10; i++) {
173 Event[
"Name"] =
"string";
177 const int NELMTS = 100;
180 for (ii=0; ii< NELMTS; ++ii) {
188 for (ii=0; ii< NELMTS; ++ii) {
194 for (
int jj=0; jj< NELMTS; ++jj) {
197 Event[buf][bufj] = bufj;
201 for (ii=0; ii< NELMTS; ++ii) {
207 assert(
Event[buf].size() == NELMTS);
214int main(
int argc,
char* argv[])
216 _CrtDumpMemoryLeaks();
220 _CrtDumpMemoryLeaks();
224 _CrtDumpMemoryLeaks();
229 _CrtDumpMemoryLeaks();
234 _CrtDumpMemoryLeaks();
239 _CrtDumpMemoryLeaks();
244 _CrtDumpMemoryLeaks();
249 _CrtDumpMemoryLeaks();
void testArray(XmlRpcValue const &d)
RPC method arguments and results are represented by Values.
std::string toXml() const
Encode the Value in xml.
void setSize(int size)
Specify the size for array values. Array values will grow beyond this size if needed.
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)