def setOffSet(self, setting): self.offset = Alphabet.index(setting)
def mapOut(self, input): inputIndex = Alphabet.index(input) outputIndex = (inputIndex - self.offset) % Alphabet.length() return Alphabet[outputIndex]
def setRingSetting(self, setting): self.setting = Alphabet.index(setting)
def mapIn(self, input): inputIndex = Alphabet.index(input) outputIndex = (inputIndex - self.setting) % Alphabet.length() return Alphabet[outputIndex]
def test_turnover_detection(given, expected): noopRotor = RotorFactory.Rotor("NoOp") noopRotor.turnover = Alphabet.index("C") noopRotor.rotorStack.setOffSet(given) assert expected == noopRotor.isInTurnoverPosition()