From f159e997645868c6a7532337a26a62bd6bf38865 Mon Sep 17 00:00:00 2001 From: jez_higgins <> Date: Thu, 27 Oct 2005 21:50:10 +0000 Subject: [PATCH] *** empty log message *** --- Arabica.sln | 8 + Utils/StringAdaptor.h | 4 +- test/DOM/DOM_test.vcproj | 12 +- test/DOM/main.cpp | 14 +- test/DOM/test_DOMImplementation.h | 27 +-- test/DOM/test_DocumentType.h | 27 ++- test/DOM_silly/.cvsignore | 15 ++ test/DOM_silly/DOM_test_silly.vcproj | 259 +++++++++++++++++++++++++++ test/DOM_silly/main.cpp | 55 ++++++ 9 files changed, 385 insertions(+), 36 deletions(-) create mode 100644 test/DOM_silly/.cvsignore create mode 100644 test/DOM_silly/DOM_test_silly.vcproj create mode 100644 test/DOM_silly/main.cpp diff --git a/Arabica.sln b/Arabica.sln index c7720d3c..ae2f7bcf 100644 --- a/Arabica.sln +++ b/Arabica.sln @@ -57,6 +57,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_DOM", "test\DOM\DOM_te ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_DOM_silly", "test\DOM_silly\DOM_test_silly.vcproj", "{74A66132-475A-4DA1-8EF7-9CB0EF71E3D8}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug @@ -115,6 +119,10 @@ Global {74A66132-475A-4DA1-8EF7-9CB0EF71E3D8}.Debug.Build.0 = Debug|Win32 {74A66132-475A-4DA1-8EF7-9CB0EF71E3D8}.Release.ActiveCfg = Release|Win32 {74A66132-475A-4DA1-8EF7-9CB0EF71E3D8}.Release.Build.0 = Release|Win32 + {74A66132-475A-4DA1-8EF7-9CB0EF71E3D8}.Debug.ActiveCfg = Debug|Win32 + {74A66132-475A-4DA1-8EF7-9CB0EF71E3D8}.Debug.Build.0 = Debug|Win32 + {74A66132-475A-4DA1-8EF7-9CB0EF71E3D8}.Release.ActiveCfg = Release|Win32 + {74A66132-475A-4DA1-8EF7-9CB0EF71E3D8}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection diff --git a/Utils/StringAdaptor.h b/Utils/StringAdaptor.h index 214fddbe..bbed7907 100644 --- a/Utils/StringAdaptor.h +++ b/Utils/StringAdaptor.h @@ -15,7 +15,9 @@ namespace Arabica //forward decl template -class default_string_adaptor; +class default_string_adaptor +{ +}; template diff --git a/test/DOM/DOM_test.vcproj b/test/DOM/DOM_test.vcproj index 880b04f2..cb787a16 100644 --- a/test/DOM/DOM_test.vcproj +++ b/test/DOM/DOM_test.vcproj @@ -30,7 +30,7 @@ TreatWChar_tAsBuiltInType="TRUE" RuntimeTypeInfo="TRUE" UsePrecompiledHeader="2" - PrecompiledHeaderFile=".\Debug/SAX2DOM_test.pch" + PrecompiledHeaderFile=".\Debug/DOM_test.pch" AssemblerListingLocation=".\Debug/" ObjectFile=".\Debug/" ProgramDataBaseFileName=".\Debug/" @@ -49,11 +49,11 @@ SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE" - ProgramDatabaseFile=".\..\..\bin/SAX2DOM_test.pdb" + ProgramDatabaseFile=".\..\..\bin/DOM_test.pdb" SubSystem="1"/> + TypeLibraryName=".\..\..\bin/DOM_test.tlb"/> + TypeLibraryName=".\Release/DOM_test.tlb"/> >()); - runner.addTest("DocumentTypeTest", DocumentTypeTest_suite >()); - runner.addTest("DocumentTest", DocumentTest_suite >()); + runner.addTest("DOMImplementationTest", DOMImplementationTest_suite >()); + runner.addTest("DocumentTypeTest", DocumentTypeTest_suite >()); + runner.addTest("DocumentTest", DocumentTest_suite >()); runner.addTest("SiblingsTest", SiblingsTest_suite >()); runner.addTest("ElementTest", ElementTest_suite >()); runner.addTest("AttributeTest", AttrTest_suite >()); runner.addTest("ProcessingInstructionTest", ProcessingInstructionTest_suite >()); - runner.addTest("TextTest", TextTest_suite >()); - runner.addTest("CDATATest", CDATATest_suite >()); - runner.addTest("CharacterDataText", CharacterDataTest_suite >()); - runner.addTest("DocumentFragmentTest", DocumentFragmentTest_suite >()); + runner.addTest("TextTest", TextTest_suite >()); + runner.addTest("CDATATest", CDATATest_suite >()); + runner.addTest("CharacterDataText", CharacterDataTest_suite >()); + runner.addTest("DocumentFragmentTest", DocumentFragmentTest_suite >()); runner.run(argc, argv); return 0; diff --git a/test/DOM/test_DOMImplementation.h b/test/DOM/test_DOMImplementation.h index eaba64a4..7c75697a 100644 --- a/test/DOM/test_DOMImplementation.h +++ b/test/DOM/test_DOMImplementation.h @@ -10,6 +10,7 @@ template class DOMImplementationTest : public TestCase { + typedef string_adaptor SA; public: DOMImplementationTest(std::string name) : TestCase(name) @@ -25,7 +26,7 @@ class DOMImplementationTest : public TestCase DOM::DOMImplementation di; assert(di == 0); - DOM::DOMImplementation di2 = SimpleDOM::DOMImplementation::getDOMImplementation(); + DOM::DOMImplementation di2 = SimpleDOM::DOMImplementation::getDOMImplementation(); assert(di2 != 0); assert(di != di2); @@ -38,23 +39,23 @@ class DOMImplementationTest : public TestCase void testFeatures() { - DOM::DOMImplementation di = SimpleDOM::DOMImplementation::getDOMImplementation(); + DOM::DOMImplementation di = SimpleDOM::DOMImplementation::getDOMImplementation(); - assert(di.hasFeature("Core", "") == true); - assert(di.hasFeature("Core", "1.0") == true); - assert(di.hasFeature("Core", "2.0") == true); - assert(di.hasFeature("Core", "trousers") == false); + assert(di.hasFeature(SA::construct_from_utf8("Core"), SA::construct_from_utf8("")) == true); + assert(di.hasFeature(SA::construct_from_utf8("Core"), SA::construct_from_utf8("1.0")) == true); + assert(di.hasFeature(SA::construct_from_utf8("Core"), SA::construct_from_utf8("2.0")) == true); + assert(di.hasFeature(SA::construct_from_utf8("Core"), SA::construct_from_utf8("trousers")) == false); // assert(di.hasFeature("cOrE", "1.0") == true); // assert(di.hasFeature("CorE", "2.0") == true); - assert(di.hasFeature("XML", "") == true); - assert(di.hasFeature("XML", "1.0") == true); - assert(di.hasFeature("XML", "2.0") == true); - assert(di.hasFeature("xml", "") == true); - assert(di.hasFeature("xml", "1.0") == true); - assert(di.hasFeature("xml", "2.0") == true); + assert(di.hasFeature(SA::construct_from_utf8("XML"), SA::construct_from_utf8("")) == true); + assert(di.hasFeature(SA::construct_from_utf8("XML"), SA::construct_from_utf8("1.0")) == true); + assert(di.hasFeature(SA::construct_from_utf8("XML"), SA::construct_from_utf8("2.0")) == true); + assert(di.hasFeature(SA::construct_from_utf8("xml"), SA::construct_from_utf8("")) == true); + assert(di.hasFeature(SA::construct_from_utf8("xml"), SA::construct_from_utf8("1.0")) == true); + assert(di.hasFeature(SA::construct_from_utf8("xml"), SA::construct_from_utf8("2.0")) == true); - assert(di.hasFeature("barleymow", "") == false); + assert(di.hasFeature(SA::construct_from_utf8("barleymow"), SA::construct_from_utf8("")) == false); } // testDeatures }; diff --git a/test/DOM/test_DocumentType.h b/test/DOM/test_DocumentType.h index 49c25a38..dc91698d 100644 --- a/test/DOM/test_DocumentType.h +++ b/test/DOM/test_DocumentType.h @@ -11,6 +11,7 @@ template class DocumentTypeTest : public TestCase { DOM::DOMImplementation factory; + typedef string_adaptor SA; public: DocumentTypeTest(std::string name) : @@ -20,7 +21,7 @@ class DocumentTypeTest : public TestCase void setUp() { - factory = SimpleDOM::DOMImplementation::getDOMImplementation(); + factory = SimpleDOM::DOMImplementation::getDOMImplementation(); } // setUp void testNull() @@ -34,7 +35,9 @@ class DocumentTypeTest : public TestCase void testCreate() { - DOM::DocumentType d = factory.createDocumentType("charlie", "", "http://gruesome/"); + DOM::DocumentType d = factory.createDocumentType(SA::construct_from_utf8("charlie"), + SA::construct_from_utf8(""), + SA::construct_from_utf8("http://gruesome/")); assert(d != 0); DOM::Node n; @@ -48,12 +51,14 @@ class DocumentTypeTest : public TestCase DOM::DocumentType d2; assert(d != d2); - assert(d2!= d); + assert(d2 != d); d2 = d; assert(d == d2); assert(d2 == d); - DOM::DocumentType d3 = factory.createDocumentType("billy", "", "http://gruesome/");; + DOM::DocumentType d3 = factory.createDocumentType(SA::construct_from_utf8("billy"), + SA::construct_from_utf8(""), + SA::construct_from_utf8("http://gruesome/")); assert(d != d3); assert(d3!= d); d3 = d; @@ -63,14 +68,18 @@ class DocumentTypeTest : public TestCase void testDoc() { - DOM::DocumentType d = factory.createDocumentType("charlie", "sss", "http://gruesome/"); + DOM::DocumentType d = factory.createDocumentType(SA::construct_from_utf8("charlie"), + SA::construct_from_utf8("sss"), + SA::construct_from_utf8("http://gruesome/")); - DOM::Document doc = factory.createDocument("", "doc", d); + DOM::Document doc = factory.createDocument(SA::construct_from_utf8(""), + SA::construct_from_utf8("doc"), + d); DOM::DocumentType dt = doc.getDoctype(); - assert(dt.getPublicId() == "sss"); - assert(dt.getSystemId() == "http://gruesome/"); - assert(dt.getNodeName() == "charlie"); + assert(dt.getPublicId() == SA::construct_from_utf8("sss")); + assert(dt.getSystemId() == SA::construct_from_utf8("http://gruesome/")); + assert(dt.getNodeName() == SA::construct_from_utf8("charlie")); } // testDoc }; diff --git a/test/DOM_silly/.cvsignore b/test/DOM_silly/.cvsignore new file mode 100644 index 00000000..83c24031 --- /dev/null +++ b/test/DOM_silly/.cvsignore @@ -0,0 +1,15 @@ +*.obj +core +*.so +*.so.* +*.a +.depend +sax2dom_test +*.dep +*.plg +Debug +Release +*.exe +domwriter + + diff --git a/test/DOM_silly/DOM_test_silly.vcproj b/test/DOM_silly/DOM_test_silly.vcproj new file mode 100644 index 00000000..e88e31e6 --- /dev/null +++ b/test/DOM_silly/DOM_test_silly.vcproj @@ -0,0 +1,259 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/DOM_silly/main.cpp b/test/DOM_silly/main.cpp new file mode 100644 index 00000000..e40861f0 --- /dev/null +++ b/test/DOM_silly/main.cpp @@ -0,0 +1,55 @@ +#ifdef _MSC_VER +#pragma warning(disable: 4786 4250 4503) +#endif +#include +#include + +#include +#include +#include + +#include "../CppUnit/TestRunner.hpp" +#include "../CppUnit/framework/Test.h" +#include "../CppUnit/framework/TestSuite.h" + +#include "../DOM/test_DOMImplementation.h" +#include "../DOM/test_DocumentType.h" +/* +#include "test_Document.h" +#include "test_ProcessingInstruction.h" +#include "test_Siblings.h" +#include "test_Element.h" +#include "test_DocumentFragment.h" +#include "test_Attribute.h" +#include "test_Text.hpp" +#include "test_CDATA.hpp" +#include "test_CharacterData.hpp" +*/ + +#include "../silly_string/silly_string.hpp" + +template<> class Arabica::default_string_adaptor : public silly_string_adaptor { }; + +//////////////////////////////////////////////// +int main(int argc, char* argv[]) +{ + TestRunner runner; + + runner.addTest("DOMImplementationTest", DOMImplementationTest_suite >()); + runner.addTest("DocumentTypeTest", DocumentTypeTest_suite >()); + //runner.addTest("DocumentTest", DocumentTest_suite >()); + //runner.addTest("SiblingsTest", SiblingsTest_suite >()); + //runner.addTest("ElementTest", ElementTest_suite >()); + //runner.addTest("AttributeTest", AttrTest_suite >()); + //runner.addTest("ProcessingInstructionTest", ProcessingInstructionTest_suite >()); + //runner.addTest("TextTest", TextTest_suite >()); + //runner.addTest("CDATATest", CDATATest_suite >()); + //runner.addTest("CharacterDataText", CharacterDataTest_suite >()); + //runner.addTest("DocumentFragmentTest", DocumentFragmentTest_suite >()); + + runner.run(argc, argv); + + return 0; +} // main + +// end of file