trackler 2.2.1.87 → 2.2.1.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/bash/.travis.yml +6 -2
- data/tracks/bash/bin/validate-exercises +37 -0
- data/tracks/bash/exercises/reverse-string/example.sh +1 -1
- data/tracks/bash/exercises/reverse-string/reverse_string_test.sh +7 -7
- data/tracks/csharp/exercises/bracket-push/BracketPush.cs +2 -15
- data/tracks/elisp/.travis.yml +2 -2
- data/tracks/elisp/config.json +8 -0
- data/tracks/elisp/exercises/pangram/README.md +16 -0
- data/tracks/elisp/exercises/pangram/example.el +17 -0
- data/tracks/elisp/exercises/pangram/pangram-test.el +41 -0
- data/tracks/elisp/exercises/pangram/pangram.el +9 -0
- data/tracks/gnu-apl/config.json +6 -6
- data/tracks/java/exercises/phone-number/.meta/hints.md +58 -0
- data/tracks/java/exercises/phone-number/README.md +62 -0
- data/tracks/java/exercises/rna-transcription/.meta/version +1 -1
- data/tracks/java/exercises/rna-transcription/src/test/java/RnaTranscriptionTest.java +0 -29
- data/tracks/python/.travis.yml +2 -2
- data/tracks/python/exercises/complex-numbers/.meta/hints.md +3 -0
- data/tracks/python/exercises/complex-numbers/README.md +4 -0
- data/tracks/python/exercises/complex-numbers/complex_numbers.py +5 -5
- data/tracks/python/exercises/complex-numbers/complex_numbers_test.py +28 -32
- data/tracks/python/exercises/complex-numbers/example.py +8 -5
- data/tracks/python/exercises/difference-of-squares/difference_of_squares.py +3 -3
- data/tracks/python/exercises/difference-of-squares/example.py +6 -6
- data/tracks/python/exercises/palindrome-products/example.py +112 -11
- data/tracks/python/exercises/palindrome-products/palindrome_products_test.py +55 -14
- data/tracks/python/exercises/pangram/pangram_test.py +9 -6
- data/tracks/python/exercises/phone-number/phone_number_test.py +2 -2
- data/tracks/python/exercises/secret-handshake/example.py +14 -47
- data/tracks/python/exercises/secret-handshake/secret_handshake.py +2 -2
- data/tracks/python/exercises/secret-handshake/secret_handshake_test.py +56 -25
- data/tracks/python/exercises/transpose/example.py +5 -5
- data/tracks/python/exercises/transpose/transpose_test.py +37 -74
- data/tracks/python/exercises/word-search/example.py +1 -1
- data/tracks/python/exercises/word-search/word_search_test.py +63 -63
- metadata +9 -2
@@ -3,12 +3,16 @@ import unittest
|
|
3
3
|
from pangram import is_pangram
|
4
4
|
|
5
5
|
|
6
|
-
#
|
6
|
+
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.3.0
|
7
7
|
|
8
8
|
class PangramTests(unittest.TestCase):
|
9
|
+
|
9
10
|
def test_sentence_empty(self):
|
10
11
|
self.assertIs(is_pangram(''), False)
|
11
12
|
|
13
|
+
def test_recognizes_a_perfect_lower_case_pangram(self):
|
14
|
+
self.assertIs(is_pangram('abcdefghijklmnopqrstuvwxyz'), True)
|
15
|
+
|
12
16
|
def test_pangram_with_only_lower_case(self):
|
13
17
|
self.assertIs(
|
14
18
|
is_pangram('the quick brown fox jumps over the lazy dog'),
|
@@ -20,10 +24,9 @@ class PangramTests(unittest.TestCase):
|
|
20
24
|
'jeopardize five gunboats'),
|
21
25
|
False)
|
22
26
|
|
23
|
-
def
|
24
|
-
self.assertIs(
|
25
|
-
|
26
|
-
False)
|
27
|
+
def test_another_missing_character(self):
|
28
|
+
self.assertIs(is_pangram('five boxing wizards jump quickly at it'),
|
29
|
+
False)
|
27
30
|
|
28
31
|
def test_pangram_with_underscores(self):
|
29
32
|
self.assertIs(
|
@@ -47,7 +50,7 @@ class PangramTests(unittest.TestCase):
|
|
47
50
|
|
48
51
|
def test_upper_and_lower_case_versions_of_the_same_character(self):
|
49
52
|
self.assertIs(
|
50
|
-
is_pangram('the quick brown fox jumped over the lazy
|
53
|
+
is_pangram('the quick brown fox jumped over the lazy FX'),
|
51
54
|
False)
|
52
55
|
|
53
56
|
|
@@ -46,11 +46,11 @@ class PhoneTest(unittest.TestCase):
|
|
46
46
|
with self.assertRaisesWithMessage(ValueError):
|
47
47
|
Phone("123-@:!-7890")
|
48
48
|
|
49
|
-
def
|
49
|
+
def test_invalid_when_area_code_does_start_with_1(self):
|
50
50
|
with self.assertRaisesWithMessage(ValueError):
|
51
51
|
Phone("(123) 456-7890")
|
52
52
|
|
53
|
-
def
|
53
|
+
def test_invalid_when_exchange_code_does_start_with_1(self):
|
54
54
|
with self.assertRaisesWithMessage(ValueError):
|
55
55
|
Phone("(223) 056-7890")
|
56
56
|
|
@@ -1,50 +1,17 @@
|
|
1
1
|
gestures = ['wink', 'double blink', 'close your eyes', 'jump']
|
2
2
|
|
3
3
|
|
4
|
-
def handshake(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
if not seq or set(seq) - set(gestures):
|
19
|
-
return '0'
|
20
|
-
s = find_subseq(seq)
|
21
|
-
if not s:
|
22
|
-
s = ['1'] + find_subseq(reversed(seq))
|
23
|
-
return "".join(s)
|
24
|
-
|
25
|
-
|
26
|
-
def sanitize(s):
|
27
|
-
if not(isinstance(s, int) or isinstance(s, str)):
|
28
|
-
raise TypeError('Unknown type')
|
29
|
-
if isinstance(s, int):
|
30
|
-
if s < 0:
|
31
|
-
return ""
|
32
|
-
s = bin(s)[2:]
|
33
|
-
elif set(s) - set(['0', '1']):
|
34
|
-
return ""
|
35
|
-
if len(s) > 5:
|
36
|
-
raise ValueError('Binary string too long')
|
37
|
-
return "0" * (len(gestures) - len(s)) + s
|
38
|
-
|
39
|
-
|
40
|
-
def find_subseq(seq):
|
41
|
-
idx = 0
|
42
|
-
s = []
|
43
|
-
for g in seq:
|
44
|
-
if g not in gestures[idx:]:
|
45
|
-
return []
|
46
|
-
newidx = gestures.index(g, idx) + 1
|
47
|
-
s.extend(['0'] * (newidx - idx - 1) + ['1'])
|
48
|
-
idx = newidx
|
49
|
-
s.reverse()
|
50
|
-
return s
|
4
|
+
def handshake(code):
|
5
|
+
actions = [gestures[i] for i in range(len(gestures))
|
6
|
+
if (code >> i) % 2 == 1]
|
7
|
+
return actions if code < 16 else list(reversed(actions))
|
8
|
+
|
9
|
+
|
10
|
+
def secret_code(actions):
|
11
|
+
actions = [a for a in actions if a in gestures]
|
12
|
+
result = sum(1 << i for i, action in enumerate(gestures)
|
13
|
+
if action in actions)
|
14
|
+
if len(actions) > 1 and (gestures.index(actions[0]) >
|
15
|
+
gestures.index(actions[1])):
|
16
|
+
result += 16
|
17
|
+
return result
|
@@ -1,49 +1,80 @@
|
|
1
1
|
import unittest
|
2
2
|
|
3
|
-
from secret_handshake import handshake,
|
3
|
+
from secret_handshake import handshake, secret_code
|
4
4
|
|
5
5
|
|
6
|
+
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0
|
7
|
+
|
6
8
|
class HandshakeTest(unittest.TestCase):
|
7
|
-
def
|
8
|
-
self.assertEqual(handshake(
|
9
|
+
def test_wink_for_1(self):
|
10
|
+
self.assertEqual(handshake(1), ['wink'])
|
11
|
+
|
12
|
+
def test_double_blink_for_10(self):
|
13
|
+
self.assertEqual(handshake(2), ['double blink'])
|
14
|
+
|
15
|
+
def test_close_your_eyes_for_100(self):
|
16
|
+
self.assertEqual(handshake(4), ['close your eyes'])
|
17
|
+
|
18
|
+
def test_jump_for_1000(self):
|
19
|
+
self.assertEqual(handshake(8), ['jump'])
|
20
|
+
|
21
|
+
def test_combine_two_actions(self):
|
22
|
+
self.assertEqual(handshake(3), ['wink', 'double blink'])
|
23
|
+
|
24
|
+
def test_reverse_two_actions(self):
|
25
|
+
self.assertEqual(handshake(19), ['double blink', 'wink'])
|
26
|
+
|
27
|
+
def test_reversing_one_action_gives_the_same_action(self):
|
28
|
+
self.assertEqual(handshake(24), ['jump'])
|
9
29
|
|
10
|
-
def
|
11
|
-
self.assertEqual(
|
12
|
-
handshake('10110'), ['close your eyes', 'double blink'])
|
30
|
+
def test_reversing_no_actions_still_gives_no_actions(self):
|
31
|
+
self.assertEqual(handshake(16), [])
|
13
32
|
|
14
|
-
def
|
15
|
-
self.assertEqual(handshake(
|
33
|
+
def test_all_possible_actions(self):
|
34
|
+
self.assertEqual(handshake(15), ['wink',
|
35
|
+
'double blink',
|
36
|
+
'close your eyes',
|
37
|
+
'jump'])
|
16
38
|
|
17
|
-
def
|
18
|
-
self.assertEqual(handshake(
|
39
|
+
def test_reverse_all_possible_actions(self):
|
40
|
+
self.assertEqual(handshake(31), ['jump',
|
41
|
+
'close your eyes',
|
42
|
+
'double blink',
|
43
|
+
'wink'])
|
19
44
|
|
20
|
-
def
|
21
|
-
self.assertEqual(handshake(
|
45
|
+
def test_do_nothing_for_zero(self):
|
46
|
+
self.assertEqual(handshake(0), [])
|
22
47
|
|
23
|
-
|
24
|
-
self.assertEqual(code(['wink', 'sneeze']), '0')
|
48
|
+
# Track-specific tests
|
25
49
|
|
50
|
+
@unittest.skip('extra-credit')
|
26
51
|
def test_code1(self):
|
27
|
-
self.assertEqual(
|
52
|
+
self.assertEqual(secret_code(['close your eyes', 'jump']), 12)
|
28
53
|
|
54
|
+
@unittest.skip('extra-credit')
|
29
55
|
def test_code2(self):
|
30
|
-
self.assertEqual(
|
56
|
+
self.assertEqual(secret_code(['wink', 'double blink']), 3)
|
31
57
|
|
58
|
+
@unittest.skip('extra-credit')
|
32
59
|
def test_code3(self):
|
33
|
-
self.assertEqual(
|
60
|
+
self.assertEqual(secret_code(['jump', 'double blink']), 26)
|
34
61
|
|
35
|
-
|
36
|
-
|
62
|
+
@unittest.skip('extra-credit')
|
63
|
+
def test_reversible1(self):
|
64
|
+
self.assertEqual(secret_code(handshake(27)), 27)
|
37
65
|
|
38
|
-
|
39
|
-
|
66
|
+
@unittest.skip('extra-credit')
|
67
|
+
def test_reversible2(self):
|
68
|
+
self.assertEqual(secret_code(handshake(1)), 1)
|
40
69
|
|
41
|
-
|
42
|
-
|
70
|
+
@unittest.skip('extra-credit')
|
71
|
+
def test_reversible3(self):
|
72
|
+
self.assertEqual(secret_code(handshake(7)), 7)
|
43
73
|
|
44
|
-
|
74
|
+
@unittest.skip('extra-credit')
|
75
|
+
def test_reversible4(self):
|
45
76
|
inp = ['wink', 'double blink', 'jump']
|
46
|
-
self.assertEqual(handshake(
|
77
|
+
self.assertEqual(handshake(secret_code(inp)), inp)
|
47
78
|
|
48
79
|
|
49
80
|
if __name__ == '__main__':
|
@@ -1,6 +1,6 @@
|
|
1
1
|
def transpose(input_lines):
|
2
|
-
lines = input_lines.
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
return
|
2
|
+
lines = [line.replace(' ', '_') for line in input_lines.splitlines()]
|
3
|
+
lines = [line.ljust(len(max(lines, key=len))) for line in lines]
|
4
|
+
lines = [''.join(line) for line in zip(*lines)]
|
5
|
+
lines = [line.rstrip().replace('_', ' ') for line in lines]
|
6
|
+
return '\n'.join(lines)
|
@@ -2,7 +2,7 @@ import unittest
|
|
2
2
|
from transpose import transpose
|
3
3
|
|
4
4
|
|
5
|
-
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.
|
5
|
+
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0
|
6
6
|
|
7
7
|
class TransposeTests(unittest.TestCase):
|
8
8
|
def test_empty_string(self):
|
@@ -14,15 +14,25 @@ class TransposeTests(unittest.TestCase):
|
|
14
14
|
)
|
15
15
|
|
16
16
|
def test_two_characters_in_a_row(self):
|
17
|
+
input_line = "A1"
|
18
|
+
expected = [
|
19
|
+
"A",
|
20
|
+
"1"
|
21
|
+
]
|
17
22
|
self.assertEqual(
|
18
|
-
transpose(
|
19
|
-
"\n".join(
|
23
|
+
transpose(input_line),
|
24
|
+
"\n".join(expected)
|
20
25
|
)
|
21
26
|
|
22
27
|
def test_two_characters_in_a_column(self):
|
28
|
+
input_line = [
|
29
|
+
"A",
|
30
|
+
"1"
|
31
|
+
]
|
32
|
+
expected = "A1"
|
23
33
|
self.assertEqual(
|
24
|
-
transpose("\n".join(
|
25
|
-
|
34
|
+
transpose("\n".join(input_line)),
|
35
|
+
expected
|
26
36
|
)
|
27
37
|
|
28
38
|
def test_simple(self):
|
@@ -35,7 +45,6 @@ class TransposeTests(unittest.TestCase):
|
|
35
45
|
"B2",
|
36
46
|
"C3"
|
37
47
|
]
|
38
|
-
|
39
48
|
self.assertEqual(
|
40
49
|
transpose("\n".join(input_line)),
|
41
50
|
"\n".join(expected)
|
@@ -182,77 +191,31 @@ class TransposeTests(unittest.TestCase):
|
|
182
191
|
"\n".join(expected)
|
183
192
|
)
|
184
193
|
|
185
|
-
def
|
194
|
+
def test_mixed_line_length(self):
|
186
195
|
input_line = [
|
187
|
-
"
|
188
|
-
"
|
189
|
-
"
|
190
|
-
"
|
191
|
-
"From forth the fatal loins of these two foes",
|
192
|
-
"A pair of star-cross'd lovers take their life;",
|
193
|
-
"Whose misadventur'd piteous overthrows",
|
194
|
-
"Doth with their death bury their parents' strife.",
|
195
|
-
"The fearful passage of their death-mark'd love,",
|
196
|
-
"And the continuance of their parents' rage,",
|
197
|
-
"Which, but their children's end, naught could remove,",
|
198
|
-
"Is now the two hours' traffic of our stage;",
|
199
|
-
"The which if you with patient ears attend,",
|
200
|
-
"What here shall miss, our toil shall strive to mend."
|
196
|
+
"The longest line.",
|
197
|
+
"A long line.",
|
198
|
+
"A longer line.",
|
199
|
+
"A line."
|
201
200
|
]
|
202
201
|
expected = [
|
203
|
-
"
|
204
|
-
"
|
205
|
-
"
|
206
|
-
"
|
207
|
-
"
|
208
|
-
"
|
209
|
-
"
|
210
|
-
"
|
211
|
-
"
|
212
|
-
"
|
213
|
-
"
|
214
|
-
"
|
215
|
-
"
|
216
|
-
"
|
217
|
-
"
|
218
|
-
"
|
219
|
-
"
|
220
|
-
"lhg to'egccuwi",
|
221
|
-
"deemasdaeehris",
|
222
|
-
"sr als t ists",
|
223
|
-
",ebk 'phool'h,",
|
224
|
-
" reldi ffd ",
|
225
|
-
"bweso tb rtpo",
|
226
|
-
"oea ileutterau",
|
227
|
-
"t kcnoorhhnatr",
|
228
|
-
"hl isvuyee'fi ",
|
229
|
-
" atv es iisfet",
|
230
|
-
"ayoior trr ino",
|
231
|
-
"l lfsoh ecti",
|
232
|
-
"ion vedpn l",
|
233
|
-
"kuehtteieadoe ",
|
234
|
-
"erwaharrar,fas",
|
235
|
-
" nekt te rh",
|
236
|
-
"ismdsehphnnosa",
|
237
|
-
"ncuse ra-tau l",
|
238
|
-
" et tormsural",
|
239
|
-
"dniuthwea'g t ",
|
240
|
-
"iennwesnr hsts",
|
241
|
-
"g,ycoi tkrttet",
|
242
|
-
"n ,l r s'a anr",
|
243
|
-
"i ef 'dgcgdi",
|
244
|
-
"t aol eoe,v",
|
245
|
-
"y nei sl,u; e",
|
246
|
-
", .sf to l ",
|
247
|
-
" e rv d t",
|
248
|
-
" ; ie o",
|
249
|
-
" f, r ",
|
250
|
-
" e e m",
|
251
|
-
" . m e",
|
252
|
-
" o n",
|
253
|
-
" v d",
|
254
|
-
" e .",
|
255
|
-
" ,"
|
202
|
+
"TAAA",
|
203
|
+
"h ",
|
204
|
+
"elll",
|
205
|
+
" ooi",
|
206
|
+
"lnnn",
|
207
|
+
"ogge",
|
208
|
+
"n e.",
|
209
|
+
"glr",
|
210
|
+
"ei ",
|
211
|
+
"snl",
|
212
|
+
"tei",
|
213
|
+
" .n",
|
214
|
+
"l e",
|
215
|
+
"i .",
|
216
|
+
"n",
|
217
|
+
"e",
|
218
|
+
"."
|
256
219
|
]
|
257
220
|
self.assertEqual(
|
258
221
|
transpose("\n".join(input_line)),
|
@@ -8,119 +8,119 @@ from word_search import WordSearch, Point
|
|
8
8
|
class WordSearchTests(unittest.TestCase):
|
9
9
|
|
10
10
|
def test_initial_game_grid(self):
|
11
|
-
puzzle = 'jefblpepre'
|
11
|
+
puzzle = ['jefblpepre']
|
12
12
|
searchAnswer = WordSearch(puzzle).search('clojure')
|
13
13
|
self.assertIsNone(searchAnswer)
|
14
14
|
|
15
15
|
def test_left_to_right_word(self):
|
16
|
-
puzzle = 'clojurermt'
|
16
|
+
puzzle = ['clojurermt']
|
17
17
|
searchAnswer = WordSearch(puzzle).search('clojure')
|
18
18
|
self.assertEqual(searchAnswer, (Point(0, 0), Point(6, 0)))
|
19
19
|
|
20
20
|
def test_left_to_right_word_different_position(self):
|
21
|
-
puzzle = 'mtclojurer'
|
21
|
+
puzzle = ['mtclojurer']
|
22
22
|
searchAnswer = WordSearch(puzzle).search('clojure')
|
23
23
|
self.assertEqual(searchAnswer, (Point(2, 0), Point(8, 0)))
|
24
24
|
|
25
25
|
def test_different_left_to_right_word(self):
|
26
|
-
puzzle = 'coffeelplx'
|
26
|
+
puzzle = ['coffeelplx']
|
27
27
|
searchAnswer = WordSearch(puzzle).search('coffee')
|
28
28
|
self.assertEqual(searchAnswer, (Point(0, 0), Point(5, 0)))
|
29
29
|
|
30
30
|
def test_different_left_to_right_word_different_position(self):
|
31
|
-
puzzle = 'xcoffeezlp'
|
31
|
+
puzzle = ['xcoffeezlp']
|
32
32
|
searchAnswer = WordSearch(puzzle).search('coffee')
|
33
33
|
self.assertEqual(searchAnswer, (Point(1, 0), Point(6, 0)))
|
34
34
|
|
35
35
|
def test_left_to_right_word_two_lines(self):
|
36
|
-
puzzle =
|
37
|
-
'tclojurerm
|
36
|
+
puzzle = ['jefblpepre',
|
37
|
+
'tclojurerm']
|
38
38
|
searchAnswer = WordSearch(puzzle).search('clojure')
|
39
39
|
self.assertEqual(searchAnswer, (Point(1, 1), Point(7, 1)))
|
40
40
|
|
41
41
|
def test_left_to_right_word_three_lines(self):
|
42
|
-
puzzle =
|
43
|
-
'jefblpepre
|
44
|
-
'clojurermt
|
42
|
+
puzzle = ['camdcimgtc',
|
43
|
+
'jefblpepre',
|
44
|
+
'clojurermt']
|
45
45
|
searchAnswer = WordSearch(puzzle).search('clojure')
|
46
46
|
self.assertEqual(searchAnswer, (Point(0, 2), Point(6, 2)))
|
47
47
|
|
48
48
|
def test_left_to_right_word_ten_lines(self):
|
49
|
-
puzzle =
|
50
|
-
'camdcimgtc
|
51
|
-
'oivokprjsm
|
52
|
-
'pbwasqroua
|
53
|
-
'rixilelhrs
|
54
|
-
'wolcqlirpc
|
55
|
-
'screeaumgr
|
56
|
-
'alxhpburyi
|
57
|
-
'jalaycalmp
|
58
|
-
'clojurermt
|
49
|
+
puzzle = ['jefblpepre',
|
50
|
+
'camdcimgtc',
|
51
|
+
'oivokprjsm',
|
52
|
+
'pbwasqroua',
|
53
|
+
'rixilelhrs',
|
54
|
+
'wolcqlirpc',
|
55
|
+
'screeaumgr',
|
56
|
+
'alxhpburyi',
|
57
|
+
'jalaycalmp',
|
58
|
+
'clojurermt']
|
59
59
|
searchAnswer = WordSearch(puzzle).search('clojure')
|
60
60
|
self.assertEqual(searchAnswer, (Point(0, 9), Point(6, 9)))
|
61
61
|
|
62
62
|
def test_left_to_right_word_ten_lines_different_position(self):
|
63
|
-
puzzle =
|
64
|
-
'camdcimgtc
|
65
|
-
'oivokprjsm
|
66
|
-
'pbwasqroua
|
67
|
-
'rixilelhrs
|
68
|
-
'wolcqlirpc
|
69
|
-
'screeaumgr
|
70
|
-
'alxhpburyi
|
71
|
-
'clojurermt
|
72
|
-
'jalaycalmp
|
63
|
+
puzzle = ['jefblpepre',
|
64
|
+
'camdcimgtc',
|
65
|
+
'oivokprjsm',
|
66
|
+
'pbwasqroua',
|
67
|
+
'rixilelhrs',
|
68
|
+
'wolcqlirpc',
|
69
|
+
'screeaumgr',
|
70
|
+
'alxhpburyi',
|
71
|
+
'clojurermt',
|
72
|
+
'jalaycalmp']
|
73
73
|
searchAnswer = WordSearch(puzzle).search('clojure')
|
74
74
|
self.assertEqual(searchAnswer, (Point(0, 8), Point(6, 8)))
|
75
75
|
|
76
76
|
def test_different_left_to_right_word_ten_lines(self):
|
77
|
-
puzzle =
|
78
|
-
'camdcimgtc
|
79
|
-
'oivokprjsm
|
80
|
-
'pbwasqroua
|
81
|
-
'rixilelhrs
|
82
|
-
'wolcqlirpc
|
83
|
-
'fortranftw
|
84
|
-
'alxhpburyi
|
85
|
-
'clojurermt
|
86
|
-
'jalaycalmp
|
77
|
+
puzzle = ['jefblpepre',
|
78
|
+
'camdcimgtc',
|
79
|
+
'oivokprjsm',
|
80
|
+
'pbwasqroua',
|
81
|
+
'rixilelhrs',
|
82
|
+
'wolcqlirpc',
|
83
|
+
'fortranftw',
|
84
|
+
'alxhpburyi',
|
85
|
+
'clojurermt',
|
86
|
+
'jalaycalmp']
|
87
87
|
searchAnswer = WordSearch(puzzle).search('fortran')
|
88
88
|
self.assertEqual(searchAnswer, (Point(0, 6), Point(6, 6)))
|
89
89
|
|
90
90
|
def test_multiple_words(self):
|
91
|
-
puzzle =
|
92
|
-
'camdcimgtc
|
93
|
-
'oivokprjsm
|
94
|
-
'pbwasqroua
|
95
|
-
'rixilelhrs
|
96
|
-
'wolcqlirpc
|
97
|
-
'fortranftw
|
98
|
-
'alxhpburyi
|
99
|
-
'jalaycalmp
|
100
|
-
'clojurermt
|
91
|
+
puzzle = ['jefblpepre',
|
92
|
+
'camdcimgtc',
|
93
|
+
'oivokprjsm',
|
94
|
+
'pbwasqroua',
|
95
|
+
'rixilelhrs',
|
96
|
+
'wolcqlirpc',
|
97
|
+
'fortranftw',
|
98
|
+
'alxhpburyi',
|
99
|
+
'jalaycalmp',
|
100
|
+
'clojurermt']
|
101
101
|
searchAnswer = WordSearch(puzzle).search('fortran')
|
102
102
|
self.assertEqual(searchAnswer, (Point(0, 6), Point(6, 6)))
|
103
103
|
searchAnswer = WordSearch(puzzle).search('clojure')
|
104
104
|
self.assertEqual(searchAnswer, (Point(0, 9), Point(6, 9)))
|
105
105
|
|
106
106
|
def test_single_word_right_to_left(self):
|
107
|
-
puzzle = 'rixilelhrs'
|
107
|
+
puzzle = ['rixilelhrs']
|
108
108
|
searchAnswer = WordSearch(puzzle).search('elixir')
|
109
109
|
self.assertEqual(searchAnswer, (Point(5, 0), Point(0, 0)))
|
110
110
|
|
111
111
|
@classmethod
|
112
|
-
def setUpClass(
|
113
|
-
puzzle =
|
114
|
-
'camdcimgtc
|
115
|
-
'oivokprjsm
|
116
|
-
'pbwasqroua
|
117
|
-
'rixilelhrs
|
118
|
-
'wolcqlirpc
|
119
|
-
'screeaumgr
|
120
|
-
'alxhpburyi
|
121
|
-
'jalaycalmp
|
122
|
-
'clojurermt'
|
123
|
-
|
112
|
+
def setUpClass(cls):
|
113
|
+
puzzle = ['jefblpepre',
|
114
|
+
'camdcimgtc',
|
115
|
+
'oivokprjsm',
|
116
|
+
'pbwasqroua',
|
117
|
+
'rixilelhrs',
|
118
|
+
'wolcqlirpc',
|
119
|
+
'screeaumgr',
|
120
|
+
'alxhpburyi',
|
121
|
+
'jalaycalmp',
|
122
|
+
'clojurermt']
|
123
|
+
cls.example = WordSearch(puzzle)
|
124
124
|
|
125
125
|
def test_horizontal_words_different_directions(self):
|
126
126
|
self.assertEqual(
|