From 0e8f620f15592f66e733cc60dbaa722b183b0abf Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Thu, 19 Sep 2019 22:40:43 -0400 Subject: Remove dead code, fix package, add long test --- caesar.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'caesar.go') diff --git a/caesar.go b/caesar.go index 4829e6a..9e36d76 100644 --- a/caesar.go +++ b/caesar.go @@ -34,6 +34,9 @@ func (rr RuneRange) size() int { // shift shifts r by d within the range, modulo the size of the range. func (rr RuneRange) shift(r rune, d int) rune { pos := int(r - rr.Start) + for d < 0 { + d = rr.size() + d + } newPos := (pos + d) % rr.size() return rr.Start + rune(newPos) } -- cgit v1.2.3