Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
d
f
g
i
m
n
p
r
s
t
v
x
Functions
Variables
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
v
w
x
~
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
v
w
x
~
Variables
_
a
b
c
d
e
f
h
i
l
m
p
r
s
Typedefs
Enumerations
Enumerator
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
w
x
Functions
_
a
b
c
e
h
i
l
m
n
o
p
s
t
Variables
a
b
c
d
e
f
g
h
l
n
p
r
s
x
Enumerations
Enumerator
Macros
test
test/TestXml.cpp
Go to the documentation of this file.
1
/*
2
* Unit tests for XmlRpc++
3
*
4
* Copyright (C) 2017, Zoox Inc
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*
20
* Author: Austin Hendrix <austin@zoox.com>
21
* Loosely based on the original TestXml.cpp by Chris Morley
22
*
23
*/
24
25
// TestXml.cpp : Test XML encoding and decoding.
26
// The characters <>&'" are illegal in xml and must be encoded.
27
28
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
29
30
#include <iostream>
31
// If you are using MSVC++6, you should update <string> to fix
32
// BUG: getline Template Function Reads Extra Character
33
#include <string>
34
#include <stdlib.h>
35
36
#include "
xmlrpcpp/XmlRpcUtil.h
"
37
38
#include <gtest/gtest.h>
39
40
using namespace
XmlRpc
;
41
42
TEST
(
XmlRpc
, BasicXml) {
43
// Basic tests
44
std::string empty;
45
EXPECT_EQ(empty,
XmlRpcUtil::xmlEncode
(empty));
46
EXPECT_EQ(empty,
XmlRpcUtil::xmlDecode
(empty));
47
EXPECT_EQ(empty,
XmlRpcUtil::xmlEncode
(
""
));
48
EXPECT_EQ(empty,
XmlRpcUtil::xmlDecode
(
""
));
49
50
std::string raw(
"<>&'\""
);
51
EXPECT_EQ(
XmlRpcUtil::xmlDecode
(
XmlRpcUtil::xmlEncode
(raw)), raw);
52
}
53
54
int
main
(
int
argc,
char
**argv)
55
{
56
::testing::InitGoogleTest(&argc, argv);
57
return
RUN_ALL_TESTS();
58
}
XmlRpc::XmlRpcUtil::xmlEncode
static std::string xmlEncode(const std::string &raw)
Convert raw text to encoded xml.
Definition:
XmlRpcUtil.cpp:299
XmlRpc
Definition:
XmlRpcClient.h:20
XmlRpc::TEST
TEST(xmlrpcvalue_base64, empty_string)
Definition:
xmlrpcvalue_base64.cpp:52
main
int main(int argc, char **argv)
Definition:
test/TestXml.cpp:54
XmlRpc::XmlRpcUtil::xmlDecode
static std::string xmlDecode(const std::string &encoded)
Convert encoded xml to raw text.
Definition:
XmlRpcUtil.cpp:262
XmlRpcUtil.h
xmlrpcpp
Author(s): Chris Morley, Konstantin Pilipchuk, Morgan Quigley, Austin Hendrix, Dirk Thomas
, Jacob Perron
autogenerated on Sat Sep 14 2024 02:59:32