Skip to content

13_palindromes: Add odd/even-length tests - #661

Merged
mao-sz merged 1 commit into
TheOdinProject:mainfrom
Sundwalltanner:add-even-length-palindrome-test
Jul 28, 2026
Merged

13_palindromes: Add odd/even-length tests#661
mao-sz merged 1 commit into
TheOdinProject:mainfrom
Sundwalltanner:add-even-length-palindrome-test

Conversation

@Sundwalltanner

Copy link
Copy Markdown
Contributor

Because

If a user came up with an improperly implemented two-pointer solution to 13_palindromes, it could still pass all of the previous test cases, due to all of the previous test-cases only using valid odd-length palindromes. I thought it would make sense to clearly define one test as being for a valid even-length palindrome, and another test being for a valid odd-length palindrome, just in case somebody else at some point in the future decides to adjust the strings used in the test cases again, in order to help prevent them from mistakenly making all of the test cases either all odd-length or all even-length.

This PR

  • Modifies existing valid palindrome test to be described as "detects odd-length palindrome". Uses the existing string "racecar".
  • Adds new valid palindrome test, described as "detects even-length palindrome". Uses the string "abba".

Issue

Closes #659

Additional Information

N/A

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this PR follows the location of change: brief description of change format, e.g. 01_helloWorld: Update test cases
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If this PR includes any changes that affect the solution of an exercise, I've also updated the solution in the /solutions folder

@mao-sz
mao-sz merged commit a0160e0 into TheOdinProject:main Jul 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

13_palindromes: add a test case for an even-length palindrome

2 participants