Skip to content

Commit

Permalink
chore(Tests): Unit tests for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
macmade committed Nov 12, 2024
1 parent 6c8c0c6 commit d84836e
Show file tree
Hide file tree
Showing 4 changed files with 306 additions and 0 deletions.
26 changes: 26 additions & 0 deletions SRPXX-Tests/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2024 Jean-David Gadina - www.xs-labs.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/

#define XSTEST_MAIN_RUN
#include <XSTest/XSTest.hpp>
10 changes: 10 additions & 0 deletions SRPXX.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SRPXX-v143", "VisualStudio\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SRPXX-Debug", "VisualStudio\SRPXX-Debug.vcxproj", "{2DB2E3E5-5D70-48AA-B568-1159B49E4180}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SRPXX-Tests", "VisualStudio\SRPXX-Tests.vcxproj", "{A5B515DE-C717-4C51-87E8-3DFF21B90FA1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -41,6 +43,14 @@ Global
{2DB2E3E5-5D70-48AA-B568-1159B49E4180}.Release|x64.Build.0 = Release|x64
{2DB2E3E5-5D70-48AA-B568-1159B49E4180}.Release|x86.ActiveCfg = Release|Win32
{2DB2E3E5-5D70-48AA-B568-1159B49E4180}.Release|x86.Build.0 = Release|Win32
{A5B515DE-C717-4C51-87E8-3DFF21B90FA1}.Debug|x64.ActiveCfg = Debug|x64
{A5B515DE-C717-4C51-87E8-3DFF21B90FA1}.Debug|x64.Build.0 = Debug|x64
{A5B515DE-C717-4C51-87E8-3DFF21B90FA1}.Debug|x86.ActiveCfg = Debug|Win32
{A5B515DE-C717-4C51-87E8-3DFF21B90FA1}.Debug|x86.Build.0 = Debug|Win32
{A5B515DE-C717-4C51-87E8-3DFF21B90FA1}.Release|x64.ActiveCfg = Release|x64
{A5B515DE-C717-4C51-87E8-3DFF21B90FA1}.Release|x64.Build.0 = Release|x64
{A5B515DE-C717-4C51-87E8-3DFF21B90FA1}.Release|x86.ActiveCfg = Release|Win32
{A5B515DE-C717-4C51-87E8-3DFF21B90FA1}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
192 changes: 192 additions & 0 deletions VisualStudio/SRPXX-Tests.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" 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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{A5B515DE-C717-4C51-87E8-3DFF21B90FA1}</ProjectGuid>
<RootNamespace>SRPXXTests</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)Build\32\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)Build\32\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)Build\64\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)Build\64\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;DEBUG;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>.;..\SRPXX\include;..\Submodules\XSTest\XSTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>crypto-v143.lib;ssl-v143.lib;decrepit-v143.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)Submodules\BoringSSL\lib\Windows\32\Debug</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>.;..\SRPXX\include;..\Submodules\XSTest\XSTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>crypto-v143.lib;ssl-v143.lib;decrepit-v143.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)Submodules\BoringSSL\lib\Windows\32\Release</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>DEBUG;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>.;..\SRPXX\include;..\Submodules\XSTest\XSTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>crypto-v143.lib;ssl-v143.lib;decrepit-v143.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)Submodules\BoringSSL\lib\Windows\64\Debug</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>.;..\SRPXX\include;..\Submodules\XSTest\XSTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>crypto-v143.lib;ssl-v143.lib;decrepit-v143.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)Submodules\BoringSSL\lib\Windows\64\Release</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="SRPXX-v143.vcxproj">
<Project>{a6695da4-3581-4321-a064-7a75ef189388}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\SRPXX-Tests\Base.cpp" />
<ClCompile Include="..\SRPXX-Tests\Base64.cpp" />
<ClCompile Include="..\SRPXX-Tests\BigNum.cpp" />
<ClCompile Include="..\SRPXX-Tests\Client.cpp" />
<ClCompile Include="..\SRPXX-Tests\Constants.cpp" />
<ClCompile Include="..\SRPXX-Tests\Integer.cpp" />
<ClCompile Include="..\SRPXX-Tests\main.cpp" />
<ClCompile Include="..\SRPXX-Tests\PBKDF2.cpp" />
<ClCompile Include="..\SRPXX-Tests\Platform.cpp" />
<ClCompile Include="..\SRPXX-Tests\Random.cpp" />
<ClCompile Include="..\SRPXX-Tests\Server.cpp" />
<ClCompile Include="..\SRPXX-Tests\SHA1.cpp" />
<ClCompile Include="..\SRPXX-Tests\SHA224.cpp" />
<ClCompile Include="..\SRPXX-Tests\SHA256.cpp" />
<ClCompile Include="..\SRPXX-Tests\SHA384.cpp" />
<ClCompile Include="..\SRPXX-Tests\SHA512.cpp" />
<ClCompile Include="..\SRPXX-Tests\SRP.cpp" />
<ClCompile Include="..\SRPXX-Tests\String.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\SRPXX-Tests\Constants.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
78 changes: 78 additions & 0 deletions VisualStudio/SRPXX-Tests.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\SRPXX-Tests\Base.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\Base64.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\BigNum.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\Client.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\Constants.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\Integer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\PBKDF2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\Platform.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\Random.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\Server.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\SHA1.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\SHA224.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\SHA256.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\SHA384.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\SHA512.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\SRP.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\String.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\SRPXX-Tests\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\SRPXX-Tests\Constants.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

0 comments on commit d84836e

Please sign in to comment.