|
1 |
| -local is_isogram = require 'isogram' |
| 1 | +local is_isogram = require('isogram') |
2 | 2 |
|
3 | 3 | describe('isogram', function()
|
4 |
| - it('should identify simple isograms', function() |
5 |
| - assert.is_true(is_isogram('duplicates')) |
6 |
| - assert.is_true(is_isogram('subdermatoglyphic')) |
| 4 | + it('empty string', function() |
| 5 | + assert.is_true(is_isogram('')) |
| 6 | + end) |
| 7 | + |
| 8 | + it('isogram with only lower case characters', function() |
| 9 | + assert.is_true(is_isogram('isogram')) |
7 | 10 | end)
|
8 | 11 |
|
9 |
| - it('should identify words with repeated letters as non-isograms', function() |
| 12 | + it('word with one duplicated character', function() |
10 | 13 | assert.is_false(is_isogram('eleven'))
|
11 | 14 | end)
|
12 | 15 |
|
13 |
| - it('should be case insensitive', function() |
| 16 | + it('word with one duplicated character from the end of the alphabet', function() |
| 17 | + assert.is_false(is_isogram('zzyzx')) |
| 18 | + end) |
| 19 | + |
| 20 | + it('longest reported english isogram', function() |
| 21 | + assert.is_true(is_isogram('subdermatoglyphic')) |
| 22 | + end) |
| 23 | + |
| 24 | + it('word with duplicated character in mixed case', function() |
14 | 25 | assert.is_false(is_isogram('Alphabet'))
|
15 | 26 | end)
|
16 | 27 |
|
17 |
| - it('should allow punctuations in isograms', function() |
| 28 | + it('word with duplicated character in mixed case, lowercase first', function() |
| 29 | + assert.is_false(is_isogram('alphAbet')) |
| 30 | + end) |
| 31 | + |
| 32 | + it('hypothetical isogrammic word with hyphen', function() |
18 | 33 | assert.is_true(is_isogram('thumbscrew-japingly'))
|
19 | 34 | end)
|
20 | 35 |
|
21 |
| - it('should allow repeated punctuation in isograms', function() |
22 |
| - assert.is_true(is_isogram('Hjelmqvist-Gryb-Zock-Pfund-Wax')) |
| 36 | + it('hypothetical word with duplicated character following hyphen', function() |
| 37 | + assert.is_false(is_isogram('thumbscrew-jappingly')) |
23 | 38 | end)
|
24 | 39 |
|
25 |
| - it('should identify non-isogram sentences', function() |
26 |
| - assert.is_false(is_isogram('the quick brown fox')) |
| 40 | + it('isogram with duplicated hyphen', function() |
| 41 | + assert.is_true(is_isogram('six-year-old')) |
27 | 42 | end)
|
28 | 43 |
|
29 |
| - it('should identify isogram sentences', function() |
| 44 | + it('made-up name that is an isogram', function() |
30 | 45 | assert.is_true(is_isogram('Emily Jung Schwartzkopf'))
|
31 | 46 | end)
|
| 47 | + |
| 48 | + it('duplicated character in the middle', function() |
| 49 | + assert.is_false(is_isogram('accentor')) |
| 50 | + end) |
| 51 | + |
| 52 | + it('same first and last characters', function() |
| 53 | + assert.is_false(is_isogram('angola')) |
| 54 | + end) |
| 55 | + |
| 56 | + it('word with duplicated character and with two hyphens', function() |
| 57 | + assert.is_false(is_isogram('up-to-date')) |
| 58 | + end) |
32 | 59 | end)
|
0 commit comments