From 049fa3906db2786943617bb1b0ce3225be9a772f Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 29 Aug 2010 15:25:05 +0000 Subject: tests: Added new evaluate_string tests, fixed tests for NO_STL mode git-svn-id: http://pugixml.googlecode.com/svn/trunk@661 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/test.cpp') diff --git a/tests/test.cpp b/tests/test.cpp index c60619a..96a81e4 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -58,7 +58,16 @@ bool test_xpath_string(const pugi::xml_node& node, const pugi::char_t* query, co { pugi::xpath_query q(query); - return q.evaluate_string(node) == expected; + const size_t capacity = 64; + pugi::char_t result[capacity]; + + size_t size = q.evaluate_string(result, capacity, node); + + if (size <= capacity) return test_string_equal(result, expected); + + std::basic_string buffer(size, ' '); + + return q.evaluate_string(&buffer[0], size, node) == size && test_string_equal(buffer.c_str(), expected); } bool test_xpath_boolean(const pugi::xml_node& node, const pugi::char_t* query, bool expected) -- cgit v1.2.3