diff options
Diffstat (limited to 'tests')
29 files changed, 82 insertions, 36 deletions
diff --git a/tests/common.hpp b/tests/common.hpp deleted file mode 100644 index 35e4717..0000000 --- a/tests/common.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef HEADER_TEST_COMMON_HPP -#define HEADER_TEST_COMMON_HPP - -#include "test.hpp" - -using namespace pugi; - -#endif diff --git a/tests/helpers.hpp b/tests/helpers.hpp index 439f8ea..6dfdc4b 100644 --- a/tests/helpers.hpp +++ b/tests/helpers.hpp @@ -1,7 +1,7 @@ #ifndef HEADER_TEST_HELPERS_HPP #define HEADER_TEST_HELPERS_HPP -#include "common.hpp" +#include "test.hpp" #include <utility> diff --git a/tests/test_compact.cpp b/tests/test_compact.cpp index f5dc4ee..89bbfaa 100644 --- a/tests/test_compact.cpp +++ b/tests/test_compact.cpp @@ -1,5 +1,7 @@ #ifdef PUGIXML_COMPACT -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; static void overflow_hash_table(xml_document& doc) { diff --git a/tests/test_deprecated.cpp b/tests/test_deprecated.cpp index 55f8937..990e9ba 100644 --- a/tests/test_deprecated.cpp +++ b/tests/test_deprecated.cpp @@ -1,6 +1,8 @@ #define PUGIXML_DEPRECATED // Suppress deprecated declarations to avoid warnings -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST(document_deprecated_load) { diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 45b8536..2b4c4be 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -5,7 +5,7 @@ #include <string.h> // because Borland's STL is braindead, we have to include <string.h> _before_ <string> in order to get memcpy -#include "common.hpp" +#include "test.hpp" #include "writer_string.hpp" @@ -26,6 +26,8 @@ # include <unistd.h> // for unlink #endif +using namespace pugi; + static bool load_file_in_memory(const char* path, char*& data, size_t& size) { FILE* file = fopen(path, "rb"); diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp index c863c6f..9696827 100644 --- a/tests/test_dom_modify.cpp +++ b/tests/test_dom_modify.cpp @@ -1,4 +1,4 @@ -#include "common.hpp" +#include "test.hpp" #include <limits> #include <string> @@ -7,6 +7,8 @@ #include <string.h> #include <limits.h> +using namespace pugi; + TEST_XML(dom_attr_assign, "<node/>") { xml_node node = doc.child(STR("node")); diff --git a/tests/test_dom_text.cpp b/tests/test_dom_text.cpp index 8f62e49..23b41e5 100644 --- a/tests/test_dom_text.cpp +++ b/tests/test_dom_text.cpp @@ -1,9 +1,11 @@ -#include "common.hpp" +#include "test.hpp" #include "helpers.hpp" #include <limits.h> +using namespace pugi; + TEST_XML_FLAGS(dom_text_empty, "<node><a>foo</a><b><![CDATA[bar]]></b><c><?pi value?></c><d/></node>", parse_default | parse_pi) { xml_node node = doc.child(STR("node")); diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index 4dc6cda..b135674 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -2,7 +2,7 @@ #define _SCL_SECURE_NO_WARNINGS #define _SCL_SECURE_NO_DEPRECATE -#include "common.hpp" +#include "test.hpp" #include <string.h> #include <stdio.h> @@ -15,6 +15,8 @@ #include "helpers.hpp" +using namespace pugi; + #ifdef PUGIXML_NO_STL template <typename I> static I move_iter(I base, int n) { diff --git a/tests/test_header_only_1.cpp b/tests/test_header_only_1.cpp index e33fd78..2e90b33 100644 --- a/tests/test_header_only_1.cpp +++ b/tests/test_header_only_1.cpp @@ -1,12 +1,14 @@ #define PUGIXML_HEADER_ONLY #define pugi pugih -#include "common.hpp" +#include "test.hpp" // Check header guards #include "../src/pugixml.hpp" #include "../src/pugixml.hpp" +using namespace pugi; + TEST(header_only_1) { xml_document doc; diff --git a/tests/test_header_only_2.cpp b/tests/test_header_only_2.cpp index 220c807..e4e876d 100644 --- a/tests/test_header_only_2.cpp +++ b/tests/test_header_only_2.cpp @@ -1,12 +1,14 @@ #define PUGIXML_HEADER_ONLY #define pugi pugih -#include "common.hpp" +#include "test.hpp" // Check header guards #include "../src/pugixml.hpp" #include "../src/pugixml.hpp" +using namespace pugi; + TEST(header_only_2) { xml_document doc; diff --git a/tests/test_memory.cpp b/tests/test_memory.cpp index becb89b..4acda5b 100644 --- a/tests/test_memory.cpp +++ b/tests/test_memory.cpp @@ -1,4 +1,4 @@ -#include "common.hpp" +#include "test.hpp" #include "writer_string.hpp" #include "allocator.hpp" @@ -6,6 +6,8 @@ #include <string> #include <vector> +using namespace pugi; + namespace { int page_allocs = 0; diff --git a/tests/test_parse.cpp b/tests/test_parse.cpp index a0af591..dd40bc5 100644 --- a/tests/test_parse.cpp +++ b/tests/test_parse.cpp @@ -1,7 +1,9 @@ -#include "common.hpp" +#include "test.hpp" #include "writer_string.hpp" +using namespace pugi; + TEST(parse_pi_skip) { xml_document doc; diff --git a/tests/test_parse_doctype.cpp b/tests/test_parse_doctype.cpp index e32af8e..861e772 100644 --- a/tests/test_parse_doctype.cpp +++ b/tests/test_parse_doctype.cpp @@ -1,11 +1,13 @@ #define _CRT_SECURE_NO_WARNINGS -#include "common.hpp" +#include "test.hpp" #include <string.h> #include <wchar.h> #include <string> +using namespace pugi; + static xml_parse_result load_concat(xml_document& doc, const char_t* a, const char_t* b = STR(""), const char_t* c = STR("")) { char_t buffer[768]; diff --git a/tests/test_unicode.cpp b/tests/test_unicode.cpp index 1902e36..4cb6114 100644 --- a/tests/test_unicode.cpp +++ b/tests/test_unicode.cpp @@ -1,9 +1,11 @@ #ifndef PUGIXML_NO_STL -#include "common.hpp" +#include "test.hpp" #include <string> +using namespace pugi; + // letters taken from http://www.utf8-chartable.de/ TEST(as_wide_empty) diff --git a/tests/test_write.cpp b/tests/test_write.cpp index 5736273..95cc566 100644 --- a/tests/test_write.cpp +++ b/tests/test_write.cpp @@ -1,4 +1,4 @@ -#include "common.hpp" +#include "test.hpp" #include "writer_string.hpp" @@ -6,6 +6,8 @@ #include <sstream> #include <stdexcept> +using namespace pugi; + TEST_XML(write_simple, "<node attr='1'><child>text</child></node>") { CHECK_NODE_EX(doc, STR("<node attr=\"1\">\n<child>text</child>\n</node>\n"), STR(""), 0); diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index 24daa4e..19ff25c 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -1,6 +1,6 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" #include <string.h> #include <wchar.h> @@ -10,6 +10,8 @@ #include <algorithm> #include <limits> +using namespace pugi; + static void load_document_copy(xml_document& doc, const char_t* text) { xml_document source; diff --git a/tests/test_xpath_api.cpp b/tests/test_xpath_api.cpp index f933fb8..7abf7d9 100644 --- a/tests/test_xpath_api.cpp +++ b/tests/test_xpath_api.cpp @@ -2,13 +2,15 @@ #include <string.h> // because Borland's STL is braindead, we have to include <string.h> _before_ <string> in order to get memcmp -#include "common.hpp" +#include "test.hpp" #include "helpers.hpp" #include <string> #include <vector> +using namespace pugi; + TEST_XML(xpath_api_select_nodes, "<node><head/><foo/><foo/><tail/></node>") { xpath_node_set ns1 = doc.select_nodes(STR("node/foo")); diff --git a/tests/test_xpath_functions.cpp b/tests/test_xpath_functions.cpp index 604da78..43e334e 100644 --- a/tests/test_xpath_functions.cpp +++ b/tests/test_xpath_functions.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_number_number, "<node>123</node>") { diff --git a/tests/test_xpath_operators.cpp b/tests/test_xpath_operators.cpp index c2281e6..5e1316c 100644 --- a/tests/test_xpath_operators.cpp +++ b/tests/test_xpath_operators.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST(xpath_operators_arithmetic) { diff --git a/tests/test_xpath_parse.cpp b/tests/test_xpath_parse.cpp index 0672c5a..daa12bf 100644 --- a/tests/test_xpath_parse.cpp +++ b/tests/test_xpath_parse.cpp @@ -1,9 +1,11 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" #include <string> +using namespace pugi; + TEST(xpath_literal_parse) { xml_node c; diff --git a/tests/test_xpath_paths.cpp b/tests/test_xpath_paths.cpp index dd97019..54a47ae 100644 --- a/tests/test_xpath_paths.cpp +++ b/tests/test_xpath_paths.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_paths_axes_child, "<node attr='value'><child attr='value'><subchild/></child><another/><last/></node>") { diff --git a/tests/test_xpath_paths_abbrev_w3c.cpp b/tests/test_xpath_paths_abbrev_w3c.cpp index af65752..bd01e65 100644 --- a/tests/test_xpath_paths_abbrev_w3c.cpp +++ b/tests/test_xpath_paths_abbrev_w3c.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_paths_abbrev_w3c_1, "<node><para/><foo/><para/></node>") { diff --git a/tests/test_xpath_paths_w3c.cpp b/tests/test_xpath_paths_w3c.cpp index 2005bc5..1bc2121 100644 --- a/tests/test_xpath_paths_w3c.cpp +++ b/tests/test_xpath_paths_w3c.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_paths_w3c_1, "<node><para/><foo/><para/></node>") { diff --git a/tests/test_xpath_variables.cpp b/tests/test_xpath_variables.cpp index 9349004..d7d7276 100644 --- a/tests/test_xpath_variables.cpp +++ b/tests/test_xpath_variables.cpp @@ -1,9 +1,11 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" #include <string> +using namespace pugi; + TEST(xpath_variables_type_none) { xpath_variable_set set; diff --git a/tests/test_xpath_xalan_1.cpp b/tests/test_xpath_xalan_1.cpp index 7f87c52..0127ddd 100644 --- a/tests/test_xpath_xalan_1.cpp +++ b/tests/test_xpath_xalan_1.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST(xpath_xalan_boolean_1) { diff --git a/tests/test_xpath_xalan_2.cpp b/tests/test_xpath_xalan_2.cpp index 5edae69..4e8c10e 100644 --- a/tests/test_xpath_xalan_2.cpp +++ b/tests/test_xpath_xalan_2.cpp @@ -2,11 +2,13 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" #include <string> #include <algorithm> +using namespace pugi; + TEST_XML(xpath_xalan_string_1, "<doc a='test'>ENCYCLOPEDIA</doc>") { xml_node c; diff --git a/tests/test_xpath_xalan_3.cpp b/tests/test_xpath_xalan_3.cpp index d2df3e5..5228cde 100644 --- a/tests/test_xpath_xalan_3.cpp +++ b/tests/test_xpath_xalan_3.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_xalan_axes_1, "<far-north><north-north-west1/><north-north-west2/><north><near-north><far-west/><west/><near-west/><center center-attr-1='c1' center-attr-2='c2' center-attr-3='c3'><near-south-west/><near-south><south><far-south/></south></near-south><near-south-east/></center><near-east/><east/><far-east/></near-north></north><north-north-east1/><north-north-east2/></far-north>") { diff --git a/tests/test_xpath_xalan_4.cpp b/tests/test_xpath_xalan_4.cpp index c71eaf7..997ffb4 100644 --- a/tests/test_xpath_xalan_4.cpp +++ b/tests/test_xpath_xalan_4.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_xalan_position_1, "<doc><a>1</a><a>2</a><a>3</a><a>4</a></doc>") { diff --git a/tests/test_xpath_xalan_5.cpp b/tests/test_xpath_xalan_5.cpp index e6a4fb9..6daa234 100644 --- a/tests/test_xpath_xalan_5.cpp +++ b/tests/test_xpath_xalan_5.cpp @@ -1,6 +1,8 @@ #ifndef PUGIXML_NO_XPATH -#include "common.hpp" +#include "test.hpp" + +using namespace pugi; TEST_XML(xpath_xalan_select_1, "<doc><a><b attr='test'/></a><c><d><e/></d></c></doc>") { |