Compile XSLT tests with wide strings

This commit is contained in:
Jez Higgins 2012-11-20 08:17:50 +00:00
parent c02395fbb4
commit bf8e7e314b
4 changed files with 160 additions and 94 deletions

View file

@ -2,97 +2,13 @@
#pragma warning(disable : 4250)
#endif
#include <iostream>
#include <string>
#include <sstream>
#include <map>
///////////////////////////////////////////////
#include "../CppUnit/TestRunner.hpp"
#include "../CppUnit/framework/Test.h"
#include "../CppUnit/framework/TestCase.h"
#include "../CppUnit/framework/TestSuite.h"
// #include "scope_test.hpp"
#include "xslt_test.hpp"
std::set<std::string> parse_tests_to_run(int argc, const char* argv[]);
void add_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names);
void add_arabica_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names);
const char* xalan_tests[] = {"attribvaltemplate", "axes", "boolean", "conditional",
"conflictres", "copy", "dflt", "expression", "extend",
/*"idkey",*/ "impincl", "lre", "match", "math",
"mdocs", "message", "modes", "namedtemplate",
"namespace", "node", /*"numberformat",*/ /*"numbering",*/
"output", "position", "predicate", "processorinfo", "reluri",
"select", "sort", "string", "variable", "ver", "whitespace", 0};
const char* msft_tests[] = { "AVTs", /*"AttributeSets",*/ "Attributes", "BVTs",
"Comment", "Completeness", "ConflictResolution", "Copying",
"Elements", "Errors", "Fallback", "ForEach", /*"FormatNumber",*/
"ForwardComp", "Import", "Keys", "Messages",
"Miscellaneous", "Modes", "NamedTemplates", "Namespace",
"Namespace-alias", "Namespace_XPath", /*"Number",*/
/*"Output",*/ "ProcessingInstruction", "RTF", "Sorting",
"Stylesheet", "Template", "Text", "Valueof",
"Variables", "Whitespaces", "XSLTFunctions", 0 };
const char* arabica_tests[] = { "attributes",
"errors", "include", "processing-instruction",
"stylesheet", "text", "variables", 0 };
int main(int argc, const char* argv[])
{
TestRunner runner;
std::set<std::string> tests_to_run = parse_tests_to_run(argc, argv);
// runner.addTest("ScopeTest", ScopeTest_suite<string_type, string_adaptor>());
Loader loader;
add_tests(runner, loader, tests_to_run, xalan_tests);
add_tests(runner, loader, tests_to_run, msft_tests);
add_arabica_tests(runner, loader, tests_to_run, arabica_tests);
runner.run(argc, argv);
return 77;
bool ok = XSLT_test_suite<std::wstring, Arabica::default_string_adaptor<std::wstring> >(argc, argv);
//return !ok;
return 77; // the make check magic ignore this result marker
} // main
std::set<std::string> parse_tests_to_run(int argc, const char* argv[])
{
std::set<std::string> tests;
for(int a = 1; a != argc; ++a)
if(argv[a][0] != '-')
tests.insert(argv[a]);
else
{
if(std::string(argv[a]) == "-log")
++a; // skip next
} // if ...
return tests;
} // tests_to_run
void add_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names)
{
std::set<std::string>::const_iterator end = wanted.end();
while(*test_names != 0)
{
if(wanted.empty() || (wanted.find(*test_names) != end))
runner.addTest(*test_names, loader.XSLTTest_suite(*test_names));
++test_names;
} // while ...
} // all_all_tests
void add_arabica_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names)
{
std::set<std::string>::const_iterator end = wanted.end();
while(*test_names != 0)
{
if(wanted.empty() || (wanted.find(*test_names) != end))
runner.addTest(*test_names, loader.ArabicaTest_suite(*test_names));
++test_names;
} // while ...
} // all_all_tests

View file

@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ArabicaLib", "lib_arabica.vcxproj", "{4CA72415-D03A-4447-BE4E-C093A5146CAC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_DOM", "test_DOM.vcxproj", "{74A66132-475A-4DA1-8EF7-9CB0EF71E3D8}"
@ -26,6 +26,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_xpath_wide", "test_xpa
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_xslt", "test_xslt.vcxproj", "{44BA3424-C58E-4A49-ADDD-6180C61E5E34}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_xslt_wide", "test_xslt_wide.vcxproj", "{B4FB0A94-1792-43F1-A57F-4D77AB7593DB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -84,6 +86,10 @@ Global
{44BA3424-C58E-4A49-ADDD-6180C61E5E34}.Debug|Win32.Build.0 = Debug|Win32
{44BA3424-C58E-4A49-ADDD-6180C61E5E34}.Release|Win32.ActiveCfg = Release|Win32
{44BA3424-C58E-4A49-ADDD-6180C61E5E34}.Release|Win32.Build.0 = Release|Win32
{B4FB0A94-1792-43F1-A57F-4D77AB7593DB}.Debug|Win32.ActiveCfg = Debug|Win32
{B4FB0A94-1792-43F1-A57F-4D77AB7593DB}.Debug|Win32.Build.0 = Debug|Win32
{B4FB0A94-1792-43F1-A57F-4D77AB7593DB}.Release|Win32.ActiveCfg = Release|Win32
{B4FB0A94-1792-43F1-A57F-4D77AB7593DB}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -11,7 +11,7 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{44BA3424-C58E-4A49-ADDD-6180C61E5E34}</ProjectGuid>
<ProjectGuid>{B4FB0A94-1792-43F1-A57F-4D77AB7593DB}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@ -45,8 +45,8 @@
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\..\bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release_test_xslt\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">xslt_test</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">xslt_test</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">xslt_test_wide</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">xslt_test_wide</TargetName>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\work\usr\include;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\work\usr\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
@ -115,7 +115,6 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\tests\Xslt\main_wide.cpp" />
<ClCompile Include="..\tests\XSLT\xslt_test.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\Xslt\xslt_test.hpp" />
@ -142,4 +141,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View file

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{44BA3424-C58E-4A49-ADDD-6180C61E5E34}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\..\bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug_test_xslt\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\..\bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release_test_xslt\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">xslt_test</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">xslt_test</TargetName>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\work\usr\include;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\work\usr\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/Zm1000 %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>..\lib\arabica-debug.lib;..\lib\cppunit-debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>NotSet</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalOptions>/Zm1000 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<DisableLanguageExtensions>false</DisableLanguageExtensions>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>..\lib\arabica.lib;..\lib\cppunit.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>
</OptimizeReferences>
<EnableCOMDATFolding>
</EnableCOMDATFolding>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>NotSet</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\tests\Xslt\main_wide.cpp" />
<ClCompile Include="..\tests\XSLT\xslt_test.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\tests\Xslt\xslt_test.hpp" />
</ItemGroup>
<ItemGroup>
<None Include="..\tests\XSLT\testsuite\TESTS\arabica-catalog.xml" />
<None Include="..\tests\Xslt\testsuite\Tests\arabica-expected-fails.xml" />
<None Include="..\tests\Xslt\testsuite\Tests\catalog.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="lib_arabica.vcxproj">
<Project>{4ca72415-d03a-4447-be4e-c093a5146cac}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="test_DOM.vcxproj">
<Project>{74a66132-475a-4da1-8ef7-9cb0ef71e3d8}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="test_xpath.vcxproj">
<Project>{b3c75b3a-bb0a-4b23-87f9-fb9cd98ff8ce}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>