unitTest.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. Describe(strange_pair_tests)
  2. {
  3. It(should_work_for_these_pairs)
  4. {
  5. Assert::That(isStrangePair("ratio", "orator"), Equals(true));
  6. Assert::That(isStrangePair("sparkling", "groups"), Equals(true));
  7. Assert::That(isStrangePair("mentee", "eminem"), Equals(true));
  8. Assert::That(isStrangePair("yahtzee", "easy"), Equals(true));
  9. }
  10. It(should_not_work_for_these_pairs)
  11. {
  12. Assert::That(isStrangePair("bush", "hubris"), Equals(false));
  13. Assert::That(isStrangePair("false", "true"), Equals(false));
  14. Assert::That(isStrangePair("cupid", "dionysus"), Equals(false));
  15. Assert::That(isStrangePair("futile", "elephant"), Equals(false));
  16. }
  17. It(should_should_work_with_empty_strings)
  18. {
  19. Assert::That(isStrangePair("", ""), Equals(true));
  20. Assert::That(isStrangePair("", "abc"), Equals(false));
  21. }
  22. It(should_should_work_on_one_character_only)
  23. {
  24. Assert::That(isStrangePair("a", "a"), Equals(true));
  25. Assert::That(isStrangePair("a", "b"), Equals(false));
  26. }
  27. It(should_work_on_non_alphabetic_chars)
  28. {
  29. Assert::That(isStrangePair("&", "&"), Equals(true));
  30. Assert::That(isStrangePair("&!", "!&"), Equals(true));
  31. Assert::That(isStrangePair("5556", "65"), Equals(true));
  32. }
  33. };