这是林永吉的算法题仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.0 KiB

  1. #include "pch.h"
  2. #include "CppUnitTest.h"
  3. using namespace Microsoft::VisualStudio::CppUnitTestFramework;
  4. #define FileName_1 "../code/config/1_ContainsNearbyDuplicate.ini"
  5. namespace test1
  6. {
  7. TEST_CLASS(UnitTest_1)
  8. {
  9. TEST_METHOD(TestMethode1)
  10. {
  11. char Section_Name[100][10] = { 0 };
  12. int Section_Count = CalcCount(100, Section_Name, FileName_1);
  13. int array_count = 0;
  14. int* Section_Value;
  15. CString Na, Nb, nExpect;
  16. for (int i = 0; i < Section_Count; i++) {
  17. GetPrivateProfileString(Section_Name[i], "array", " ", Na.GetBuffer(200), 200, FileName_1);
  18. GetPrivateProfileString(Section_Name[i], "key", " ", Nb.GetBuffer(20), 20, FileName_1);
  19. GetPrivateProfileString(Section_Name[i], "output", " ", nExpect.GetBuffer(20), 20, FileName_1);
  20. Section_Value = str_device(Na, &array_count);
  21. bool nReal = ContainsNearbyDuplicate(Section_Value, array_count, _ttoi(Nb));
  22. Assert::AreEqual(nReal, CstrToBool(nExpect));
  23. }
  24. }
  25. };
  26. }
  27. namespace test2
  28. {
  29. TEST_CLASS(test)
  30. {
  31. public:
  32. TEST_METHOD(TestMethod1)
  33. {
  34. }
  35. };
  36. }