Skip to content

Commit 887aa7f

Browse files
committed
Sync simple-cipher to version 2.0.0
Following exercism/problem-specifications#1346 and exercism/problem-specifications#1462
1 parent 573e820 commit 887aa7f

File tree

2 files changed

+14
-38
lines changed

2 files changed

+14
-38
lines changed

exercises/simple-cipher/README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ for A, and so with the others."
1313

1414
Ciphers are very straight-forward algorithms that allow us to render
1515
text less readable while still allowing easy deciphering. They are
16-
vulnerable to many forms of cryptoanalysis, but we are lucky that
17-
generally our little sisters are not cryptoanalysts.
16+
vulnerable to many forms of cryptanalysis, but we are lucky that
17+
generally our little sisters are not cryptanalysts.
1818

1919
The Caesar Cipher was used for some messages from Julius Caesar that
2020
were sent afield. Now Caesar knew that the cipher wasn't very good, but
@@ -61,10 +61,7 @@ substitution cipher a little more fault tolerant by providing a source
6161
of randomness and ensuring that the key contains only lowercase letters.
6262

6363
If someone doesn't submit a key at all, generate a truly random key of
64-
at least 100 characters in length.
65-
66-
If the key submitted is not composed only of lowercase letters, your
67-
solution should handle the error in a language-appropriate way.
64+
at least 100 alphanumeric characters in length.
6865

6966
## Extensions
7067

@@ -83,10 +80,10 @@ on Wikipedia][dh] for one of the first implementations of this scheme.
8380

8481
## Setup
8582

86-
Go through the setup instructions for TypeScript to
87-
install the necessary dependencies:
83+
Go through the setup instructions for TypeScript to install the necessary
84+
dependencies:
8885

89-
http://exercism.io/languages/typescript
86+
[https://exercism.io/tracks/typescript/installation](https://exercism.io/tracks/typescript/installation)
9087

9188
## Requirements
9289

@@ -104,11 +101,16 @@ Execute the tests with:
104101
$ yarn test
105102
```
106103

104+
In the test suites all tests but the first have been skipped.
107105

106+
Once you get a test passing, you can enable the next one by changing `xit` to
107+
`it`.
108108

109109
## Source
110110

111111
Substitution Cipher at Wikipedia [http://en.wikipedia.org/wiki/Substitution_cipher](http://en.wikipedia.org/wiki/Substitution_cipher)
112112

113113
## Submitting Incomplete Solutions
114-
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
114+
115+
It's possible to submit an incomplete solution so you can see how others have
116+
completed the exercise.

exercises/simple-cipher/simple-cipher.test.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,6 @@ describe('Random key cipher', () => {
3838
})
3939
})
4040

41-
describe('Incorrect key cipher', () => {
42-
xit('throws an error with an all caps key', () => {
43-
expect(() => {
44-
new SimpleCipher('ABCDEF')
45-
}).toThrowError('Bad key')
46-
})
47-
48-
xit('throws an error with a mixed case key', () => {
49-
expect(() => {
50-
new SimpleCipher('AbcdEF')
51-
}).toThrowError('Bad key')
52-
})
53-
54-
xit('throws an error with a numeric key', () => {
55-
expect(() => {
56-
new SimpleCipher('12345')
57-
}).toThrow('Bad key')
58-
})
59-
60-
xit('throws an error with an empty key', () => {
61-
expect(() => {
62-
new SimpleCipher('')
63-
}).toThrow('Bad key')
64-
})
65-
})
66-
6741
describe('Substitution cipher', () => {
6842
const key = 'abcdefghij'
6943
const simpleCipher = new SimpleCipher(key)
@@ -97,12 +71,12 @@ describe('Substitution cipher', () => {
9771
expect(simpleCipher.decode('zabcdefghi')).toEqual('zzzzzzzzzz')
9872
})
9973

100-
xit('can handle messages longer than the key (encode)', () => {
74+
xit('can encode messages longer than the key"', () => {
10175
expect(new SimpleCipher('abc').encode('iamapandabear'))
10276
.toEqual('iboaqcnecbfcr')
10377
})
10478

105-
xit('can handle messages longer than the key (decode)', () => {
79+
xit('can decode messages longer than the key', () => {
10680
expect(new SimpleCipher('abc').decode('iboaqcnecbfcr'))
10781
.toEqual('iamapandabear')
10882
})

0 commit comments

Comments
 (0)