|
| 1 | +RotationalCipher = require 'rotational_cipher' |
| 2 | + |
| 3 | +describe 'rotational-cipher', -> |
| 4 | + it 'rotate a by 0, same output as input', -> |
| 5 | + result = RotationalCipher.rotate 'a', 0 |
| 6 | + expected = 'a' |
| 7 | + assert.are.equal expected, result |
| 8 | + |
| 9 | + pending 'rotate a by 1', -> |
| 10 | + result = RotationalCipher.rotate 'a', 1 |
| 11 | + expected = 'b' |
| 12 | + assert.are.equal expected, result |
| 13 | + |
| 14 | + pending 'rotate a by 26, same output as input', -> |
| 15 | + result = RotationalCipher.rotate 'a', 26 |
| 16 | + expected = 'a' |
| 17 | + assert.are.equal expected, result |
| 18 | + |
| 19 | + pending 'rotate m by 13', -> |
| 20 | + result = RotationalCipher.rotate 'm', 13 |
| 21 | + expected = 'z' |
| 22 | + assert.are.equal expected, result |
| 23 | + |
| 24 | + pending 'rotate n by 13 with wrap around alphabet', -> |
| 25 | + result = RotationalCipher.rotate 'n', 13 |
| 26 | + expected = 'a' |
| 27 | + assert.are.equal expected, result |
| 28 | + |
| 29 | + pending 'rotate capital letters', -> |
| 30 | + result = RotationalCipher.rotate 'OMG', 5 |
| 31 | + expected = 'TRL' |
| 32 | + assert.are.equal expected, result |
| 33 | + |
| 34 | + pending 'rotate spaces', -> |
| 35 | + result = RotationalCipher.rotate 'O M G', 5 |
| 36 | + expected = 'T R L' |
| 37 | + assert.are.equal expected, result |
| 38 | + |
| 39 | + pending 'rotate numbers', -> |
| 40 | + result = RotationalCipher.rotate 'Testing 1 2 3 testing', 4 |
| 41 | + expected = 'Xiwxmrk 1 2 3 xiwxmrk' |
| 42 | + assert.are.equal expected, result |
| 43 | + |
| 44 | + pending 'rotate punctuation', -> |
| 45 | + result = RotationalCipher.rotate "Let's eat, Grandma!", 21 |
| 46 | + expected = "Gzo'n zvo, Bmviyhv!" |
| 47 | + assert.are.equal expected, result |
| 48 | + |
| 49 | + pending 'rotate all letters', -> |
| 50 | + result = RotationalCipher.rotate 'The quick brown fox jumps over the lazy dog.', 13 |
| 51 | + expected = 'Gur dhvpx oebja sbk whzcf bire gur ynml qbt.' |
| 52 | + assert.are.equal expected, result |
0 commit comments