| @@ -0,0 +1,99 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project DefaultTargets="Build" ToolsVersion="12.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>{624E0933-6EC9-4441-B0E7-B91AD913A772}</ProjectGuid> | |||||
| <Keyword>Win32Proj</Keyword> | |||||
| <RootNamespace>UnitTest1</RootNamespace> | |||||
| </PropertyGroup> | |||||
| <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | |||||
| <ConfigurationType>DynamicLibrary</ConfigurationType> | |||||
| <UseDebugLibraries>true</UseDebugLibraries> | |||||
| <PlatformToolset>v120</PlatformToolset> | |||||
| <CharacterSet>MultiByte</CharacterSet> | |||||
| <UseOfMfc>false</UseOfMfc> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | |||||
| <ConfigurationType>DynamicLibrary</ConfigurationType> | |||||
| <UseDebugLibraries>false</UseDebugLibraries> | |||||
| <PlatformToolset>v120</PlatformToolset> | |||||
| <WholeProgramOptimization>true</WholeProgramOptimization> | |||||
| <CharacterSet>Unicode</CharacterSet> | |||||
| <UseOfMfc>false</UseOfMfc> | |||||
| </PropertyGroup> | |||||
| <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | |||||
| <ImportGroup Label="ExtensionSettings"> | |||||
| </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> | |||||
| <PropertyGroup Label="UserMacros" /> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |||||
| <LinkIncremental>true</LinkIncremental> | |||||
| </PropertyGroup> | |||||
| <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |||||
| <LinkIncremental>true</LinkIncremental> | |||||
| </PropertyGroup> | |||||
| <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |||||
| <ClCompile> | |||||
| <PrecompiledHeader>Use</PrecompiledHeader> | |||||
| <WarningLevel>Level3</WarningLevel> | |||||
| <Optimization>Disabled</Optimization> | |||||
| <AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |||||
| <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |||||
| <UseFullPaths>true</UseFullPaths> | |||||
| </ClCompile> | |||||
| <Link> | |||||
| <SubSystem>Windows</SubSystem> | |||||
| <GenerateDebugInformation>true</GenerateDebugInformation> | |||||
| <AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | |||||
| <AdditionalDependencies>..\jia\Debug\jia.obj;..\jian\Debug\jian.obj;..\chen\Debug\chen.obj;..\chu\Debug\chu.obj;%(AdditionalDependencies)</AdditionalDependencies> | |||||
| </Link> | |||||
| </ItemDefinitionGroup> | |||||
| <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |||||
| <ClCompile> | |||||
| <WarningLevel>Level3</WarningLevel> | |||||
| <PrecompiledHeader>Use</PrecompiledHeader> | |||||
| <Optimization>MaxSpeed</Optimization> | |||||
| <FunctionLevelLinking>true</FunctionLevelLinking> | |||||
| <IntrinsicFunctions>true</IntrinsicFunctions> | |||||
| <AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |||||
| <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |||||
| <UseFullPaths>true</UseFullPaths> | |||||
| </ClCompile> | |||||
| <Link> | |||||
| <SubSystem>Windows</SubSystem> | |||||
| <GenerateDebugInformation>true</GenerateDebugInformation> | |||||
| <EnableCOMDATFolding>true</EnableCOMDATFolding> | |||||
| <OptimizeReferences>true</OptimizeReferences> | |||||
| <AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | |||||
| </Link> | |||||
| </ItemDefinitionGroup> | |||||
| <ItemGroup> | |||||
| <ClInclude Include="stdafx.h" /> | |||||
| <ClInclude Include="targetver.h" /> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ClCompile Include="stdafx.cpp"> | |||||
| <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> | |||||
| <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> | |||||
| </ClCompile> | |||||
| <ClCompile Include="unittest1.cpp" /> | |||||
| </ItemGroup> | |||||
| <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |||||
| <ImportGroup Label="ExtensionTargets"> | |||||
| </ImportGroup> | |||||
| </Project> | |||||
| @@ -0,0 +1,33 @@ | |||||
| <?xml version="1.0" encoding="utf-8"?> | |||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||||
| <ItemGroup> | |||||
| <Filter Include="源文件"> | |||||
| <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | |||||
| <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | |||||
| </Filter> | |||||
| <Filter Include="头文件"> | |||||
| <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | |||||
| <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> | |||||
| </Filter> | |||||
| <Filter Include="资源文件"> | |||||
| <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> | |||||
| <ClInclude Include="stdafx.h"> | |||||
| <Filter>头文件</Filter> | |||||
| </ClInclude> | |||||
| <ClInclude Include="targetver.h"> | |||||
| <Filter>头文件</Filter> | |||||
| </ClInclude> | |||||
| </ItemGroup> | |||||
| <ItemGroup> | |||||
| <ClCompile Include="stdafx.cpp"> | |||||
| <Filter>源文件</Filter> | |||||
| </ClCompile> | |||||
| <ClCompile Include="unittest1.cpp"> | |||||
| <Filter>源文件</Filter> | |||||
| </ClCompile> | |||||
| </ItemGroup> | |||||
| </Project> | |||||
| @@ -0,0 +1,8 @@ | |||||
| // stdafx.cpp : 只包括标准包含文件的源文件 | |||||
| // UnitTest1.pch 将作为预编译头 | |||||
| // stdafx.obj 将包含预编译类型信息 | |||||
| #include "stdafx.h" | |||||
| // TODO: 在 STDAFX.H 中引用任何所需的附加头文件, | |||||
| //而不是在此文件中引用 | |||||
| @@ -0,0 +1,13 @@ | |||||
| // stdafx.h : 标准系统包含文件的包含文件, | |||||
| // 或是经常使用但不常更改的 | |||||
| // 特定于项目的包含文件 | |||||
| // | |||||
| #pragma once | |||||
| #include "targetver.h" | |||||
| // 用于 CppUnitTest 的头文件 | |||||
| #include "CppUnitTest.h" | |||||
| // TODO: 在此处引用程序需要的其他头文件 | |||||
| @@ -0,0 +1,8 @@ | |||||
| #pragma once | |||||
| // 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。 | |||||
| // 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将 | |||||
| // _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。 | |||||
| #include <SDKDDKVer.h> | |||||
| @@ -0,0 +1,93 @@ | |||||
| #include "stdafx.h" | |||||
| #include "CppUnitTest.h" | |||||
| #include "Windows.h" | |||||
| #include"../jia/jia.h" | |||||
| #include"../jian/jian.h" | |||||
| #include"../chen/chen.h" | |||||
| #include"../chu/chu.h" | |||||
| using namespace Microsoft::VisualStudio::CppUnitTestFramework; | |||||
| namespace UnitTest1 | |||||
| { | |||||
| TEST_CLASS(UnitTest1) | |||||
| { | |||||
| public: | |||||
| TEST_METHOD(TestMethod1) | |||||
| { | |||||
| // TODO: ÔÚ´ËÊäÈë²âÊÔ´úÂë | |||||
| int SUM = GetPrivateProfileInt("Len", "sum", 0, "../ex1.ini"); | |||||
| { | |||||
| for (int i = 1; i <= SUM; i++) | |||||
| { | |||||
| char SUMStr[8]; | |||||
| char TestStr[8] = { "Test" }; | |||||
| _itoa_s(i, SUMStr, 8); | |||||
| strcat_s(TestStr, SUMStr); | |||||
| int num1 = GetPrivateProfileInt("TestStr", "number1", 0, "ex1.ini"); | |||||
| int num2 = GetPrivateProfileInt("TestStr", "number2", 0, "ex1.ini"); | |||||
| int output = GetPrivateProfileInt("TestStr", "output", 0, "ex1.ini"); | |||||
| Assert::AreEqual(output, add(num1, num2)); | |||||
| } | |||||
| } | |||||
| } | |||||
| TEST_METHOD(TestMethod2) | |||||
| { | |||||
| int SUB = GetPrivateProfileInt("Len", "sum", 0, "../ex2.ini"); | |||||
| { | |||||
| for (int j = 1; j <= SUB; j++) | |||||
| { | |||||
| char SUBStr[8]; | |||||
| char TestStr[8] = { "Test" }; | |||||
| _itoa_s(j, SUBStr, 8); | |||||
| strcat_s(TestStr, SUBStr); | |||||
| int num1 = GetPrivateProfileInt("TestStr", "number1", 0, "ex2.ini"); | |||||
| int num2 = GetPrivateProfileInt("TestStr", "number2", 0, "ex2.ini"); | |||||
| int output = GetPrivateProfileInt("TestStr", "output", 0, "ex2.ini"); | |||||
| Assert::AreEqual(output, sub(num1, num2)); | |||||
| } | |||||
| } | |||||
| } | |||||
| TEST_METHOD(TestMethod3) | |||||
| { | |||||
| int MUL = GetPrivateProfileInt("Len", "sum", 0, "../ex3.ini"); | |||||
| { | |||||
| for (int i = 1; i <= MUL; i++) | |||||
| { | |||||
| char MULStr[8]; | |||||
| char TestStr[8] = { "Test" }; | |||||
| _itoa_s(i, MULStr, 8); | |||||
| strcat_s(TestStr, MULStr); | |||||
| int num1 = GetPrivateProfileInt("TestStr", "number1", 0, "ex3.ini"); | |||||
| int num2 = GetPrivateProfileInt("TestStr", "number2", 0, "ex3.ini"); | |||||
| int output = GetPrivateProfileInt("TestStr", "output", 0, "ex3.ini"); | |||||
| Assert::AreEqual(output, mul(num1, num2)); | |||||
| } | |||||
| } | |||||
| } | |||||
| TEST_METHOD(TestMethod4) | |||||
| { | |||||
| int DIV = GetPrivateProfileInt("Len", "sum", 0, "../ex4.ini"); | |||||
| { | |||||
| for (int i = 1; i <= DIV; i++) | |||||
| { | |||||
| char DIVStr[8]; | |||||
| char TestStr[8] = { "Test" }; | |||||
| _itoa_s(i, DIVStr, 8); | |||||
| strcat_s(TestStr, DIVStr); | |||||
| int num1 = GetPrivateProfileInt("TestStr", "number1", 0, "ex4.ini"); | |||||
| int num2 = GetPrivateProfileInt("TestStr", "number2", 0, "ex4.ini"); | |||||
| int output = GetPrivateProfileInt("TestStr", "output", 0, "ex4.ini"); | |||||
| Assert::AreEqual(output, chu(num1, num2)); | |||||
| } | |||||
| } | |||||
| } | |||||
| }; | |||||
| } | |||||
| @@ -0,0 +1,42 @@ | |||||
| [Len] | |||||
| sum=8 | |||||
| [Test1] | |||||
| number1=1 | |||||
| number2=2 | |||||
| output=3 | |||||
| [Test2] | |||||
| number1=-1 | |||||
| number2=2 | |||||
| output=1 | |||||
| [Test3] | |||||
| number1=1 | |||||
| number2=-5 | |||||
| output=-4 | |||||
| [Test4] | |||||
| number1=-1 | |||||
| number2=-2 | |||||
| output=-3 | |||||
| [Test5] | |||||
| number1=1000 | |||||
| number2=20000 | |||||
| output=21000 | |||||
| [Test6] | |||||
| number1=-1000 | |||||
| number2=200 | |||||
| output=-800 | |||||
| [Test7] | |||||
| number1=3000 | |||||
| number2=-10 | |||||
| output=2990 | |||||
| [Test8] | |||||
| number1=100000 | |||||
| number2=5000000 | |||||
| output=5100000 | |||||
| @@ -0,0 +1,42 @@ | |||||
| [Len] | |||||
| sum=8 | |||||
| [Test1] | |||||
| number1=1 | |||||
| number2=2 | |||||
| output=-1 | |||||
| [Test2] | |||||
| number1=-1 | |||||
| number2=2 | |||||
| output=-3 | |||||
| [Test3] | |||||
| number1=1 | |||||
| number2=-5 | |||||
| output=6 | |||||
| [Test4] | |||||
| number1=-9 | |||||
| number2=-11 | |||||
| output=2 | |||||
| [Test5] | |||||
| number1=10000 | |||||
| number2=2000 | |||||
| output=8000 | |||||
| [Test6] | |||||
| number1=-1 | |||||
| number2=200 | |||||
| output=-201 | |||||
| [Test7] | |||||
| number1=300 | |||||
| number2=-10000 | |||||
| output=10300 | |||||
| [Test8] | |||||
| number1=10000 | |||||
| number2=500000 | |||||
| output=-490000 | |||||
| @@ -0,0 +1,42 @@ | |||||
| [Len] | |||||
| sum=8 | |||||
| [Test1] | |||||
| number1=1 | |||||
| number2=2 | |||||
| output=2 | |||||
| [Test2] | |||||
| number1=-1 | |||||
| number2=2 | |||||
| output=-2 | |||||
| [Test3] | |||||
| number1=1 | |||||
| number2=-5 | |||||
| output=-5 | |||||
| [Test4] | |||||
| number1=-9 | |||||
| number2=-11 | |||||
| output=99 | |||||
| [Test5] | |||||
| number1=100 | |||||
| number2=200 | |||||
| output=20000 | |||||
| [Test6] | |||||
| number1=-10000 | |||||
| number2=200 | |||||
| output=-2000000 | |||||
| [Test7] | |||||
| number1=300 | |||||
| number2=-1 | |||||
| output=-300 | |||||
| [Test8] | |||||
| number1=-11 | |||||
| number2=-11 | |||||
| output=121 | |||||
| @@ -0,0 +1,42 @@ | |||||
| [Len] | |||||
| sum=8 | |||||
| [Test1] | |||||
| number1=100 | |||||
| number2=0 | |||||
| output=0 | |||||
| [Test2] | |||||
| number1=-2 | |||||
| number2=1 | |||||
| output=-2 | |||||
| [Test3] | |||||
| number1=5 | |||||
| number2=-1 | |||||
| output=-5 | |||||
| [Test4] | |||||
| number1=-10 | |||||
| number2=-2 | |||||
| output=5 | |||||
| [Test5] | |||||
| number1=998 | |||||
| number2=-998 | |||||
| output=-1 | |||||
| [Test6] | |||||
| number1=-10000 | |||||
| number2=200 | |||||
| output=-500 | |||||
| [Test7] | |||||
| number1=300 | |||||
| number2=-1 | |||||
| output=-300 | |||||
| [Test8] | |||||
| number1=0 | |||||
| number2=1000 | |||||
| output=0 | |||||