The test cases use your encode and decode functions. e.g. since a shift by 26 should have no effect, Test.assertEquals(cc.encode(s), s) should work.
What I suspect is that you are using character codes in your implementation? I assume this because the character code for @ is 64, and the character code for M is 77, which is 64+13, so it looks like when shifting backwards, that's what you're getting.
The test cases use your
encode
anddecode
functions. e.g. since a shift by 26 should have no effect,Test.assertEquals(cc.encode(s), s)
should work.What I suspect is that you are using character codes in your implementation? I assume this because the character code for
@
is 64, and the character code forM
is 77, which is 64+13, so it looks like when shifting backwards, that's what you're getting.