summaryrefslogtreecommitdiff
path: root/tests/test_xpath_xalan_2.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-05-29 23:07:23 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-05-29 23:07:23 +0000
commit0a50eccd4e7c08814e7b982798b1c1346c304939 (patch)
tree780c4deafc94046c94168b1086725b015a4003ad /tests/test_xpath_xalan_2.cpp
parentc436c32e6c544cd1cdbf16ddf407fff382a4ade7 (diff)
tests: Minor wchar_t mode fixes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@469 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_xpath_xalan_2.cpp')
-rw-r--r--tests/test_xpath_xalan_2.cpp17
1 files changed, 10 insertions, 7 deletions
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 <stdio.h>
-
#include <string>
TEST_XML(xpath_xalan_string_1, "<doc a='test'>ENCYCLOPEDIA</doc>")
@@ -133,17 +131,22 @@ TEST_XML(xpath_xalan_string_4, "<doc><a>a</a><b>b</b><c>c</c><d>d</d><e>ef</e><f
static std::basic_string<char_t> number_to_string(int number)
{
- char buf[128];
- sprintf(buf, "%d", number);
+ std::basic_string<char_t> result;
+
+ while (number)
+ {
+ result = static_cast<char_t>('0' + number % 10) + result;
+ number /= 10;
+ }
- return std::basic_string<char_t>(buf, buf + strlen(buf));
+ return result;
}
TEST(xpath_xalan_string_5)
{
std::basic_string<char_t> 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<char_t> expected;
- for (int j = 0; j < 1000; ++j)
+ for (int j = 1; j < 1000; ++j)
{
expected += STR("t");
expected += number_to_string(j);