*** empty log message ***

This commit is contained in:
jez_higgins 2005-10-27 21:50:10 +00:00
parent c4f64832ab
commit f159e99764
9 changed files with 385 additions and 36 deletions

View file

@ -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

View file

@ -15,7 +15,9 @@ namespace Arabica
//forward decl
template<class stringT>
class default_string_adaptor;
class default_string_adaptor
{
};
template<class stringT>

View file

@ -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"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\..\..\bin/SAX2DOM_test.tlb"/>
TypeLibraryName=".\..\..\bin/DOM_test.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
@ -94,7 +94,7 @@
TreatWChar_tAsBuiltInType="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/SAX2DOM_test.pch"
PrecompiledHeaderFile=".\Release/DOM_test.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
@ -109,11 +109,11 @@
OutputFile="$(OutDir)/DOM_test.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/SAX2DOM_test.pdb"
ProgramDatabaseFile=".\Release/DOM_test.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/SAX2DOM_test.tlb"/>
TypeLibraryName=".\Release/DOM_test.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool

View file

@ -29,17 +29,17 @@ int main(int argc, char* argv[])
{
TestRunner runner;
runner.addTest("DOMImplementationTest", DOMImplementationTest_suite<std::string, Arabica::default_string_adaptor_base<std::string> >());
runner.addTest("DocumentTypeTest", DocumentTypeTest_suite<std::string, Arabica::default_string_adaptor_base<std::string> >());
runner.addTest("DocumentTest", DocumentTest_suite<std::string, Arabica::default_string_adaptor_base<std::string> >());
runner.addTest("DOMImplementationTest", DOMImplementationTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("DocumentTypeTest", DocumentTypeTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("DocumentTest", DocumentTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("SiblingsTest", SiblingsTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("ElementTest", ElementTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("AttributeTest", AttrTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("ProcessingInstructionTest", ProcessingInstructionTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("TextTest", TextTest_suite<std::string, Arabica::default_string_adaptor_base<std::string> >());
runner.addTest("CDATATest", CDATATest_suite<std::string, Arabica::default_string_adaptor_base<std::string> >());
runner.addTest("CharacterDataText", CharacterDataTest_suite<std::string, Arabica::default_string_adaptor_base<std::string> >());
runner.addTest("DocumentFragmentTest", DocumentFragmentTest_suite<std::string, Arabica::default_string_adaptor_base<std::string> >());
runner.addTest("TextTest", TextTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("CDATATest", CDATATest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("CharacterDataText", CharacterDataTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.addTest("DocumentFragmentTest", DocumentFragmentTest_suite<std::string, Arabica::default_string_adaptor<std::string> >());
runner.run(argc, argv);
return 0;

View file

@ -10,6 +10,7 @@
template<class string_type, class string_adaptor>
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<string_type> di;
assert(di == 0);
DOM::DOMImplementation<string_type> di2 = SimpleDOM::DOMImplementation<string_type>::getDOMImplementation();
DOM::DOMImplementation<string_type> di2 = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
assert(di2 != 0);
assert(di != di2);
@ -38,23 +39,23 @@ class DOMImplementationTest : public TestCase
void testFeatures()
{
DOM::DOMImplementation<string_type> di = SimpleDOM::DOMImplementation<string_type>::getDOMImplementation();
DOM::DOMImplementation<string_type> di = SimpleDOM::DOMImplementation<string_type, string_adaptor>::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
};

View file

@ -11,6 +11,7 @@ template<class string_type, class string_adaptor>
class DocumentTypeTest : public TestCase
{
DOM::DOMImplementation<string_type> factory;
typedef string_adaptor SA;
public:
DocumentTypeTest(std::string name) :
@ -20,7 +21,7 @@ class DocumentTypeTest : public TestCase
void setUp()
{
factory = SimpleDOM::DOMImplementation<string_type>::getDOMImplementation();
factory = SimpleDOM::DOMImplementation<string_type, string_adaptor>::getDOMImplementation();
} // setUp
void testNull()
@ -34,7 +35,9 @@ class DocumentTypeTest : public TestCase
void testCreate()
{
DOM::DocumentType<string_type> d = factory.createDocumentType("charlie", "", "http://gruesome/");
DOM::DocumentType<string_type> d = factory.createDocumentType(SA::construct_from_utf8("charlie"),
SA::construct_from_utf8(""),
SA::construct_from_utf8("http://gruesome/"));
assert(d != 0);
DOM::Node<string_type> n;
@ -48,12 +51,14 @@ class DocumentTypeTest : public TestCase
DOM::DocumentType<string_type> d2;
assert(d != d2);
assert(d2!= d);
assert(d2 != d);
d2 = d;
assert(d == d2);
assert(d2 == d);
DOM::DocumentType<string_type> d3 = factory.createDocumentType("billy", "", "http://gruesome/");;
DOM::DocumentType<string_type> 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<string_type> d = factory.createDocumentType("charlie", "sss", "http://gruesome/");
DOM::DocumentType<string_type> d = factory.createDocumentType(SA::construct_from_utf8("charlie"),
SA::construct_from_utf8("sss"),
SA::construct_from_utf8("http://gruesome/"));
DOM::Document<string_type> doc = factory.createDocument("", "doc", d);
DOM::Document<string_type> doc = factory.createDocument(SA::construct_from_utf8(""),
SA::construct_from_utf8("doc"),
d);
DOM::DocumentType<string_type> 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
};

15
test/DOM_silly/.cvsignore Normal file
View file

@ -0,0 +1,15 @@
*.obj
core
*.so
*.so.*
*.a
.depend
sax2dom_test
*.dep
*.plg
Debug
Release
*.exe
domwriter

View file

@ -0,0 +1,259 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="test_DOM_silly"
ProjectGUID="{74A66132-475A-4DA1-8EF7-9CB0EF71E3D8}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\..\..\bin"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/Zm200"
Optimization="0"
AdditionalIncludeDirectories="..\..\"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
TreatWChar_tAsBuiltInType="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/SAX2DOM_test.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="wsock32.lib"
OutputFile="$(OutDir)/DOM_test_ss.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\..\..\bin/DOM_test_ss.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\..\..\bin/DOM_test_ss.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="2057"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\..\..\bin"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
TreatWChar_tAsBuiltInType="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/DOM_test.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="wsock32.lib"
OutputFile="$(OutDir)/DOM_test_ss.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/DOM_test_ss.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/DOM_test_ss.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\main.cpp">
</File>
<File
RelativePath="..\silly_string\silly_string.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="..\silly_string\silly_string.hpp">
</File>
<File
RelativePath="..\Dom\test_Attribute.h">
</File>
<File
RelativePath="..\Dom\test_CDATA.hpp">
</File>
<File
RelativePath="..\Dom\test_CharacterData.hpp">
</File>
<File
RelativePath="..\Dom\test_Document.h">
</File>
<File
RelativePath="..\Dom\test_DocumentFragment.h">
</File>
<File
RelativePath="..\Dom\test_DocumentType.h">
</File>
<File
RelativePath="..\Dom\test_DOMImplementation.h">
</File>
<File
RelativePath="..\Dom\test_Element.h">
</File>
<File
RelativePath="..\Dom\test_ProcessingInstruction.h">
</File>
<File
RelativePath="..\Dom\test_Siblings.h">
</File>
<File
RelativePath="..\Dom\test_Text.hpp">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
<Filter
Name="Libs">
<File
RelativePath="..\..\lib\Arabica.lib">
</File>
</Filter>
<Filter
Name="CppUnit">
<File
RelativePath="..\CppUnit\framework\CppUnitException.h">
</File>
<File
RelativePath="..\CppUnit\framework\estring.h">
</File>
<File
RelativePath="..\CppUnit\framework\Guards.h">
</File>
<File
RelativePath="..\CppUnit\framework\Test.h">
</File>
<File
RelativePath="..\CppUnit\framework\TestCaller.h">
</File>
<File
RelativePath="..\CppUnit\framework\TestCase.cpp">
</File>
<File
RelativePath="..\CppUnit\framework\TestCase.h">
</File>
<File
RelativePath="..\CppUnit\framework\TestFailure.cpp">
</File>
<File
RelativePath="..\CppUnit\framework\TestFailure.h">
</File>
<File
RelativePath="..\CppUnit\framework\TestResult.cpp">
</File>
<File
RelativePath="..\CppUnit\framework\TestResult.h">
</File>
<File
RelativePath="..\CppUnit\TestRunner.cpp">
</File>
<File
RelativePath="..\CppUnit\TestRunner.hpp">
</File>
<File
RelativePath="..\CppUnit\framework\TestSuite.cpp">
</File>
<File
RelativePath="..\CppUnit\framework\TestSuite.h">
</File>
<File
RelativePath="..\CppUnit\textui\TextTestResult.cpp">
</File>
<File
RelativePath="..\CppUnit\textui\TextTestResult.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

55
test/DOM_silly/main.cpp Normal file
View file

@ -0,0 +1,55 @@
#ifdef _MSC_VER
#pragma warning(disable: 4786 4250 4503)
#endif
#include <iostream>
#include <string>
#include <iostream>
#include <vector>
#include <map>
#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<silly_string> : public silly_string_adaptor { };
////////////////////////////////////////////////
int main(int argc, char* argv[])
{
TestRunner runner;
runner.addTest("DOMImplementationTest", DOMImplementationTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
runner.addTest("DocumentTypeTest", DocumentTypeTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
//runner.addTest("DocumentTest", DocumentTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
//runner.addTest("SiblingsTest", SiblingsTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
//runner.addTest("ElementTest", ElementTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
//runner.addTest("AttributeTest", AttrTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
//runner.addTest("ProcessingInstructionTest", ProcessingInstructionTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
//runner.addTest("TextTest", TextTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
//runner.addTest("CDATATest", CDATATest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
//runner.addTest("CharacterDataText", CharacterDataTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
//runner.addTest("DocumentFragmentTest", DocumentFragmentTest_suite<silly_string, Arabica::default_string_adaptor<silly_string> >());
runner.run(argc, argv);
return 0;
} // main
// end of file