From 0a50eccd4e7c08814e7b982798b1c1346c304939 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sat, 29 May 2010 23:07:23 +0000 Subject: tests: Minor wchar_t mode fixes git-svn-id: http://pugixml.googlecode.com/svn/trunk@469 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_xpath_xalan_2.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'tests/test_xpath_xalan_2.cpp') diff --git a/tests/test_xpath_xalan_2.cpp b/tests/test_xpath_xalan_2.cpp index 45b3196..13838d1 100644 --- a/tests/test_xpath_xalan_2.cpp +++ b/tests/test_xpath_xalan_2.cpp @@ -4,8 +4,6 @@ #include "common.hpp" -#include - #include TEST_XML(xpath_xalan_string_1, "ENCYCLOPEDIA") @@ -133,17 +131,22 @@ TEST_XML(xpath_xalan_string_4, "abcdef number_to_string(int number) { - char buf[128]; - sprintf(buf, "%d", number); + std::basic_string result; + + while (number) + { + result = static_cast('0' + number % 10) + result; + number /= 10; + } - return std::basic_string(buf, buf + strlen(buf)); + return result; } TEST(xpath_xalan_string_5) { std::basic_string query = STR("concat("); - for (int i = 0; i < 1000; ++i) + for (int i = 1; i < 1000; ++i) { query += STR("concat('t',"); query += number_to_string(i); @@ -154,7 +157,7 @@ TEST(xpath_xalan_string_5) std::basic_string expected; - for (int j = 0; j < 1000; ++j) + for (int j = 1; j < 1000; ++j) { expected += STR("t"); expected += number_to_string(j); -- cgit v1.2.3