summaryrefslogtreecommitdiff
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
parentc436c32e6c544cd1cdbf16ddf407fff382a4ade7 (diff)
tests: Minor wchar_t mode fixes
git-svn-id: http://pugixml.googlecode.com/svn/trunk@469 99668b35-9821-0410-8761-19e4c4f06640
-rw-r--r--tests/test_xpath_xalan_2.cpp17
-rw-r--r--tests/test_xpath_xalan_3.cpp6
2 files changed, 13 insertions, 10 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);
diff --git a/tests/test_xpath_xalan_3.cpp b/tests/test_xpath_xalan_3.cpp
index cd20188..d1be803 100644
--- a/tests/test_xpath_xalan_3.cpp
+++ b/tests/test_xpath_xalan_3.cpp
@@ -206,7 +206,7 @@ TEST_XML(xpath_xalan_axes_9, "<doc><foo att1='c'><foo att1='b'><foo att1='a'><ba
CHECK_XPATH_NODESET(baz, STR("ancestor-or-self::*[@att1][1]/@att1")) % 8;
CHECK_XPATH_NODESET(baz, STR("(ancestor-or-self::*)[@att1][1]/@att1")) % 4;
- xml_node bar = doc.child("doc").child("bar");
+ xml_node bar = doc.child(STR("doc")).child(STR("bar"));
CHECK_XPATH_NODESET(bar, STR("preceding::foo[1]/@att1")) % 8;
CHECK_XPATH_NODESET(bar, STR("(preceding::foo)[1]/@att1")) % 4;
@@ -214,7 +214,7 @@ TEST_XML(xpath_xalan_axes_9, "<doc><foo att1='c'><foo att1='b'><foo att1='a'><ba
TEST_XML(xpath_xalan_axes_10, "<doc><foo att1='c'/><foo att1='b'/><foo att1='a'/><baz/></doc>")
{
- xml_node baz = doc.child("doc").child("baz");
+ xml_node baz = doc.child(STR("doc")).child(STR("baz"));
CHECK_XPATH_NODESET(baz, STR("preceding-sibling::foo[1]/@att1")) % 8;
CHECK_XPATH_NODESET(baz, STR("(preceding-sibling::foo)[1]/@att1")) % 4;
@@ -222,7 +222,7 @@ TEST_XML(xpath_xalan_axes_10, "<doc><foo att1='c'/><foo att1='b'/><foo att1='a'/
TEST_XML(xpath_xalan_axes_11, "<chapter title='A' x='0'><section title='A1' x='1'><subsection title='A1a' x='2'>hello</subsection><subsection title='A1b'>ahoy</subsection></section><section title='A2'><subsection title='A2a'>goodbye</subsection><subsection title='A2b'>sayonara</subsection><subsection title='A2c'>adios</subsection></section><section title='A3'><subsection title='A3a'>aloha</subsection><subsection title='A3b'><footnote x='3'>A3b-1</footnote><footnote>A3b-2</footnote></subsection><subsection title='A3c'>shalom</subsection></section></chapter>")
{
- xml_node chapter = doc.child("chapter");
+ xml_node chapter = doc.child(STR("chapter"));
CHECK_XPATH_NUMBER(doc, STR("count(//@*)"), 16);
CHECK_XPATH_NUMBER(doc, STR("count(//@title)"), 12);