|
| 1 | +AtbashCipher = require 'atbash_cipher' |
| 2 | + |
| 3 | +describe 'atbash-cipher', -> |
| 4 | + describe 'encode', -> |
| 5 | + it 'encode yes', -> |
| 6 | + result = AtbashCipher.encode 'yes' |
| 7 | + expected = 'bvh' |
| 8 | + assert.are.equal expected, result |
| 9 | + |
| 10 | + pending 'encode no', -> |
| 11 | + result = AtbashCipher.encode 'no' |
| 12 | + expected = 'ml' |
| 13 | + assert.are.equal expected, result |
| 14 | + |
| 15 | + pending 'encode OMG', -> |
| 16 | + result = AtbashCipher.encode 'OMG' |
| 17 | + expected = 'lnt' |
| 18 | + assert.are.equal expected, result |
| 19 | + |
| 20 | + pending 'encode spaces', -> |
| 21 | + result = AtbashCipher.encode 'O M G' |
| 22 | + expected = 'lnt' |
| 23 | + assert.are.equal expected, result |
| 24 | + |
| 25 | + pending 'encode mindblowingly', -> |
| 26 | + result = AtbashCipher.encode 'mindblowingly' |
| 27 | + expected = 'nrmwy oldrm tob' |
| 28 | + assert.are.equal expected, result |
| 29 | + |
| 30 | + pending 'encode numbers', -> |
| 31 | + result = AtbashCipher.encode 'Testing,1 2 3, testing.' |
| 32 | + expected = 'gvhgr mt123 gvhgr mt' |
| 33 | + assert.are.equal expected, result |
| 34 | + |
| 35 | + pending 'encode deep thought', -> |
| 36 | + result = AtbashCipher.encode 'Truth is fiction.' |
| 37 | + expected = 'gifgs rhurx grlm' |
| 38 | + assert.are.equal expected, result |
| 39 | + |
| 40 | + pending 'encode all the letters', -> |
| 41 | + result = AtbashCipher.encode 'The quick brown fox jumps over the lazy dog.' |
| 42 | + expected = 'gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt' |
| 43 | + assert.are.equal expected, result |
| 44 | + |
| 45 | + describe 'decode', -> |
| 46 | + pending 'decode exercism', -> |
| 47 | + result = AtbashCipher.decode 'vcvix rhn' |
| 48 | + expected = 'exercism' |
| 49 | + assert.are.equal expected, result |
| 50 | + |
| 51 | + pending 'decode a sentence', -> |
| 52 | + result = AtbashCipher.decode 'zmlyh gzxov rhlug vmzhg vkkrm thglm v' |
| 53 | + expected = 'anobstacleisoftenasteppingstone' |
| 54 | + assert.are.equal expected, result |
| 55 | + |
| 56 | + pending 'decode numbers', -> |
| 57 | + result = AtbashCipher.decode 'gvhgr mt123 gvhgr mt' |
| 58 | + expected = 'testing123testing' |
| 59 | + assert.are.equal expected, result |
| 60 | + |
| 61 | + pending 'decode all the letters', -> |
| 62 | + result = AtbashCipher.decode 'gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt' |
| 63 | + expected = 'thequickbrownfoxjumpsoverthelazydog' |
| 64 | + assert.are.equal expected, result |
| 65 | + |
| 66 | + pending 'decode with too many spaces', -> |
| 67 | + result = AtbashCipher.decode 'vc vix r hn' |
| 68 | + expected = 'exercism' |
| 69 | + assert.are.equal expected, result |
| 70 | + |
| 71 | + pending 'decode with no spaces', -> |
| 72 | + result = AtbashCipher.decode 'zmlyhgzxovrhlugvmzhgvkkrmthglmv' |
| 73 | + expected = 'anobstacleisoftenasteppingstone' |
| 74 | + assert.are.equal expected, result |
0 commit comments