diff --git a/test/SAX2DOM/SAX2DOM_test.vcproj b/test/SAX2DOM/SAX2DOM_test.vcproj
index 4f3b7f34..46dabd34 100644
--- a/test/SAX2DOM/SAX2DOM_test.vcproj
+++ b/test/SAX2DOM/SAX2DOM_test.vcproj
@@ -145,10 +145,16 @@
+
+
+
+
diff --git a/test/SAX2DOM/main.cpp b/test/SAX2DOM/main.cpp
index b4c6871c..fb3ed3cc 100644
--- a/test/SAX2DOM/main.cpp
+++ b/test/SAX2DOM/main.cpp
@@ -3,7 +3,6 @@
#endif
#include
#include
-//#include
#include
#include
@@ -15,13 +14,16 @@
#include "../CppUnit/framework/TestSuite.h"
#include "test_SAX.h"
+#include "../silly_string/silly_string.hpp"
////////////////////////////////////////////////
int main(int argc, const char* argv[])
{
TestRunner runner;
- runner.addTest("SAX2DOMTest", SAXTest_suite >());
+ runner.addTest("SAX2DOMTest", SAXTest_suite >());
+ runner.addTest("SAX2DOMTest_silly", SAXTest_suite());
+ runner.addTest("SAX2DOMTest_wide", SAXTest_suite >());
runner.run(argc, argv);
diff --git a/test/SAX2DOM/test_SAX.h b/test/SAX2DOM/test_SAX.h
index fbffe8ff..f7df072e 100644
--- a/test/SAX2DOM/test_SAX.h
+++ b/test/SAX2DOM/test_SAX.h
@@ -10,6 +10,8 @@
template
class SAXTest : public TestCase
{
+ typedef string_adaptor SA;
+
public:
SAXTest(std::string name) :
TestCase(name)
@@ -23,10 +25,10 @@ class SAXTest : public TestCase
DOM::Document parse(string_type str)
{
std::stringstream ss;
- ss << str;
+ ss << SA::asStdString(str);
- SAX::InputSource is(ss);
- SAX2DOM::Parser parser;
+ SAX::basic_InputSource is(ss);
+ SAX2DOM::Parser parser;
parser.parse(is);
return parser.getDocument();
} // parse
@@ -42,7 +44,7 @@ class SAXTest : public TestCase
void test2()
{
- DOM::Document d = parse("");
+ DOM::Document d = parse(SA::construct_from_utf8(""));
DOM::Element elem = d.getDocumentElement();
assert(elem.getParentNode() == d);
assert(elem.getOwnerDocument() == d);
@@ -50,100 +52,100 @@ class SAXTest : public TestCase
void test3()
{
- DOM::Document d = parse("");
+ DOM::Document d = parse(SA::construct_from_utf8(""));
DOM::Element elem = d.getDocumentElement();
assert(elem.hasAttributes() == true);
- assert(elem.getAttribute("attr") == "poop");
+ assert(elem.getAttribute(SA::construct_from_utf8("attr")) == SA::construct_from_utf8("poop"));
} // test3
void test4()
{
- DOM::Document d = parse("");
+ DOM::Document d = parse(SA::construct_from_utf8(""));
DOM::Element elem = DOM::Element(d.getDocumentElement().getFirstChild());
- assertEquals("child", elem.getNodeName());
+ assert(SA::construct_from_utf8("child") == elem.getNodeName());
assertEquals(true, elem.hasAttributes());
- assertEquals("poop", elem.getAttribute("attr"));
+ assert(SA::construct_from_utf8("poop") == elem.getAttribute(SA::construct_from_utf8("attr")));
} // test4
void test5()
{
- DOM::Document d = parse("");
+ DOM::Document d = parse(SA::construct_from_utf8(""));
DOM::Element elem = d.getDocumentElement();
assertEquals(true, elem.hasNamespaceURI());
- assertEquals("http://example.com/stuff", elem.getNamespaceURI());
+ assert(SA::construct_from_utf8("http://example.com/stuff") == elem.getNamespaceURI());
- DOM::Attr attr = elem.getAttributeNode("attr");
+ DOM::Attr attr = elem.getAttributeNode(SA::construct_from_utf8("attr"));
assertEquals(false, attr.hasNamespaceURI());
} // test5
void test6()
{
- DOM::Document d = parse("");
+ DOM::Document d = parse(SA::construct_from_utf8(""));
DOM::Element elem = d.getDocumentElement();
assertEquals(true, elem.hasNamespaceURI());
- assertEquals("http://example.com/stuff", elem.getNamespaceURI());
+ assert(SA::construct_from_utf8("http://example.com/stuff") == elem.getNamespaceURI());
- DOM::Attr attr = elem.getAttributeNodeNS("http://example.com/stuff", "attr");
+ DOM::Attr attr = elem.getAttributeNodeNS(SA::construct_from_utf8("http://example.com/stuff"), SA::construct_from_utf8("attr"));
assertEquals(true, attr.hasNamespaceURI());
- assertEquals("http://example.com/stuff", attr.getNamespaceURI());
+ assert(SA::construct_from_utf8("http://example.com/stuff") == attr.getNamespaceURI());
} // test6
void test7()
{
- DOM::Document d = parse("");
+ DOM::Document d = parse(SA::construct_from_utf8(""));
DOM::Element elem = d.getDocumentElement();
assertEquals(false, elem.hasNamespaceURI());
- DOM::Attr attr = elem.getAttributeNodeNS("http://example.com/stuff", "attr");
+ DOM::Attr attr = elem.getAttributeNodeNS(SA::construct_from_utf8("http://example.com/stuff"), SA::construct_from_utf8("attr"));
assertEquals(true, attr.hasNamespaceURI());
- assertEquals("http://example.com/stuff", attr.getNamespaceURI());
+ assert(SA::construct_from_utf8("http://example.com/stuff") == attr.getNamespaceURI());
} // test7
void test8()
{
- DOM::Document d = parse("");
+ DOM::Document d = parse(SA::construct_from_utf8(""));
DOM::Element elem = d.getDocumentElement();
DOM::Element e2 = DOM::Element(elem.cloneNode(true));
assert(e2.getOwnerDocument() == d);
assert(e2.getParentNode() == 0);
assert(e2.hasAttributes() == true);
- assert(e2.getAttribute("attr") == "poop");
- assert(e2.getFirstChild().getNodeName() == "child");
+ assert(e2.getAttribute(SA::construct_from_utf8("attr")) == SA::construct_from_utf8("poop"));
+ assert(e2.getFirstChild().getNodeName() == SA::construct_from_utf8("child"));
} // test8
void test9()
{
- DOM::Document d = parse("");
+ DOM::Document d = parse(SA::construct_from_utf8(""));
DOM::Element elem = d.getDocumentElement();
assertEquals(false, elem.hasNamespaceURI());
- DOM::Attr attr = elem.getAttributeNode("attr");
+ DOM::Attr attr = elem.getAttributeNode(SA::construct_from_utf8("attr"));
assertEquals(false, attr.hasNamespaceURI());
} // test9
void test10()
{
- DOM::Document d = parse("");
+ DOM::Document d = parse(SA::construct_from_utf8(""));
assert(d == 0);
} // test10
void test11()
{
- SAX2DOM::Parser parser;
- assert(parser.getFeature("http://xml.org/sax/features/validation") == true);
- parser.setFeature("http://xml.org/sax/features/validation", false);
- assert(parser.getFeature("http://xml.org/sax/features/validation") == false);
+ SAX2DOM::Parser parser;
+ assert(parser.getFeature(SA::construct_from_utf8("http://xml.org/sax/features/validation")) == true);
+ parser.setFeature(SA::construct_from_utf8("http://xml.org/sax/features/validation"), false);
+ assert(parser.getFeature(SA::construct_from_utf8("http://xml.org/sax/features/validation")) == false);
- parser.parse("");
+ parser.parse(SA::construct_from_utf8(""));
} // test11
void test12()
{
- SAX2DOM::Parser parser;
+ SAX2DOM::Parser parser;
try
{
- parser.getFeature("made up name");
+ parser.getFeature(SA::construct_from_utf8("made up name"));
assert(false);
}
catch(const SAX::SAXNotRecognizedException&)
diff --git a/test/XPath_wide/xpathic_wide.vcproj b/test/XPath_wide/xpathic_wide.vcproj
index 9ad069fd..c0297086 100644
--- a/test/XPath_wide/xpathic_wide.vcproj
+++ b/test/XPath_wide/xpathic_wide.vcproj
@@ -25,7 +25,7 @@
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="FALSE"
BasicRuntimeChecks="0"
- RuntimeLibrary="5"
+ RuntimeLibrary="3"
DisableLanguageExtensions="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
@@ -76,7 +76,7 @@
AdditionalOptions="/Zm1000 "
AdditionalIncludeDirectories="..\..\"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- RuntimeLibrary="4"
+ RuntimeLibrary="2"
DisableLanguageExtensions="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
diff --git a/test/silly_string/silly_string.cpp b/test/silly_string/silly_string.cpp
index 3279bd28..db2abaec 100644
--- a/test/silly_string/silly_string.cpp
+++ b/test/silly_string/silly_string.cpp
@@ -36,14 +36,16 @@ char silly_string_adaptor::convert_from_utf8(char c)
silly_string silly_string_adaptor::construct_from_utf8(const char* str)
{
silly_string s;
- s.s_ = str;
+ if(str)
+ s.s_ = str;
return s;
} // construct_from_utf8
silly_string silly_string_adaptor::construct_from_utf8(const char* str, int length)
{
silly_string s;
- s.s_ = std::string(str, length);
+ if(str)
+ s.s_ = std::string(str, length);
return s;
} // construct_from_utf8