|
| 1 | +import encode from require 'crypto_square' |
| 2 | + |
| 3 | +describe 'crypto-square', -> |
| 4 | + it 'empty plaintext results in an empty ciphertext', -> |
| 5 | + result = encode '' |
| 6 | + expected = '' |
| 7 | + assert.are.equal expected, result |
| 8 | + |
| 9 | + pending 'normalization results in empty plaintext', -> |
| 10 | + result = encode '... --- ...' |
| 11 | + expected = '' |
| 12 | + assert.are.equal expected, result |
| 13 | + |
| 14 | + pending 'Lowercase', -> |
| 15 | + result = encode 'A' |
| 16 | + expected = 'a' |
| 17 | + assert.are.equal expected, result |
| 18 | + |
| 19 | + pending 'Remove spaces', -> |
| 20 | + result = encode ' b ' |
| 21 | + expected = 'b' |
| 22 | + assert.are.equal expected, result |
| 23 | + |
| 24 | + pending 'Remove punctuation', -> |
| 25 | + result = encode '@1,%!' |
| 26 | + expected = '1' |
| 27 | + assert.are.equal expected, result |
| 28 | + |
| 29 | + pending '9 character plaintext results in 3 chunks of 3 characters', -> |
| 30 | + result = encode 'This is fun!' |
| 31 | + expected = 'tsf hiu isn' |
| 32 | + assert.are.equal expected, result |
| 33 | + |
| 34 | + pending '8 character plaintext results in 3 chunks, the last one with a trailing space', -> |
| 35 | + result = encode 'Chill out.' |
| 36 | + expected = 'clu hlt io ' |
| 37 | + assert.are.equal expected, result |
| 38 | + |
| 39 | + pending '54 character plaintext results in 8 chunks, the last two with trailing spaces', -> |
| 40 | + result = encode 'If man was meant to stay on the ground, god would have given us roots.' |
| 41 | + expected = 'imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau ' |
| 42 | + assert.are.equal expected, result |
0 commit comments