diff --git a/hxh_d2s/Calculator/.vs/Calculator/v15/.suo b/hxh_d2s/Calculator/.vs/Calculator/v15/.suo new file mode 100644 index 00000000..f6b9180a Binary files /dev/null and b/hxh_d2s/Calculator/.vs/Calculator/v15/.suo differ diff --git a/hxh_d2s/Calculator/.vs/Calculator/v15/Browse.VC.db b/hxh_d2s/Calculator/.vs/Calculator/v15/Browse.VC.db new file mode 100644 index 00000000..ecf94601 Binary files /dev/null and b/hxh_d2s/Calculator/.vs/Calculator/v15/Browse.VC.db differ diff --git a/hxh_d2s/Calculator/.vs/Calculator/v15/Solution.VC.db b/hxh_d2s/Calculator/.vs/Calculator/v15/Solution.VC.db new file mode 100644 index 00000000..1b25642d Binary files /dev/null and b/hxh_d2s/Calculator/.vs/Calculator/v15/Solution.VC.db differ diff --git a/hxh_d2s/Calculator/.vs/Calculator/v15/ipch/1e84b88aef658e4b.ipch b/hxh_d2s/Calculator/.vs/Calculator/v15/ipch/1e84b88aef658e4b.ipch new file mode 100644 index 00000000..82fbe195 Binary files /dev/null and b/hxh_d2s/Calculator/.vs/Calculator/v15/ipch/1e84b88aef658e4b.ipch differ diff --git a/hxh_d2s/Calculator/.vs/Calculator/v15/ipch/e490e2282713b4a4.ipch b/hxh_d2s/Calculator/.vs/Calculator/v15/ipch/e490e2282713b4a4.ipch new file mode 100644 index 00000000..98ddfca8 Binary files /dev/null and b/hxh_d2s/Calculator/.vs/Calculator/v15/ipch/e490e2282713b4a4.ipch differ diff --git a/hxh_d2s/Calculator/Calculator.sln b/hxh_d2s/Calculator/Calculator.sln new file mode 100644 index 00000000..a52f4fee --- /dev/null +++ b/hxh_d2s/Calculator/Calculator.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.852 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Calculator", "Calculator\Calculator.vcxproj", "{4AB650C7-074A-42C3-939D-0A4F9B0FBB7F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalculatorUnitTest", "CalculatorUnitTest\CalculatorUnitTest.vcxproj", "{3567AACE-3EDA-42C0-B61C-A908FF6C891E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4AB650C7-074A-42C3-939D-0A4F9B0FBB7F}.Debug|x64.ActiveCfg = Debug|x64 + {4AB650C7-074A-42C3-939D-0A4F9B0FBB7F}.Debug|x64.Build.0 = Debug|x64 + {4AB650C7-074A-42C3-939D-0A4F9B0FBB7F}.Debug|x86.ActiveCfg = Debug|Win32 + {4AB650C7-074A-42C3-939D-0A4F9B0FBB7F}.Debug|x86.Build.0 = Debug|Win32 + {4AB650C7-074A-42C3-939D-0A4F9B0FBB7F}.Release|x64.ActiveCfg = Release|x64 + {4AB650C7-074A-42C3-939D-0A4F9B0FBB7F}.Release|x64.Build.0 = Release|x64 + {4AB650C7-074A-42C3-939D-0A4F9B0FBB7F}.Release|x86.ActiveCfg = Release|Win32 + {4AB650C7-074A-42C3-939D-0A4F9B0FBB7F}.Release|x86.Build.0 = Release|Win32 + {3567AACE-3EDA-42C0-B61C-A908FF6C891E}.Debug|x64.ActiveCfg = Debug|x64 + {3567AACE-3EDA-42C0-B61C-A908FF6C891E}.Debug|x64.Build.0 = Debug|x64 + {3567AACE-3EDA-42C0-B61C-A908FF6C891E}.Debug|x86.ActiveCfg = Debug|Win32 + {3567AACE-3EDA-42C0-B61C-A908FF6C891E}.Debug|x86.Build.0 = Debug|Win32 + {3567AACE-3EDA-42C0-B61C-A908FF6C891E}.Release|x64.ActiveCfg = Release|x64 + {3567AACE-3EDA-42C0-B61C-A908FF6C891E}.Release|x64.Build.0 = Release|x64 + {3567AACE-3EDA-42C0-B61C-A908FF6C891E}.Release|x86.ActiveCfg = Release|Win32 + {3567AACE-3EDA-42C0-B61C-A908FF6C891E}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {32724F5C-F67E-422C-956B-966958B15D8C} + EndGlobalSection +EndGlobal diff --git a/hxh_d2s/Calculator/Calculator/Calculator.h b/hxh_d2s/Calculator/Calculator/Calculator.h new file mode 100644 index 00000000..c07d1cc9 --- /dev/null +++ b/hxh_d2s/Calculator/Calculator/Calculator.h @@ -0,0 +1,18 @@ +//#include "stdafx.h" +#include +#include +#include +#include "stdlib.h" +#include +#include +using namespace std; + +class Calculator +{ +private: + string op[4] = { "+", "-", "*", "/" }; +public: + Calculator(); + string MakeFormula(); + string Solve(string formula); +}; diff --git a/hxh_d2s/Calculator/Calculator/Calculator.vcxproj b/hxh_d2s/Calculator/Calculator/Calculator.vcxproj new file mode 100644 index 00000000..c94180fc --- /dev/null +++ b/hxh_d2s/Calculator/Calculator/Calculator.vcxproj @@ -0,0 +1,169 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {4AB650C7-074A-42C3-939D-0A4F9B0FBB7F} + Win32Proj + Calculator + 10.0.17763.0 + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Use + Level3 + Disabled + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + + + + + Use + Level3 + Disabled + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + + + + + Use + Level3 + MaxSpeed + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + true + true + + + + + Use + Level3 + MaxSpeed + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + pch.h + + + Console + true + true + true + + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/hxh_d2s/Calculator/Calculator/Calculator.vcxproj.filters b/hxh_d2s/Calculator/Calculator/Calculator.vcxproj.filters new file mode 100644 index 00000000..47ac2c80 --- /dev/null +++ b/hxh_d2s/Calculator/Calculator/Calculator.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 头文件 + + + 头文件 + + + + + 源文件 + + + 源文件 + + + \ No newline at end of file diff --git a/hxh_d2s/Calculator/Calculator/Calculator.vcxproj.user b/hxh_d2s/Calculator/Calculator/Calculator.vcxproj.user new file mode 100644 index 00000000..be250787 --- /dev/null +++ b/hxh_d2s/Calculator/Calculator/Calculator.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/hxh_d2s/Calculator/Calculator/CalculatorConsole.cpp b/hxh_d2s/Calculator/Calculator/CalculatorConsole.cpp new file mode 100644 index 00000000..2910703c --- /dev/null +++ b/hxh_d2s/Calculator/Calculator/CalculatorConsole.cpp @@ -0,0 +1,122 @@ +#include "pch.h" +#include +#include +#include +#include "stdlib.h" +#include +#include +#include "Calculator.h" +#include + +#define random(a,b) (rand()%(b-a+1)+a) + +using namespace std; + +Calculator::Calculator() {} + +string Calculator::MakeFormula() { + string formula = ""; + int count = random(1, 3); + int start = 0; + int number1 = random(1, 100); + formula += to_string(number1); + while (start <= count) { + int operation = random(0, 3); + int number2 = random(1, 100); + formula += op[operation] + to_string(number2); + start++; + } + return formula; +}; + +string Calculator::Solve(string formula) { + vector* tempStack = new vector(); + stack* operatorStack = new stack(); + int len = formula.length(); + int k = 0; + for (int j = -1; j < len - 1; j++) { + char formulaChar = formula[j + 1]; + if (j == len - 2 || formulaChar == '+' || formulaChar == '-' || + formulaChar == '*' || formulaChar == '/') { + if (j == len - 2) { + tempStack->push_back(formula.substr(k)); + } + else { + if (k < j) { + tempStack->push_back(formula.substr(k, j + 1)); + } + if (operatorStack->empty()) { + operatorStack->push(formulaChar); + } + else { + char stackChar = operatorStack->top(); + if ((stackChar == '+' || stackChar == '-') + && (formulaChar == '*' || formulaChar == '/')) { + operatorStack->push(formulaChar); + } + else { + tempStack->push_back(to_string(operatorStack->top())); + operatorStack->pop(); + operatorStack->push(formulaChar); + } + } + } + k = j + 2; + } + } + while (!operatorStack->empty()) { + tempStack->push_back(string(1, operatorStack->top())); + operatorStack->pop(); + } + stack* calcStack = new stack(); + for (int i = 0; i < tempStack->size(); i++) { + string peekChar = tempStack->at(i); + if (peekChar != "+" && peekChar != "-" + && peekChar != "/" && peekChar != "*") { + calcStack->push(peekChar); + } + else { + int a1 = 0; + int b1 = 0; + if (!calcStack->empty()) { + b1 = stoi(calcStack->top()); + calcStack->pop(); + } + if (!calcStack->empty()) { + a1 = stoi(calcStack->top()); + calcStack->pop(); + } + if (peekChar == "+") { + calcStack->push(to_string(a1 + b1)); + } + else if (peekChar == "-") { + calcStack->push(to_string(a1 - b1)); + } + else if (peekChar == "*") { + calcStack->push(to_string(a1 * b1)); + } + else if (peekChar == "/") { + calcStack->push(to_string(a1 / b1)); + } + } + } + return formula + "=" + calcStack->top(); +} + +int main() +{ + srand((unsigned int)time(NULL)); + ofstream mycout("subject.txt"); + int i, num; + Calculator* calc = new Calculator(); + cin >> num; + for (i = 0; i < num; i++) { + string question = calc->MakeFormula(); + cout << question << endl; + string ret = calc->Solve(question); + mycout << ret << endl; + } + getchar(); +} + + diff --git a/hxh_d2s/Calculator/Calculator/Debug/Calculator.Build.CppClean.log b/hxh_d2s/Calculator/Calculator/Debug/Calculator.Build.CppClean.log new file mode 100644 index 00000000..cfd5f96d --- /dev/null +++ b/hxh_d2s/Calculator/Calculator/Debug/Calculator.Build.CppClean.log @@ -0,0 +1,3 @@ +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculator\debug\vc141.idb +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculator\debug\vc141.pdb +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculator\debug\calculator.tlog\cl.command.1.tlog diff --git a/hxh_d2s/Calculator/Calculator/Debug/Calculator.log b/hxh_d2s/Calculator/Calculator/Debug/Calculator.log new file mode 100644 index 00000000..8d664556 --- /dev/null +++ b/hxh_d2s/Calculator/Calculator/Debug/Calculator.log @@ -0,0 +1,3 @@ + CalculatorConsole.cpp +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculator\calculatorconsole.cpp(72): warning C4018: “<”: 有符号/无符号不匹配 + Calculator.vcxproj -> D:\study\软件工程\git\Calculator\hxh_d2s\Calculator\Debug\Calculator.exe diff --git a/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/CL.command.1.tlog b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/CL.command.1.tlog new file mode 100644 index 00000000..50e62e5b Binary files /dev/null and b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/CL.command.1.tlog differ diff --git a/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/CL.read.1.tlog b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/CL.read.1.tlog new file mode 100644 index 00000000..8e8b0f4c Binary files /dev/null and b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/CL.read.1.tlog differ diff --git a/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/CL.write.1.tlog b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/CL.write.1.tlog new file mode 100644 index 00000000..e05c18aa Binary files /dev/null and b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/CL.write.1.tlog differ diff --git a/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/Calculator.lastbuildstate b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/Calculator.lastbuildstate new file mode 100644 index 00000000..6e432bf5 --- /dev/null +++ b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/Calculator.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0 +Debug|Win32|D:\study\软件工程\git\Calculator\hxh_d2s\Calculator\| diff --git a/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/link.command.1.tlog b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/link.command.1.tlog new file mode 100644 index 00000000..d979419e Binary files /dev/null and b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/link.command.1.tlog differ diff --git a/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/link.read.1.tlog b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/link.read.1.tlog new file mode 100644 index 00000000..f5c94b37 Binary files /dev/null and b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/link.read.1.tlog differ diff --git a/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/link.write.1.tlog b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/link.write.1.tlog new file mode 100644 index 00000000..83fae7a0 Binary files /dev/null and b/hxh_d2s/Calculator/Calculator/Debug/Calculator.tlog/link.write.1.tlog differ diff --git a/hxh_d2s/Calculator/Calculator/Debug/vc141.idb b/hxh_d2s/Calculator/Calculator/Debug/vc141.idb new file mode 100644 index 00000000..36c3731f Binary files /dev/null and b/hxh_d2s/Calculator/Calculator/Debug/vc141.idb differ diff --git a/hxh_d2s/Calculator/Calculator/Debug/vc141.pdb b/hxh_d2s/Calculator/Calculator/Debug/vc141.pdb new file mode 100644 index 00000000..d32da841 Binary files /dev/null and b/hxh_d2s/Calculator/Calculator/Debug/vc141.pdb differ diff --git a/hxh_d2s/Calculator/Calculator/pch.cpp b/hxh_d2s/Calculator/Calculator/pch.cpp new file mode 100644 index 00000000..8eb50d04 --- /dev/null +++ b/hxh_d2s/Calculator/Calculator/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: 与预编译标头对应的源文件;编译成功所必需的 + +#include "pch.h" + +// 一般情况下,忽略此文件,但如果你使用的是预编译标头,请保留它。 diff --git a/hxh_d2s/Calculator/Calculator/pch.h b/hxh_d2s/Calculator/Calculator/pch.h new file mode 100644 index 00000000..7c6c88c0 --- /dev/null +++ b/hxh_d2s/Calculator/Calculator/pch.h @@ -0,0 +1 @@ +#pragma once \ No newline at end of file diff --git a/hxh_d2s/Calculator/Calculator/subject.txt b/hxh_d2s/Calculator/Calculator/subject.txt new file mode 100644 index 00000000..dda69d0a --- /dev/null +++ b/hxh_d2s/Calculator/Calculator/subject.txt @@ -0,0 +1,4 @@ +96-66+92=137 +83+40+3=46 +69-5*40+27=-29 +26/43-79+2-22=21 diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/CalculatorUnitTest.vcxproj b/hxh_d2s/Calculator/CalculatorUnitTest/CalculatorUnitTest.vcxproj new file mode 100644 index 00000000..3d5d7ec3 --- /dev/null +++ b/hxh_d2s/Calculator/CalculatorUnitTest/CalculatorUnitTest.vcxproj @@ -0,0 +1,176 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {3567AACE-3EDA-42C0-B61C-A908FF6C891E} + Win32Proj + CalculatorUnitTest + 10.0.17763.0 + NativeUnitTestProject + + + + DynamicLibrary + true + v141 + Unicode + false + + + DynamicLibrary + false + v141 + true + Unicode + false + + + DynamicLibrary + true + v141 + Unicode + false + + + DynamicLibrary + false + v141 + true + Unicode + false + + + + + + + + + + + + + + + + + + + + + true + + + true + + + true + + + true + + + + Use + Level3 + Disabled + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;%(PreprocessorDefinitions) + true + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + ..\Calculator\Debug\Calculator.obj;..\Calculator\Debug\pch.obj;%(AdditionalDependencies) + + + + + Use + Level3 + Disabled + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + _DEBUG;%(PreprocessorDefinitions) + true + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Level3 + Use + MaxSpeed + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;%(PreprocessorDefinitions) + true + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Level3 + Use + MaxSpeed + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions) + true + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + + + + + Create + Create + Create + Create + + + + + + {4ab650c7-074a-42c3-939d-0a4f9b0fbb7f} + + + + + + \ No newline at end of file diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/CalculatorUnitTest.vcxproj.filters b/hxh_d2s/Calculator/CalculatorUnitTest/CalculatorUnitTest.vcxproj.filters new file mode 100644 index 00000000..a3bc7845 --- /dev/null +++ b/hxh_d2s/Calculator/CalculatorUnitTest/CalculatorUnitTest.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 头文件 + + + 头文件 + + + + + 源文件 + + + 源文件 + + + \ No newline at end of file diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/CalculatorUnitTest.vcxproj.user b/hxh_d2s/Calculator/CalculatorUnitTest/CalculatorUnitTest.vcxproj.user new file mode 100644 index 00000000..be250787 --- /dev/null +++ b/hxh_d2s/Calculator/CalculatorUnitTest/CalculatorUnitTest.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CL.command.1.tlog b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CL.command.1.tlog new file mode 100644 index 00000000..fc01457a Binary files /dev/null and b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CL.command.1.tlog differ diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CL.read.1.tlog b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CL.read.1.tlog new file mode 100644 index 00000000..117b0b2b Binary files /dev/null and b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CL.read.1.tlog differ diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CL.write.1.tlog b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CL.write.1.tlog new file mode 100644 index 00000000..568f6385 Binary files /dev/null and b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CL.write.1.tlog differ diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CalculatorUnitTest.lastbuildstate b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CalculatorUnitTest.lastbuildstate new file mode 100644 index 00000000..6e432bf5 --- /dev/null +++ b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/CalculatorUnitTest.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v141:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0.17763.0 +Debug|Win32|D:\study\软件工程\git\Calculator\hxh_d2s\Calculator\| diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/unsuccessfulbuild b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/Calculat.3567AACE.tlog/unsuccessfulbuild new file mode 100644 index 00000000..e69de29b diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/Debug/CalculatorUnitTest.log b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/CalculatorUnitTest.log new file mode 100644 index 00000000..562f5d9b --- /dev/null +++ b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/CalculatorUnitTest.log @@ -0,0 +1,10 @@ + unittest1.cpp +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculatorunittest\unittest1.cpp(15): error C2065: “Calculator”: 未声明的标识符 +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculatorunittest\unittest1.cpp(15): error C2065: “calc”: 未声明的标识符 +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculatorunittest\unittest1.cpp(15): error C2061: 语法错误: 标识符“Calculator” +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculatorunittest\unittest1.cpp(16): error C2065: “string”: 未声明的标识符 +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculatorunittest\unittest1.cpp(17): error C2065: “ret”: 未声明的标识符 +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculatorunittest\unittest1.cpp(17): error C2065: “string”: 未声明的标识符 +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculatorunittest\unittest1.cpp(17): error C2143: 语法错误: 缺少“)”(在“字符串”的前面) +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculatorunittest\unittest1.cpp(17): error C2143: 语法错误: 缺少“;”(在“字符串”的前面) +d:\study\软件工程\git\calculator\hxh_d2s\calculator\calculatorunittest\unittest1.cpp(17): error C2059: 语法错误:“)” diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/Debug/vc141.idb b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/vc141.idb new file mode 100644 index 00000000..c33e12fb Binary files /dev/null and b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/vc141.idb differ diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/Debug/vc141.pdb b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/vc141.pdb new file mode 100644 index 00000000..5733117b Binary files /dev/null and b/hxh_d2s/Calculator/CalculatorUnitTest/Debug/vc141.pdb differ diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/stdafx.cpp b/hxh_d2s/Calculator/CalculatorUnitTest/stdafx.cpp new file mode 100644 index 00000000..a0031370 --- /dev/null +++ b/hxh_d2s/Calculator/CalculatorUnitTest/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : ֻ׼ļԴļ +// CalculatorUnitTest.pch ΪԤͷ +// stdafx.obj ԤϢ + +#include "stdafx.h" + +// TODO: STDAFX.H κĸͷļ +//ڴļ diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/stdafx.h b/hxh_d2s/Calculator/CalculatorUnitTest/stdafx.h new file mode 100644 index 00000000..3a1e49d2 --- /dev/null +++ b/hxh_d2s/Calculator/CalculatorUnitTest/stdafx.h @@ -0,0 +1,13 @@ +// stdafx.h : ׼ϵͳļİļ +// Ǿʹõĵ +// ضĿİļ +// + +#pragma once + +#include "targetver.h" + +// CppUnitTest ͷļ +#include "CppUnitTest.h" + +// TODO: ڴ˴óҪͷļ diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/targetver.h b/hxh_d2s/Calculator/CalculatorUnitTest/targetver.h new file mode 100644 index 00000000..416cebf8 --- /dev/null +++ b/hxh_d2s/Calculator/CalculatorUnitTest/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// SDKDDKVer.h õ߰汾 Windows ƽ̨ + +// ҪΪǰ Windows ƽ̨Ӧó WinSDKVer.h +// _WIN32_WINNT ΪҪֵ֧ƽ̨Ȼٰ SDKDDKVer.h + +#include diff --git a/hxh_d2s/Calculator/CalculatorUnitTest/unittest1.cpp b/hxh_d2s/Calculator/CalculatorUnitTest/unittest1.cpp new file mode 100644 index 00000000..bb8dfc4b --- /dev/null +++ b/hxh_d2s/Calculator/CalculatorUnitTest/unittest1.cpp @@ -0,0 +1,21 @@ +#include "../Calculator/Calculator.h" +#include "stdafx.h" +#include "CppUnitTest.h" + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +namespace CalculatorUnitTest +{ + TEST_CLASS(UnitTest1) + { + public: + + TEST_METHOD(TestMethod1) + { + Calculator* calc = new Calculator(); + string ret = calc->Solve("11+22"); + Assert::AreEqual(ret, (string)"11+22=33"); + } + + }; +} diff --git a/hxh_d2s/Calculator/Debug/Calculator.ilk b/hxh_d2s/Calculator/Debug/Calculator.ilk new file mode 100644 index 00000000..b9ad2ab7 Binary files /dev/null and b/hxh_d2s/Calculator/Debug/Calculator.ilk differ diff --git a/hxh_d2s/Calculator/Debug/Calculator.pdb b/hxh_d2s/Calculator/Debug/Calculator.pdb new file mode 100644 index 00000000..835f466f Binary files /dev/null and b/hxh_d2s/Calculator/Debug/Calculator.pdb differ