unitTest.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. Describe(all_left_rotations)
  2. {
  3. It(T1){Assert::That(leftRotations("abc"), Equals(std::vector<std::string>({
  4. "abc",
  5. "bca",
  6. "cab"
  7. })));}
  8. It(T2){Assert::That(leftRotations("abcdef"), Equals(std::vector<std::string>({
  9. "abcdef",
  10. "bcdefa",
  11. "cdefab",
  12. "defabc",
  13. "efabcd",
  14. "fabcde"
  15. })));}
  16. It(T3){Assert::That(leftRotations("himalaya"), Equals(std::vector<std::string>({
  17. "himalaya",
  18. "imalayah",
  19. "malayahi",
  20. "alayahim",
  21. "layahima",
  22. "ayahimal",
  23. "yahimala",
  24. "ahimalay"
  25. })));}
  26. It(T4){Assert::That(leftRotations("aab"), Equals(std::vector<std::string>({
  27. "aab",
  28. "aba",
  29. "baa"
  30. })));}
  31. };
  32. Describe(all_right_rotations)
  33. {
  34. It(T1){Assert::That(rightRotations("abc"), Equals(std::vector<std::string>({
  35. "abc",
  36. "cab",
  37. "bca"
  38. })));}
  39. It(T2){Assert::That(rightRotations("abcdef"), Equals(std::vector<std::string>({
  40. "abcdef",
  41. "fabcde",
  42. "efabcd",
  43. "defabc",
  44. "cdefab",
  45. "bcdefa"
  46. })));}
  47. It(T3){Assert::That(rightRotations("himalaya"), Equals(std::vector<std::string>({
  48. "himalaya",
  49. "ahimalay",
  50. "yahimala",
  51. "ayahimal",
  52. "layahima",
  53. "alayahim",
  54. "malayahi",
  55. "imalayah"
  56. })));}
  57. It(T4){Assert::That(rightRotations("aab"), Equals(std::vector<std::string>({
  58. "aab",
  59. "baa",
  60. "aba"
  61. })));}
  62. };