Is there a reason for the char parameter + int casting in these tests?  Is that an important aspect of the test construction or just a happenstance of how the bug was detected?

Are the values here critical?  They don't strike me as boundary condition testing.  A quick explanatory comment would be nice, unless I'm just missing a pattern that should be obvious.

I really wish we had a mechanism of not just testing correct outcome but also correct optimization since this is all specifically there to test an optimization.