林永吉的Algorithm库
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

30 строки
788 B

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