summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-06-22 20:33:02 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-06-22 20:33:02 -0700
commit4b371e10eed49d25bf4240a6aaa321b084e586ea (patch)
treecb00ecd69d6c43cd9e8e4e9ad2bb84acf92745c4 /tests
parent853333cd709cc063e4f97418c1297f9c83e48d41 (diff)
tests: Remove redundant pugi:: qualifier
Most tests have `using namespace pugi` which makes explicit qualifications unnecessary.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_document.cpp132
-rw-r--r--tests/test_dom_modify.cpp4
-rw-r--r--tests/test_dom_traverse.cpp30
-rw-r--r--tests/test_memory.cpp10
-rw-r--r--tests/test_parse.cpp18
-rw-r--r--tests/test_write.cpp18
-rw-r--r--tests/test_xpath.cpp58
-rw-r--r--tests/test_xpath_parse.cpp2
8 files changed, 136 insertions, 136 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index fd376bb..45b8536 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -60,13 +60,13 @@ static bool test_file_contents(const char* path, const char* data, size_t size)
TEST(document_create_empty)
{
- pugi::xml_document doc;
+ xml_document doc;
CHECK_NODE(doc, STR(""));
}
TEST(document_create)
{
- pugi::xml_document doc;
+ xml_document doc;
doc.append_child().set_name(STR("node"));
CHECK_NODE(doc, STR("<node/>"));
}
@@ -74,7 +74,7 @@ TEST(document_create)
#ifndef PUGIXML_NO_STL
TEST(document_load_stream)
{
- pugi::xml_document doc;
+ xml_document doc;
std::istringstream iss("<node/>");
CHECK(doc.load(iss));
@@ -83,7 +83,7 @@ TEST(document_load_stream)
TEST(document_load_stream_offset)
{
- pugi::xml_document doc;
+ xml_document doc;
std::istringstream iss("<foobar> <node/>");
@@ -96,7 +96,7 @@ TEST(document_load_stream_offset)
TEST(document_load_stream_text)
{
- pugi::xml_document doc;
+ xml_document doc;
std::ifstream iss("tests/data/multiline.xml");
CHECK(doc.load(iss));
@@ -105,7 +105,7 @@ TEST(document_load_stream_text)
TEST(document_load_stream_error)
{
- pugi::xml_document doc;
+ xml_document doc;
std::ifstream fs("filedoesnotexist");
CHECK(doc.load(fs).status == status_io_error);
@@ -113,7 +113,7 @@ TEST(document_load_stream_error)
TEST(document_load_stream_out_of_memory)
{
- pugi::xml_document doc;
+ xml_document doc;
std::istringstream iss("<node/>");
test_runner::_memory_fail_threshold = 1;
@@ -122,7 +122,7 @@ TEST(document_load_stream_out_of_memory)
TEST(document_load_stream_wide_out_of_memory)
{
- pugi::xml_document doc;
+ xml_document doc;
std::basic_istringstream<wchar_t> iss(L"<node/>");
test_runner::_memory_fail_threshold = 1;
@@ -133,14 +133,14 @@ TEST(document_load_stream_empty)
{
std::istringstream iss;
- pugi::xml_document doc;
+ xml_document doc;
doc.load(iss); // parse result depends on STL implementation
CHECK(!doc.first_child());
}
TEST(document_load_stream_wide)
{
- pugi::xml_document doc;
+ xml_document doc;
std::basic_istringstream<wchar_t> iss(L"<node/>");
CHECK(doc.load(iss));
@@ -150,7 +150,7 @@ TEST(document_load_stream_wide)
#ifndef PUGIXML_NO_EXCEPTIONS
TEST(document_load_stream_exceptions)
{
- pugi::xml_document doc;
+ xml_document doc;
// Windows has newline translation for text-mode files, so reading from this stream reaches eof and sets fail|eof bits.
// This test does not cause stream to throw an exception on Linux - I have no idea how to get read() to fail except
@@ -173,7 +173,7 @@ TEST(document_load_stream_exceptions)
TEST(document_load_stream_error_previous)
{
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_string(STR("<node/>")));
CHECK(doc.first_child());
@@ -184,7 +184,7 @@ TEST(document_load_stream_error_previous)
TEST(document_load_stream_wide_error_previous)
{
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_string(STR("<node/>")));
CHECK(doc.first_child());
@@ -208,7 +208,7 @@ TEST(document_load_stream_nonseekable)
char_array_buffer<char> buffer(contents, contents + sizeof(contents) / sizeof(contents[0]));
std::istream in(&buffer);
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load(in));
CHECK_NODE(doc, STR("<node/>"));
}
@@ -219,22 +219,22 @@ TEST(document_load_stream_wide_nonseekable)
char_array_buffer<wchar_t> buffer(contents, contents + sizeof(contents) / sizeof(contents[0]));
std::basic_istream<wchar_t> in(&buffer);
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load(in));
CHECK_NODE(doc, STR("<node/>"));
}
TEST(document_load_stream_nonseekable_large)
{
- std::basic_string<pugi::char_t> str;
+ std::basic_string<char_t> str;
str += STR("<node>");
for (int i = 0; i < 10000; ++i) str += STR("<node/>");
str += STR("</node>");
- char_array_buffer<pugi::char_t> buffer(&str[0], &str[0] + str.length());
- std::basic_istream<pugi::char_t> in(&buffer);
+ char_array_buffer<char_t> buffer(&str[0], &str[0] + str.length());
+ std::basic_istream<char_t> in(&buffer);
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load(in));
CHECK_NODE(doc, str.c_str());
}
@@ -247,7 +247,7 @@ TEST(document_load_stream_nonseekable_out_of_memory)
test_runner::_memory_fail_threshold = 1;
- pugi::xml_document doc;
+ xml_document doc;
CHECK_ALLOC_FAIL(CHECK(doc.load(in).status == status_out_of_memory));
}
@@ -259,7 +259,7 @@ TEST(document_load_stream_wide_nonseekable_out_of_memory)
test_runner::_memory_fail_threshold = 1;
- pugi::xml_document doc;
+ xml_document doc;
CHECK_ALLOC_FAIL(CHECK(doc.load(in).status == status_out_of_memory));
}
@@ -275,7 +275,7 @@ TEST(document_load_stream_nonseekable_out_of_memory_large)
test_runner::_memory_fail_threshold = 10000 * 8 * 3 / 2;
- pugi::xml_document doc;
+ xml_document doc;
CHECK_ALLOC_FAIL(CHECK(doc.load(in).status == status_out_of_memory));
}
@@ -291,7 +291,7 @@ TEST(document_load_stream_wide_nonseekable_out_of_memory_large)
test_runner::_memory_fail_threshold = 10000 * 8 * 3 / 2;
- pugi::xml_document doc;
+ xml_document doc;
CHECK_ALLOC_FAIL(CHECK(doc.load(in).status == status_out_of_memory));
}
@@ -310,7 +310,7 @@ TEST(document_load_stream_seekable_fail_seek)
seek_fail_buffer<char> buffer;
std::basic_istream<char> in(&buffer);
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load(in).status == status_io_error);
}
@@ -319,14 +319,14 @@ TEST(document_load_stream_wide_seekable_fail_seek)
seek_fail_buffer<wchar_t> buffer;
std::basic_istream<wchar_t> in(&buffer);
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load(in).status == status_io_error);
}
#endif
TEST(document_load_string)
{
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_string(STR("<node/>")));
CHECK_NODE(doc, STR("<node/>"));
@@ -334,7 +334,7 @@ TEST(document_load_string)
TEST(document_load_file)
{
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_file("tests/data/small.xml"));
CHECK_NODE(doc, STR("<node/>"));
@@ -342,7 +342,7 @@ TEST(document_load_file)
TEST(document_load_file_empty)
{
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_file("tests/data/empty.xml").status == status_no_document_element);
CHECK(!doc.first_child());
@@ -350,11 +350,11 @@ TEST(document_load_file_empty)
TEST(document_load_file_large)
{
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_file("tests/data/large.xml"));
- std::basic_string<pugi::char_t> str;
+ std::basic_string<char_t> str;
str += STR("<node>");
for (int i = 0; i < 10000; ++i) str += STR("<node/>");
str += STR("</node>");
@@ -364,7 +364,7 @@ TEST(document_load_file_large)
TEST(document_load_file_error)
{
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_file("filedoesnotexist").status == status_file_not_found);
}
@@ -373,7 +373,7 @@ TEST(document_load_file_out_of_memory)
{
test_runner::_memory_fail_threshold = 1;
- pugi::xml_document doc;
+ xml_document doc;
CHECK_ALLOC_FAIL(CHECK(doc.load_file("tests/data/small.xml").status == status_out_of_memory));
}
@@ -381,7 +381,7 @@ TEST(document_load_file_out_of_memory_file_leak)
{
test_runner::_memory_fail_threshold = 1;
- pugi::xml_document doc;
+ xml_document doc;
for (int i = 0; i < 256; ++i)
CHECK_ALLOC_FAIL(CHECK(doc.load_file("tests/data/small.xml").status == status_out_of_memory));
@@ -396,7 +396,7 @@ TEST(document_load_file_wide_out_of_memory_file_leak)
{
test_runner::_memory_fail_threshold = 256;
- pugi::xml_document doc;
+ xml_document doc;
for (int i = 0; i < 256; ++i)
CHECK_ALLOC_FAIL(CHECK(doc.load_file(L"tests/data/small.xml").status == status_out_of_memory));
@@ -409,7 +409,7 @@ TEST(document_load_file_wide_out_of_memory_file_leak)
TEST(document_load_file_error_previous)
{
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_string(STR("<node/>")));
CHECK(doc.first_child());
@@ -419,7 +419,7 @@ TEST(document_load_file_error_previous)
TEST(document_load_file_wide_ascii)
{
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_file(L"tests/data/small.xml"));
CHECK_NODE(doc, STR("<node/>"));
@@ -428,7 +428,7 @@ TEST(document_load_file_wide_ascii)
#if !defined(__DMC__) && !defined(__MWERKS__) && !(defined(__MINGW32__) && defined(__STRICT_ANSI__) && !defined(__MINGW64_VERSION_MAJOR)) && !defined(__BORLANDC__)
TEST(document_load_file_wide_unicode)
{
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_file(L"tests/data/\x0442\x0435\x0441\x0442.xml"));
CHECK_NODE(doc, STR("<node/>"));
@@ -439,9 +439,9 @@ TEST(document_load_file_wide_out_of_memory)
{
test_runner::_memory_fail_threshold = 1;
- pugi::xml_document doc;
+ xml_document doc;
- pugi::xml_parse_result result;
+ xml_parse_result result;
result.status = status_out_of_memory;
CHECK_ALLOC_FAIL(result = doc.load_file(L"tests/data/small.xml"));
@@ -469,7 +469,7 @@ TEST_XML(document_save, "<node/>")
{
xml_writer_string writer;
- doc.save(writer, STR(""), pugi::format_no_declaration | pugi::format_raw, get_native_encoding());
+ doc.save(writer, STR(""), format_no_declaration | format_raw, get_native_encoding());
CHECK(writer.as_string() == STR("<node/>"));
}
@@ -479,7 +479,7 @@ TEST_XML(document_save_stream, "<node/>")
{
std::ostringstream oss;
- doc.save(oss, STR(""), pugi::format_no_declaration | pugi::format_raw);
+ doc.save(oss, STR(""), format_no_declaration | format_raw);
CHECK(oss.str() == "<node/>");
}
@@ -488,7 +488,7 @@ TEST_XML(document_save_stream_wide, "<node/>")
{
std::basic_ostringstream<wchar_t> oss;
- doc.save(oss, STR(""), pugi::format_no_declaration | pugi::format_raw);
+ doc.save(oss, STR(""), format_no_declaration | format_raw);
CHECK(oss.str() == L"<node/>");
}
@@ -518,7 +518,7 @@ TEST_XML(document_save_declaration, "<node/>")
{
xml_writer_string writer;
- doc.save(writer, STR(""), pugi::format_default, get_native_encoding());
+ doc.save(writer, STR(""), format_default, get_native_encoding());
CHECK(writer.as_string() == STR("<?xml version=\"1.0\"?>\n<node />\n"));
}
@@ -529,7 +529,7 @@ TEST(document_save_declaration_empty)
xml_writer_string writer;
- doc.save(writer, STR(""), pugi::format_default, get_native_encoding());
+ doc.save(writer, STR(""), format_default, get_native_encoding());
CHECK(writer.as_string() == STR("<?xml version=\"1.0\"?>\n"));
}
@@ -540,7 +540,7 @@ TEST_XML(document_save_declaration_present_first, "<node/>")
xml_writer_string writer;
- doc.save(writer, STR(""), pugi::format_default, get_native_encoding());
+ doc.save(writer, STR(""), format_default, get_native_encoding());
CHECK(writer.as_string() == STR("<?xml encoding=\"utf8\"?>\n<node />\n"));
}
@@ -552,7 +552,7 @@ TEST_XML(document_save_declaration_present_second, "<node/>")
xml_writer_string writer;
- doc.save(writer, STR(""), pugi::format_default, get_native_encoding());
+ doc.save(writer, STR(""), format_default, get_native_encoding());
CHECK(writer.as_string() == STR("<!--text-->\n<?xml encoding=\"utf8\"?>\n<node />\n"));
}
@@ -563,7 +563,7 @@ TEST_XML(document_save_declaration_present_last, "<node/>")
xml_writer_string writer;
- doc.save(writer, STR(""), pugi::format_default, get_native_encoding());
+ doc.save(writer, STR(""), format_default, get_native_encoding());
// node writer only looks for declaration before the first element child
CHECK(writer.as_string() == STR("<?xml version=\"1.0\"?>\n<node />\n<?xml encoding=\"utf8\"?>\n"));
@@ -573,7 +573,7 @@ TEST_XML(document_save_declaration_latin1, "<node/>")
{
xml_writer_string writer;
- doc.save(writer, STR(""), pugi::format_default, encoding_latin1);
+ doc.save(writer, STR(""), format_default, encoding_latin1);
CHECK(writer.as_narrow() == "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<node />\n");
}
@@ -582,7 +582,7 @@ TEST_XML(document_save_declaration_raw, "<node/>")
{
xml_writer_string writer;
- doc.save(writer, STR(""), pugi::format_raw, get_native_encoding());
+ doc.save(writer, STR(""), format_raw, get_native_encoding());
CHECK(writer.as_string() == STR("<?xml version=\"1.0\"?><node/>"));
}
@@ -611,7 +611,7 @@ TEST_XML(document_save_file, "<node/>")
CHECK(doc.save_file(f.path));
- CHECK(doc.load_file(f.path, pugi::parse_default | pugi::parse_declaration));
+ CHECK(doc.load_file(f.path, parse_default | parse_declaration));
CHECK_NODE(doc, STR("<?xml version=\"1.0\"?><node/>"));
}
@@ -625,7 +625,7 @@ TEST_XML(document_save_file_wide, "<node/>")
CHECK(doc.save_file(wpath));
- CHECK(doc.load_file(f.path, pugi::parse_default | pugi::parse_declaration));
+ CHECK(doc.load_file(f.path, parse_default | parse_declaration));
CHECK_NODE(doc, STR("<?xml version=\"1.0\"?><node/>"));
}
@@ -638,10 +638,10 @@ TEST_XML(document_save_file_text, "<node/>")
{
temp_file f;
- CHECK(doc.save_file(f.path, STR(""), pugi::format_no_declaration | pugi::format_save_file_text));
+ CHECK(doc.save_file(f.path, STR(""), format_no_declaration | format_save_file_text));
CHECK(test_file_contents(f.path, "<node />\n", 9) || test_file_contents(f.path, "<node />\r\n", 10));
- CHECK(doc.save_file(f.path, STR(""), pugi::format_no_declaration));
+ CHECK(doc.save_file(f.path, STR(""), format_no_declaration));
CHECK(test_file_contents(f.path, "<node />\n", 9));
}
@@ -653,10 +653,10 @@ TEST_XML(document_save_file_wide_text, "<node/>")
wchar_t wpath[sizeof(f.path)];
std::copy(f.path, f.path + strlen(f.path) + 1, wpath + 0);
- CHECK(doc.save_file(wpath, STR(""), pugi::format_no_declaration | pugi::format_save_file_text));
+ CHECK(doc.save_file(wpath, STR(""), format_no_declaration | format_save_file_text));
CHECK(test_file_contents(f.path, "<node />\n", 9) || test_file_contents(f.path, "<node />\r\n", 10));
- CHECK(doc.save_file(wpath, STR(""), pugi::format_no_declaration));
+ CHECK(doc.save_file(wpath, STR(""), format_no_declaration));
CHECK(test_file_contents(f.path, "<node />\n", 9));
}
@@ -682,9 +682,9 @@ TEST_XML(document_save_file_wide_leak, "<node/>")
TEST(document_load_buffer)
{
- const pugi::char_t text[] = STR("<?xml?><node/>");
+ const char_t text[] = STR("<?xml?><node/>");
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_buffer(text, sizeof(text)));
CHECK_NODE(doc, STR("<node/>"));
@@ -692,9 +692,9 @@ TEST(document_load_buffer)
TEST(document_load_buffer_inplace)
{
- pugi::char_t text[] = STR("<?xml?><node/>");
+ char_t text[] = STR("<?xml?><node/>");
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_buffer_inplace(text, sizeof(text)));
CHECK_NODE(doc, STR("<node/>"));
@@ -704,14 +704,14 @@ TEST(document_load_buffer_inplace_own)
{
allocation_function alloc = get_memory_allocation_function();
- size_t size = strlen("<?xml?><node/>") * sizeof(pugi::char_t);
+ size_t size = strlen("<?xml?><node/>") * sizeof(char_t);
- pugi::char_t* text = static_cast<pugi::char_t*>(alloc(size));
+ char_t* text = static_cast<char_t*>(alloc(size));
CHECK(text);
memcpy(text, STR("<?xml?><node/>"), size);
- pugi::xml_document doc;
+ xml_document doc;
CHECK(doc.load_buffer_inplace_own(text, size));
CHECK_NODE(doc, STR("<node/>"));
@@ -763,7 +763,7 @@ inline void check_utftest_document(const xml_document& doc)
CHECK(static_cast<unsigned int>(doc.last_child().last_child().name()[0]) >= 0x80);
// check magic string
- const pugi::char_t* v = doc.last_child().child(STR("Heavy")).previous_sibling().child_value();
+ const char_t* v = doc.last_child().child(STR("Heavy")).previous_sibling().child_value();
#ifdef PUGIXML_WCHAR_MODE
CHECK(v[0] == 0x4e16 && v[1] == 0x754c && v[2] == 0x6709 && v[3] == 0x5f88 && v[4] == 0x591a && v[5] == wchar_cast(0x8bed) && v[6] == wchar_cast(0x8a00));
@@ -1097,7 +1097,7 @@ TEST(document_load_buffer_empty)
CHECK(doc.load_buffer_inplace(buffer, 0, parse_default, encoding).status == status_no_document_element && !doc.first_child());
CHECK(doc.load_buffer_inplace(0, 0, parse_default, encoding).status == status_no_document_element && !doc.first_child());
- void* own_buffer = pugi::get_memory_allocation_function()(1);
+ void* own_buffer = get_memory_allocation_function()(1);
CHECK(doc.load_buffer_inplace_own(own_buffer, 0, parse_default, encoding).status == status_no_document_element && !doc.first_child());
CHECK(doc.load_buffer_inplace_own(0, 0, parse_default, encoding).status == status_no_document_element && !doc.first_child());
@@ -1133,7 +1133,7 @@ TEST(document_load_buffer_empty_fragment)
CHECK(doc.load_buffer_inplace(buffer, 0, parse_fragment, encoding) && !doc.first_child());
CHECK(doc.load_buffer_inplace(0, 0, parse_fragment, encoding) && !doc.first_child());
- void* own_buffer = pugi::get_memory_allocation_function()(1);
+ void* own_buffer = get_memory_allocation_function()(1);
CHECK(doc.load_buffer_inplace_own(own_buffer, 0, parse_fragment, encoding) && !doc.first_child());
CHECK(doc.load_buffer_inplace_own(0, 0, parse_fragment, encoding) && !doc.first_child());
@@ -1249,7 +1249,7 @@ TEST(document_load_exceptions)
try
{
- pugi::xml_document doc;
+ xml_document doc;
if (!doc.load_string(STR("<node attribute='value"))) throw std::bad_alloc();
CHECK_FORCE_FAIL("Expected parsing failure");
diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp
index 7b26c5f..c863c6f 100644
--- a/tests/test_dom_modify.cpp
+++ b/tests/test_dom_modify.cpp
@@ -171,8 +171,8 @@ TEST_XML(dom_attr_assign_large_number_float, "<node attr='' />")
node.attribute(STR("attr")) = std::numeric_limits<float>::max();
- CHECK(test_node(node, STR("<node attr=\"3.40282347e+038\"/>"), STR(""), pugi::format_raw) ||
- test_node(node, STR("<node attr=\"3.40282347e+38\"/>"), STR(""), pugi::format_raw));
+ CHECK(test_node(node, STR("<node attr=\"3.40282347e+038\"/>"), STR(""), format_raw) ||
+ test_node(node, STR("<node attr=\"3.40282347e+38\"/>"), STR(""), format_raw));
}
TEST_XML(dom_attr_assign_large_number_double, "<node attr='' />")
diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp
index 3d30a82..4dc6cda 100644
--- a/tests/test_dom_traverse.cpp
+++ b/tests/test_dom_traverse.cpp
@@ -337,11 +337,11 @@ TEST_XML(dom_attr_iterator_invalidate, "<node><node1 attr1='0'/><node2 attr1='0'
TEST_XML(dom_attr_iterator_const, "<node attr1='0' attr2='1'/>")
{
- pugi::xml_node node = doc.child(STR("node"));
+ xml_node node = doc.child(STR("node"));
- const pugi::xml_attribute_iterator i1 = node.attributes_begin();
- const pugi::xml_attribute_iterator i2 = ++xml_attribute_iterator(i1);
- const pugi::xml_attribute_iterator i3 = ++xml_attribute_iterator(i2);
+ const xml_attribute_iterator i1 = node.attributes_begin();
+ const xml_attribute_iterator i2 = ++xml_attribute_iterator(i1);
+ const xml_attribute_iterator i3 = ++xml_attribute_iterator(i2);
CHECK(*i1 == node.attribute(STR("attr1")));
CHECK(*i2 == node.attribute(STR("attr2")));
@@ -459,11 +459,11 @@ TEST_XML(dom_node_iterator_invalidate, "<node><node1><child1/></node1><node2><ch
TEST_XML(dom_node_iterator_const, "<node><child1/><child2/></node>")
{
- pugi::xml_node node = doc.child(STR("node"));
+ xml_node node = doc.child(STR("node"));
- const pugi::xml_node_iterator i1 = node.begin();
- const pugi::xml_node_iterator i2 = ++xml_node_iterator(i1);
- const pugi::xml_node_iterator i3 = ++xml_node_iterator(i2);
+ const xml_node_iterator i1 = node.begin();
+ const xml_node_iterator i2 = ++xml_node_iterator(i1);
+ const xml_node_iterator i3 = ++xml_node_iterator(i2);
CHECK(*i1 == node.child(STR("child1")));
CHECK(*i2 == node.child(STR("child2")));
@@ -669,9 +669,9 @@ struct find_predicate_const
struct find_predicate_prefix
{
- const pugi::char_t* prefix;
+ const char_t* prefix;
- find_predicate_prefix(const pugi::char_t* prefix_): prefix(prefix_)
+ find_predicate_prefix(const char_t* prefix_): prefix(prefix_)
{
}
@@ -679,7 +679,7 @@ struct find_predicate_prefix
{
#ifdef PUGIXML_WCHAR_MODE
// can't use wcsncmp here because of a bug in DMC
- return std::basic_string<pugi::char_t>(obj.name()).compare(0, wcslen(prefix), prefix) == 0;
+ return std::basic_string<char_t>(obj.name()).compare(0, wcslen(prefix), prefix) == 0;
#else
return strncmp(obj.name(), prefix, strlen(prefix)) == 0;
#endif
@@ -782,7 +782,7 @@ TEST_XML(dom_node_first_element_by_path, "<node><child1>text<child2/></child1></
struct test_walker: xml_tree_walker
{
- std::basic_string<pugi::char_t> log;
+ std::basic_string<char_t> log;
unsigned int call_count;
unsigned int stop_count;
@@ -790,7 +790,7 @@ struct test_walker: xml_tree_walker
{
}
- std::basic_string<pugi::char_t> depthstr() const
+ std::basic_string<char_t> depthstr() const
{
char buf[32];
sprintf(buf, "%d", depth());
@@ -799,9 +799,9 @@ struct test_walker: xml_tree_walker
wchar_t wbuf[32];
std::copy(buf, buf + strlen(buf) + 1, &wbuf[0]);
- return std::basic_string<pugi::char_t>(wbuf);
+ return std::basic_string<char_t>(wbuf);
#else
- return std::basic_string<pugi::char_t>(buf);
+ return std::basic_string<char_t>(buf);
#endif
}
diff --git a/tests/test_memory.cpp b/tests/test_memory.cpp
index 14c9aff..becb89b 100644
--- a/tests/test_memory.cpp
+++ b/tests/test_memory.cpp
@@ -56,7 +56,7 @@ TEST(memory_custom_memory_management)
CHECK(page_allocs == 1 && page_deallocs == 0);
// modify document (new page)
- std::basic_string<pugi::char_t> s(65536, 'x');
+ std::basic_string<char_t> s(65536, 'x');
CHECK(doc.first_child().set_name(s.c_str()));
CHECK(page_allocs == 2 && page_deallocs == 0);
@@ -93,7 +93,7 @@ TEST(memory_large_allocations)
// initial fill
for (size_t i = 0; i < 128; ++i)
{
- std::basic_string<pugi::char_t> s(i * 128, 'x');
+ std::basic_string<char_t> s(i * 128, 'x');
CHECK(doc.append_child(node_pcdata).set_value(s.c_str()));
}
@@ -103,12 +103,12 @@ TEST(memory_large_allocations)
// grow-prune loop
while (doc.first_child())
{
- pugi::xml_node node;
+ xml_node node;
// grow
for (node = doc.first_child(); node; node = node.next_sibling())
{
- std::basic_string<pugi::char_t> s = node.value();
+ std::basic_string<char_t> s = node.value();
CHECK(node.set_value((s + s).c_str()));
}
@@ -116,7 +116,7 @@ TEST(memory_large_allocations)
// prune
for (node = doc.first_child(); node; )
{
- pugi::xml_node next = node.next_sibling().next_sibling();
+ xml_node next = node.next_sibling().next_sibling();
node.parent().remove_child(node);
diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp
index cd3f9c0..a0af591 100644
--- a/tests/test_parse.cpp
+++ b/tests/test_parse.cpp
@@ -290,8 +290,8 @@ TEST(parse_ws_pcdata_permutations)
struct test_data_t
{
unsigned int mask; // 1 = default flags, 2 = parse_ws_pcdata, 4 = parse_ws_pcdata_single
- const pugi::char_t* source;
- const pugi::char_t* result;
+ const char_t* source;
+ const char_t* result;
int nodes; // negative if parsing should fail
};
@@ -359,8 +359,8 @@ TEST(parse_ws_pcdata_fragment_permutations)
struct test_data_t
{
unsigned int mask; // 1 = default flags, 2 = parse_ws_pcdata, 4 = parse_ws_pcdata_single
- const pugi::char_t* source;
- const pugi::char_t* result;
+ const char_t* source;
+ const char_t* result;
int nodes; // negative if parsing should fail
};
@@ -439,8 +439,8 @@ TEST(parse_pcdata_trim)
{
struct test_data_t
{
- const pugi::char_t* source;
- const pugi::char_t* result;
+ const char_t* source;
+ const char_t* result;
unsigned int flags;
};
@@ -472,7 +472,7 @@ TEST(parse_pcdata_trim)
xml_document doc;
CHECK(doc.load_string(td.source, td.flags | parse_trim_pcdata));
- const pugi::char_t* value = doc.child(STR("node")) ? doc.child_value(STR("node")) : doc.text().get();
+ const char_t* value = doc.child(STR("node")) ? doc.child_value(STR("node")) : doc.text().get();
CHECK_STRING(value, td.result);
}
}
@@ -561,7 +561,7 @@ TEST(parse_escapes_unicode)
CHECK(doc.load_string(STR("<node>&#x03B3;&#x03b3;&#x24B62;</node>"), parse_minimal | parse_escapes));
#ifdef PUGIXML_WCHAR_MODE
- const pugi::char_t* v = doc.child_value(STR("node"));
+ const char_t* v = doc.child_value(STR("node"));
size_t wcharsize = sizeof(wchar_t);
@@ -1000,7 +1000,7 @@ TEST(parse_out_of_memory_allocator_state_sync)
CHECK(doc.append_child(STR("n")));
}
-static bool test_offset(const char_t* contents, unsigned int options, pugi::xml_parse_status status, ptrdiff_t offset)
+static bool test_offset(const char_t* contents, unsigned int options, xml_parse_status status, ptrdiff_t offset)
{
xml_document doc;
xml_parse_result res = doc.load_string(contents, options);
diff --git a/tests/test_write.cpp b/tests/test_write.cpp
index be77aa8..5736273 100644
--- a/tests/test_write.cpp
+++ b/tests/test_write.cpp
@@ -217,12 +217,12 @@ TEST_XML(write_no_escapes, "<node attr=''>text</node>")
struct test_writer: xml_writer
{
- std::basic_string<pugi::char_t> contents;
+ std::basic_string<char_t> contents;
virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE
{
- CHECK(size % sizeof(pugi::char_t) == 0);
- contents.append(static_cast<const pugi::char_t*>(data), size / sizeof(pugi::char_t));
+ CHECK(size % sizeof(char_t) == 0);
+ contents.append(static_cast<const char_t*>(data), size / sizeof(char_t));
}
};
@@ -262,7 +262,7 @@ TEST_XML(write_print_stream_wide, "<node/>")
TEST_XML(write_huge_chunk, "<node/>")
{
- std::basic_string<pugi::char_t> name(10000, STR('n'));
+ std::basic_string<char_t> name(10000, STR('n'));
doc.child(STR("node")).set_name(name.c_str());
test_writer writer;
@@ -523,7 +523,7 @@ TEST(write_print_stream_empty_wide)
TEST(write_stackless)
{
unsigned int count = 20000;
- std::basic_string<pugi::char_t> data;
+ std::basic_string<char_t> data;
for (unsigned int i = 0; i < count; ++i)
data += STR("<a>");
@@ -629,11 +629,11 @@ TEST_XML_FLAGS(write_roundtrip, "<node><child1 attr1='value1' attr2='value2'/><c
std::string contents = write_narrow(doc, flags, encoding_utf8);
- pugi::xml_document verify;
+ xml_document verify;
CHECK(verify.load_buffer(contents.c_str(), contents.size(), parse_full));
CHECK(test_write_narrow(verify, flags, encoding_utf8, contents.c_str(), contents.size()));
- pugi::xml_document verifyws;
+ xml_document verifyws;
CHECK(verifyws.load_buffer(contents.c_str(), contents.size(), parse_full | parse_ws_pcdata));
CHECK(test_write_narrow(verifyws, flags, encoding_utf8, contents.c_str(), contents.size()));
}
@@ -658,7 +658,7 @@ TEST(write_flush_coverage)
for (size_t l = 0; l <= basel; ++l)
{
- std::basic_string<pugi::char_t> pad(bufl - l, STR('v'));
+ std::basic_string<char_t> pad(bufl - l, STR('v'));
a.set_value(pad.c_str());
std::string s = save_narrow(doc, format_raw, encoding_auto);
@@ -667,7 +667,7 @@ TEST(write_flush_coverage)
}
#ifndef PUGIXML_NO_EXCEPTIONS
-struct throwing_writer: pugi::xml_writer
+struct throwing_writer: xml_writer
{
virtual void write(const void*, size_t) PUGIXML_OVERRIDE
{
diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp
index 3f5d084..24daa4e 100644
--- a/tests/test_xpath.cpp
+++ b/tests/test_xpath.cpp
@@ -194,11 +194,11 @@ TEST(xpath_sort_random_large)
TEST(xpath_long_numbers_parse)
{
- const pugi::char_t* str_flt_max = STR("340282346638528860000000000000000000000");
- const pugi::char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000");
+ const char_t* str_flt_max = STR("340282346638528860000000000000000000000");
+ const char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000");
- const pugi::char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
- const pugi::char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000");
+ const char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
+ const char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000");
xml_node c;
@@ -209,25 +209,25 @@ TEST(xpath_long_numbers_parse)
CHECK_XPATH_NUMBER(c, str_dbl_max_dec, std::numeric_limits<double>::max());
}
-static bool test_xpath_string_prefix(const pugi::xml_node& node, const pugi::char_t* query, const pugi::char_t* expected, size_t match_length)
+static bool test_xpath_string_prefix(const xml_node& node, const char_t* query, const char_t* expected, size_t match_length)
{
- pugi::xpath_query q(query);
+ xpath_query q(query);
- pugi::char_t result[32];
+ char_t result[32];
size_t size = q.evaluate_string(result, sizeof(result) / sizeof(result[0]), node);
- size_t expected_length = std::char_traits<pugi::char_t>::length(expected);
+ size_t expected_length = std::char_traits<char_t>::length(expected);
- return size == expected_length + 1 && std::char_traits<pugi::char_t>::compare(result, expected, match_length) == 0;
+ return size == expected_length + 1 && std::char_traits<char_t>::compare(result, expected, match_length) == 0;
}
TEST(xpath_long_numbers_stringize)
{
- const pugi::char_t* str_flt_max = STR("340282346638528860000000000000000000000");
- const pugi::char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000");
+ const char_t* str_flt_max = STR("340282346638528860000000000000000000000");
+ const char_t* str_flt_max_dec = STR("340282346638528860000000000000000000000.000000");
- const pugi::char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
- const pugi::char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000");
+ const char_t* str_dbl_max = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
+ const char_t* str_dbl_max_dec = STR("179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000");
xml_node c;
@@ -240,7 +240,7 @@ TEST(xpath_long_numbers_stringize)
TEST(xpath_denorm_numbers)
{
- std::basic_string<pugi::char_t> query;
+ std::basic_string<char_t> query;
// 10^-318 - double denormal
for (int i = 0; i < 106; ++i)
@@ -383,7 +383,7 @@ TEST_XML(xpath_out_of_memory_evaluate, "<n/>")
query.resize(4196, 'a');
query += STR("\")]");
- pugi::xpath_query q(query.c_str());
+ xpath_query q(query.c_str());
CHECK_ALLOC_FAIL(CHECK(q.evaluate_boolean(doc) == false));
CHECK_ALLOC_FAIL(CHECK_DOUBLE_NAN(q.evaluate_number(doc)));
@@ -402,7 +402,7 @@ TEST(xpath_out_of_memory_evaluate_concat)
query.resize(4196, 'a');
query += STR("\")");
- pugi::xpath_query q(query.c_str());
+ xpath_query q(query.c_str());
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1));
}
@@ -416,7 +416,7 @@ TEST(xpath_out_of_memory_evaluate_concat_list)
query += STR("\"\")");
- pugi::xpath_query q(query.c_str());
+ xpath_query q(query.c_str());
test_runner::_memory_fail_threshold = 1;
@@ -432,7 +432,7 @@ TEST(xpath_out_of_memory_evaluate_substring)
query.resize(4196, 'a');
query += STR("\", 1, 4097)");
- pugi::xpath_query q(query.c_str());
+ xpath_query q(query.c_str());
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1));
}
@@ -441,7 +441,7 @@ TEST_XML(xpath_out_of_memory_evaluate_union, "<node><a/><a/><a/><a/><a/><a/><a/>
{
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
- pugi::xpath_query q(STR("a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|a)))))))))))))))))))"));
+ xpath_query q(STR("a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|a)))))))))))))))))))"));
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc.child(STR("node"))).empty()));
}
@@ -450,7 +450,7 @@ TEST_XML(xpath_out_of_memory_evaluate_predicate, "<node><a/><a/><a/><a/><a/><a/>
{
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
- pugi::xpath_query q(STR("//a[//a[//a[//a[true()]]]]"));
+ xpath_query q(STR("//a[//a[//a[//a[true()]]]]"));
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc).empty()));
}
@@ -459,7 +459,7 @@ TEST_XML(xpath_out_of_memory_evaluate_normalize_space_0, "<node> a b c d e f g h
{
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
- pugi::xpath_query q(STR("concat(normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space())"));
+ xpath_query q(STR("concat(normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space(), normalize-space())"));
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(doc.first_child()).empty()));
}
@@ -468,7 +468,7 @@ TEST_XML(xpath_out_of_memory_evaluate_normalize_space_1, "<node> a b c d e f g h
{
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
- pugi::xpath_query q(STR("concat(normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node))"));
+ xpath_query q(STR("concat(normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node), normalize-space(node))"));
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(doc).empty()));
}
@@ -477,7 +477,7 @@ TEST_XML(xpath_out_of_memory_evaluate_translate, "<node> a b c d e f g h i j k l
{
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
- pugi::xpath_query q(STR("concat(translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'))"));
+ xpath_query q(STR("concat(translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'), translate(node, 'a', '\xe9'))"));
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(doc).empty()));
}
@@ -486,7 +486,7 @@ TEST_XML(xpath_out_of_memory_evaluate_translate_table, "<node> a b c d e f g h i
{
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
- pugi::xpath_query q(STR("concat(translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'))"));
+ xpath_query q(STR("concat(translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'), translate(node, 'a', 'A'))"));
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(doc).empty()));
}
@@ -505,7 +505,7 @@ TEST(xpath_out_of_memory_evaluate_string_append)
xml_document doc;
CHECK(doc.load_buffer_inplace(&buf[0], buf.size() * sizeof(char_t)));
- pugi::xpath_query q(STR("string(n)"));
+ xpath_query q(STR("string(n)"));
CHECK(q);
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(doc).empty()));
@@ -525,13 +525,13 @@ TEST(xpath_out_of_memory_evaluate_number_to_string)
TEST(xpath_memory_concat_massive)
{
- pugi::xml_document doc;
- pugi::xml_node node = doc.append_child(STR("node"));
+ xml_document doc;
+ xml_node node = doc.append_child(STR("node"));
for (int i = 0; i < 5000; ++i)
node.append_child(STR("c")).text().set(i % 10);
- pugi::xpath_query q(STR("/"));
+ xpath_query q(STR("/"));
size_t size = q.evaluate_string(0, 0, node);
CHECK(size == 5001);
@@ -547,7 +547,7 @@ TEST_XML(xpath_memory_translate_table, "<node>a</node>")
query += STR("translate(.,'a','A'),");
query += STR("'')");
- CHECK_ALLOC_FAIL(CHECK(!pugi::xpath_query(query.c_str())));
+ CHECK_ALLOC_FAIL(CHECK(!xpath_query(query.c_str())));
}
TEST_XML(xpath_sort_copy_share, "<node><child1 attr1='value1' attr2='value2'/><child2 attr1='value1'>test</child2></node>")
diff --git a/tests/test_xpath_parse.cpp b/tests/test_xpath_parse.cpp
index 8819a5d..0672c5a 100644
--- a/tests/test_xpath_parse.cpp
+++ b/tests/test_xpath_parse.cpp
@@ -222,7 +222,7 @@ TEST(xpath_parse_paths_valid_unicode)
#if defined(PUGIXML_WCHAR_MODE)
xpath_query q(paths[i]);
#elif !defined(PUGIXML_NO_STL)
- std::basic_string<char> path_utf8 = pugi::as_utf8(paths[i]);
+ std::basic_string<char> path_utf8 = as_utf8(paths[i]);
xpath_query q(path_utf8.c_str());
#endif
}