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_xpath.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'tests/test_xpath.cpp') diff --git a/tests/test_xpath.cpp b/tests/test_xpath.cpp index 7db9ea5..a2e8200 100644 --- a/tests/test_xpath.cpp +++ b/tests/test_xpath.cpp @@ -18,7 +18,7 @@ static void load_document_copy(xml_document& doc, const char_t* text) TEST(xpath_allocator_many_pages) { - pugi::string_t query = STR("0"); + std::basic_string query = STR("0"); for (int i = 0; i < 128; ++i) query += STR("+string-length('abcdefgh')"); @@ -27,7 +27,7 @@ TEST(xpath_allocator_many_pages) TEST(xpath_allocator_large_page) { - pugi::string_t query; + std::basic_string query; for (int i = 0; i < 1024; ++i) query += STR("abcdefgh"); @@ -139,16 +139,14 @@ TEST(xpath_long_numbers_parse) 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) { -#ifdef PUGIXML_WCHAR_MODE - size_t expected_length = wcslen(expected); -#else - size_t expected_length = strlen(expected); -#endif - pugi::xpath_query q(query); - pugi::string_t value = q.evaluate_string(node); - return value.length() == expected_length && value.compare(0, match_length, expected, match_length) == 0; + pugi::char_t result[32]; + size_t size = q.evaluate_string(result, sizeof(result) / sizeof(result[0]), node); + + size_t expected_length = std::char_traits::length(expected); + + return size == expected_length + 1 && std::char_traits::compare(result, expected, match_length) == 0; } TEST(xpath_long_numbers_stringize) @@ -170,7 +168,7 @@ TEST(xpath_long_numbers_stringize) TEST(xpath_denorm_numbers) { - pugi::string_t query; + std::basic_string query; // 10^-318 - double denormal for (int i = 0; i < 106; ++i) -- cgit v1.2.3