summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2018-04-02 21:33:03 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2018-04-02 21:33:03 -0700
commita32585286a328367543443dd2520a4bee2b0cb0b (patch)
tree2d71b5fee588d7229500769a16383efc8267865b
parentcff1933ec9d522d65570c7270354394b6353b812 (diff)
tests: Fix PUGIXML_NO_STL build
-rw-r--r--tests/test_xpath.cpp16
-rw-r--r--tests/test_xpath_functions.cpp2
2 files changed, 12 insertions, 6 deletions
diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp
index 19ff25c..1ce525a 100644
--- a/tests/test_xpath.cpp
+++ b/tests/test_xpath.cpp
@@ -389,7 +389,11 @@ TEST_XML(xpath_out_of_memory_evaluate, "<n/>")
CHECK_ALLOC_FAIL(CHECK(q.evaluate_boolean(doc) == false));
CHECK_ALLOC_FAIL(CHECK_DOUBLE_NAN(q.evaluate_number(doc)));
+
+#ifndef PUGIXML_NO_STL
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(doc).empty()));
+#endif
+
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 1));
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node(doc) == xpath_node()));
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc).empty()));
@@ -463,7 +467,7 @@ TEST_XML(xpath_out_of_memory_evaluate_normalize_space_0, "<node> a b c d e f g h
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()));
+ CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc.first_child()) == 0));
}
TEST_XML(xpath_out_of_memory_evaluate_normalize_space_1, "<node> a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z </node>")
@@ -472,7 +476,7 @@ TEST_XML(xpath_out_of_memory_evaluate_normalize_space_1, "<node> a b c d e f g h
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()));
+ CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 0));
}
TEST_XML(xpath_out_of_memory_evaluate_translate, "<node> a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z </node>")
@@ -481,7 +485,7 @@ TEST_XML(xpath_out_of_memory_evaluate_translate, "<node> a b c d e f g h i j k l
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()));
+ CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 0));
}
TEST_XML(xpath_out_of_memory_evaluate_translate_table, "<node> a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z </node>")
@@ -490,7 +494,7 @@ TEST_XML(xpath_out_of_memory_evaluate_translate_table, "<node> a b c d e f g h i
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()));
+ CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 0));
}
TEST(xpath_out_of_memory_evaluate_string_append)
@@ -510,7 +514,7 @@ TEST(xpath_out_of_memory_evaluate_string_append)
xpath_query q(STR("string(n)"));
CHECK(q);
- CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(doc).empty()));
+ CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, doc) == 0));
}
TEST(xpath_out_of_memory_evaluate_number_to_string)
@@ -522,7 +526,7 @@ TEST(xpath_out_of_memory_evaluate_number_to_string)
xpath_query q(STR("concat($x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x, $x)"), &vars);
- CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(xml_node()).empty()));
+ CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 0));
}
TEST(xpath_memory_concat_massive)
diff --git a/tests/test_xpath_functions.cpp b/tests/test_xpath_functions.cpp
index dee999c..0d1d630 100644
--- a/tests/test_xpath_functions.cpp
+++ b/tests/test_xpath_functions.cpp
@@ -2,6 +2,8 @@
#include "test.hpp"
+#include <string>
+
using namespace pugi;
TEST_XML(xpath_number_number, "<node>123</node>")