林永吉的四则运算库
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

37 行
935 B

  1. #include "pch.h"
  2. #include "CppUnitTest.h"
  3. #include "../mul/mul.h"
  4. #include <Windows.h>
  5. #include <atlstr.h>
  6. #define FilePath "..//ex1.ini"
  7. using namespace Microsoft::VisualStudio::CppUnitTestFramework;
  8. namespace UnitTest1
  9. {
  10. TEST_CLASS(UnitTest1)
  11. {
  12. public:
  13. int j = 0;
  14. char str[50][10] = { 0 };//保存ini文件里 节的名字
  15. int count = CalcCount(50, str);//保存ini文件里 节的个数
  16. unsigned short i;
  17. TEST_METHOD(TestMethode1)
  18. {
  19. long long nReal;//保存运算结果
  20. CString na, nb, nExpect; //b保存不同的键值
  21. for (j = 0; j < count; j++)
  22. {
  23. GetPrivateProfileString(str[j], "na", " ", na.GetBuffer(20), 20, FilePath);
  24. GetPrivateProfileString(str[j], "nb", " ", nb.GetBuffer(20), 20, FilePath);
  25. GetPrivateProfileString(str[j], "nExpect", " ", nExpect.GetBuffer(20), 20, FilePath);
  26. nReal = mul(_ttoi64(na), _ttoi64(nb)); //_ttoi是CString转为整型
  27. Assert::AreEqual(nReal, _ttoi64(nExpect));
  28. }
  29. }
  30. };
  31. }