Rotational cipher: negative keys?

Another exercise I’m trying to sync up with problem specifications on the Rust track.

Rust has tests for negative numbers, e.g. rotate("m", -1) == "l".

The problem specification only has positive numbers in the tests.

I could upstream these tests or keep them around as additional, track-specific tests.

But I’m leaning toward removing them. The code students need to write to support negative numbers is easy and uninteresting. Also, I can adjust the signature of the rotate function to only accept unsigned integers.

The instructions state: “integer key between 0 and 26.”, so I see no reason to have these additional tests.

What do you think?

I think removing them makes sense. Not that I’m a Rust maintainer :slight_smile:


I agree with removing them.

Thank you for weighing in :slight_smile:

I opened a PR for the removal.

1 Like