Skip to content

Commit

Permalink
rotational-cipher: Add test data version
Browse files Browse the repository at this point in the history
  • Loading branch information
behrtam committed Apr 5, 2017
1 parent f8c3077 commit 2cf4d43
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions exercises/rotational-cipher/rotational_cipher_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import rotational_cipher


# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0

class RotationalCipher(unittest.TestCase):
def test_rotate_a_by_1(self):
self.assertEqual(rotational_cipher.rotate('a', 1), 'b')
Expand All @@ -23,29 +25,22 @@ def test_rotate_capital_letters(self):
self.assertEqual(rotational_cipher.rotate('OMG', 5), 'TRL')

def test_rotate_spaces(self):
self.assertEqual(rotational_cipher.rotate('O M G', 5),
'T R L')
self.assertEqual(rotational_cipher.rotate('O M G', 5), 'T R L')

def test_rotate_numbers(self):
self.assertEqual(
rotational_cipher.rotate(
'Testing 1 2 3 testing',
4),
rotational_cipher.rotate('Testing 1 2 3 testing', 4),
'Xiwxmrk 1 2 3 xiwxmrk')

def test_rotate_punctuation(self):
self.assertEqual(
rotational_cipher.rotate(
"Let's eat, Grandma!",
21),
rotational_cipher.rotate("Let's eat, Grandma!", 21),
"Gzo'n zvo, Bmviyhv!")

def test_rotate_all_letters(self):
self.assertEqual(
rotational_cipher.rotate(
"The quick brown fox jumps"
" over the lazy dog.",
13),
rotational_cipher.rotate("The quick brown fox jumps"
" over the lazy dog.", 13),
"Gur dhvpx oebja sbk whzcf bire gur ynml qbt.")


Expand Down

0 comments on commit 2cf4d43

Please sign in to comment.