Yes, you probably do want to write separate cases, because your opinion is generally correct and is precisely the type of situation proper testing is meant to avoid:
In my opinion I should, to ensure that in future someone does not
cause a change in convertWrapper, resulting in regression.
Your unit tests should test the high-level functionality of your code. Your unit tests are unaware of implementation details, they only test that the terms of the "contract" are met. Since you have two public methods that, on a high level, do two separate things (we presume - your requirements weren't stated or documented), then you have two separate tests.
Eliminating one of the tests because you, as the developer, implicitly know that the implementations are the same suddenly brings information about implementation details into the testing realm, which is asking for problems and regressions in the future.
One option that Dave Newton pointed out in his answer is to write a unit test that essentially ensures that convertWrapper(ch) == getFoo((int)ch)
for all relevant ch
. That is a fine suggestion and may very well be appropriate, but only if the high level requirement of convertWrapper
is that it "returns the same value as getFoo
". Again, your tests should reflect your requirements.
Of course, that doesn't mean it's somehow against the law to eliminate the test. The devil won't necessarily lay claim to your soul if you do it (although sometimes I wish that was the usual consequence). If your application is rather simple, or if you are willing to accept the associated risks, then even a simple "@todo Test me" documentation marker may be enough to get by. It is sometimes OK to take shortcuts now and then but only if you truly understand and accept the implications -- only you can save you from yourself. :)
But, in the general case, yes, two tests. Then you can "fire-and-forget" your tests, and never have to remember that special exception to the rules you made in the future.