trackler 2.2.1.178 → 2.2.1.179
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/c/exercises/word-count/test/test_word_count.c +88 -88
- data/tracks/delphi/config.json +12 -1
- data/tracks/delphi/exercises/isogram/Isogram.dpr +60 -0
- data/tracks/delphi/exercises/isogram/README.md +41 -0
- data/tracks/delphi/exercises/isogram/uIsogramExample.pas +34 -0
- data/tracks/delphi/exercises/isogram/uIsogramTests.pas +104 -0
- data/tracks/elm/config.json +1 -1
- data/tracks/fsharp/exercises/matrix/Matrix.fs +1 -1
- data/tracks/reasonml/Makefile +4 -2
- data/tracks/reasonml/README.md +10 -17
- data/tracks/reasonml/config.json +49 -38
- data/tracks/reasonml/exercises/roman-numerals/README.md +69 -0
- data/tracks/reasonml/exercises/roman-numerals/__tests__/RomanNumerals_test.re +64 -0
- data/tracks/reasonml/exercises/roman-numerals/bsconfig.json +30 -0
- data/tracks/reasonml/exercises/roman-numerals/package.json +20 -0
- data/tracks/reasonml/exercises/roman-numerals/src/Example.re +19 -0
- data/tracks/reasonml/exercises/roman-numerals/src/RomanNumerals.rei +1 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de1658eb0260d4f09d4fa14ba3bbededefc02f33
|
4
|
+
data.tar.gz: 1c17f386b467a4ee630fd582ad8404c5582f138b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b90a4be30889386c990d303e73e62ec5c7583027bc83bd885aeb60affa510c3af563b97dd3eb2fb290fbf7303ebfcbb1aed5c8907b0760e0cb47b7ca1c2d47af
|
7
|
+
data.tar.gz: 5ac571a21c860e43662578195809ab6b058f8bb32f8e5e395c629f3835c4ccc5f46b769cf6421e0b42438892f9b7ad473911cdc8bb8537acca0f2c7657a34ba4
|
data/lib/trackler/version.rb
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
#include "vendor/unity.h"
|
5
5
|
#include "../src/word_count.h"
|
6
6
|
|
7
|
+
#define STRING_SIZE (MAX_WORD_LENGTH + 1)
|
8
|
+
|
7
9
|
word_count_word_t actual_solution[MAX_WORDS];
|
8
10
|
word_count_word_t expected_solution[MAX_WORDS];
|
9
11
|
void setUp(void)
|
@@ -27,8 +29,7 @@ static void check_solution(word_count_word_t * expected_solution,
|
|
27
29
|
TEST_ASSERT_EQUAL(expected_solution[index].count,
|
28
30
|
actual_solution[index].count);
|
29
31
|
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_solution[index].text,
|
30
|
-
actual_solution[index].text,
|
31
|
-
MAX_WORD_LENGTH);
|
32
|
+
actual_solution[index].text, STRING_SIZE);
|
32
33
|
}
|
33
34
|
}
|
34
35
|
|
@@ -45,7 +46,7 @@ void test_word_count_one_word(void)
|
|
45
46
|
|
46
47
|
// fill in the expected words
|
47
48
|
expected_solution[index].count = 1;
|
48
|
-
strncpy(expected_solution[index++].text, "word",
|
49
|
+
strncpy(expected_solution[index++].text, "word", STRING_SIZE);
|
49
50
|
|
50
51
|
actual_word_count = word_count(input_text, actual_solution);
|
51
52
|
|
@@ -66,13 +67,13 @@ void test_word_count_one_of_each_word(void)
|
|
66
67
|
|
67
68
|
// fill in the expected words
|
68
69
|
expected_solution[index].count = 1;
|
69
|
-
strncpy(expected_solution[index++].text, "one",
|
70
|
+
strncpy(expected_solution[index++].text, "one", STRING_SIZE);
|
70
71
|
|
71
72
|
expected_solution[index].count = 1;
|
72
|
-
strncpy(expected_solution[index++].text, "of",
|
73
|
+
strncpy(expected_solution[index++].text, "of", STRING_SIZE);
|
73
74
|
|
74
75
|
expected_solution[index].count = 1;
|
75
|
-
strncpy(expected_solution[index++].text, "each",
|
76
|
+
strncpy(expected_solution[index++].text, "each", STRING_SIZE);
|
76
77
|
|
77
78
|
actual_word_count = word_count(input_text, actual_solution);
|
78
79
|
|
@@ -92,19 +93,19 @@ void test_word_count_multiple_occurrences_of_a_word(void)
|
|
92
93
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
93
94
|
|
94
95
|
expected_solution[index].count = 1;
|
95
|
-
strncpy(expected_solution[index++].text, "one",
|
96
|
+
strncpy(expected_solution[index++].text, "one", STRING_SIZE);
|
96
97
|
|
97
98
|
expected_solution[index].count = 4;
|
98
|
-
strncpy(expected_solution[index++].text, "fish",
|
99
|
+
strncpy(expected_solution[index++].text, "fish", STRING_SIZE);
|
99
100
|
|
100
101
|
expected_solution[index].count = 1;
|
101
|
-
strncpy(expected_solution[index++].text, "two",
|
102
|
+
strncpy(expected_solution[index++].text, "two", STRING_SIZE);
|
102
103
|
|
103
104
|
expected_solution[index].count = 1;
|
104
|
-
strncpy(expected_solution[index++].text, "red",
|
105
|
+
strncpy(expected_solution[index++].text, "red", STRING_SIZE);
|
105
106
|
|
106
107
|
expected_solution[index].count = 1;
|
107
|
-
strncpy(expected_solution[index++].text, "blue",
|
108
|
+
strncpy(expected_solution[index++].text, "blue", STRING_SIZE);
|
108
109
|
|
109
110
|
actual_word_count = word_count(input_text, actual_solution);
|
110
111
|
|
@@ -124,13 +125,13 @@ void test_word_count_handles_cramped_lists(void)
|
|
124
125
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
125
126
|
|
126
127
|
expected_solution[index].count = 1;
|
127
|
-
strncpy(expected_solution[index++].text, "one",
|
128
|
+
strncpy(expected_solution[index++].text, "one", STRING_SIZE);
|
128
129
|
|
129
130
|
expected_solution[index].count = 1;
|
130
|
-
strncpy(expected_solution[index++].text, "two",
|
131
|
+
strncpy(expected_solution[index++].text, "two", STRING_SIZE);
|
131
132
|
|
132
133
|
expected_solution[index].count = 1;
|
133
|
-
strncpy(expected_solution[index++].text, "three",
|
134
|
+
strncpy(expected_solution[index++].text, "three", STRING_SIZE);
|
134
135
|
|
135
136
|
actual_word_count = word_count(input_text, actual_solution);
|
136
137
|
|
@@ -150,13 +151,13 @@ void test_word_count_handles_expanded_lists(void)
|
|
150
151
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
151
152
|
|
152
153
|
expected_solution[index].count = 1;
|
153
|
-
strncpy(expected_solution[index++].text, "one",
|
154
|
+
strncpy(expected_solution[index++].text, "one", STRING_SIZE);
|
154
155
|
|
155
156
|
expected_solution[index].count = 1;
|
156
|
-
strncpy(expected_solution[index++].text, "two",
|
157
|
+
strncpy(expected_solution[index++].text, "two", STRING_SIZE);
|
157
158
|
|
158
159
|
expected_solution[index].count = 1;
|
159
|
-
strncpy(expected_solution[index++].text, "three",
|
160
|
+
strncpy(expected_solution[index++].text, "three", STRING_SIZE);
|
160
161
|
|
161
162
|
actual_word_count = word_count(input_text, actual_solution);
|
162
163
|
|
@@ -176,19 +177,19 @@ void test_word_count_ignore_punctuation(void)
|
|
176
177
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
177
178
|
|
178
179
|
expected_solution[index].count = 1;
|
179
|
-
strncpy(expected_solution[index++].text, "car",
|
180
|
+
strncpy(expected_solution[index++].text, "car", STRING_SIZE);
|
180
181
|
|
181
182
|
expected_solution[index].count = 1;
|
182
|
-
strncpy(expected_solution[index++].text, "carpet",
|
183
|
+
strncpy(expected_solution[index++].text, "carpet", STRING_SIZE);
|
183
184
|
|
184
185
|
expected_solution[index].count = 1;
|
185
|
-
strncpy(expected_solution[index++].text, "as",
|
186
|
+
strncpy(expected_solution[index++].text, "as", STRING_SIZE);
|
186
187
|
|
187
188
|
expected_solution[index].count = 1;
|
188
|
-
strncpy(expected_solution[index++].text, "java",
|
189
|
+
strncpy(expected_solution[index++].text, "java", STRING_SIZE);
|
189
190
|
|
190
191
|
expected_solution[index].count = 1;
|
191
|
-
strncpy(expected_solution[index++].text, "javascript",
|
192
|
+
strncpy(expected_solution[index++].text, "javascript", STRING_SIZE);
|
192
193
|
|
193
194
|
actual_word_count = word_count(input_text, actual_solution);
|
194
195
|
|
@@ -208,13 +209,13 @@ void test_word_count_include_numbers(void)
|
|
208
209
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
209
210
|
|
210
211
|
expected_solution[index].count = 2;
|
211
|
-
strncpy(expected_solution[index++].text, "testing",
|
212
|
+
strncpy(expected_solution[index++].text, "testing", STRING_SIZE);
|
212
213
|
|
213
214
|
expected_solution[index].count = 1;
|
214
|
-
strncpy(expected_solution[index++].text, "1",
|
215
|
+
strncpy(expected_solution[index++].text, "1", STRING_SIZE);
|
215
216
|
|
216
217
|
expected_solution[index].count = 1;
|
217
|
-
strncpy(expected_solution[index++].text, "2",
|
218
|
+
strncpy(expected_solution[index++].text, "2", STRING_SIZE);
|
218
219
|
|
219
220
|
actual_word_count = word_count(input_text, actual_solution);
|
220
221
|
|
@@ -234,10 +235,10 @@ void test_word_count_normalize_case(void)
|
|
234
235
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
235
236
|
|
236
237
|
expected_solution[index].count = 3;
|
237
|
-
strncpy(expected_solution[index++].text, "go",
|
238
|
+
strncpy(expected_solution[index++].text, "go", STRING_SIZE);
|
238
239
|
|
239
240
|
expected_solution[index].count = 2;
|
240
|
-
strncpy(expected_solution[index++].text, "stop",
|
241
|
+
strncpy(expected_solution[index++].text, "stop", STRING_SIZE);
|
241
242
|
|
242
243
|
actual_word_count = word_count(input_text, actual_solution);
|
243
244
|
|
@@ -257,19 +258,19 @@ void test_word_count_with_apostrophes(void)
|
|
257
258
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
258
259
|
|
259
260
|
expected_solution[index].count = 1;
|
260
|
-
strncpy(expected_solution[index++].text, "first",
|
261
|
+
strncpy(expected_solution[index++].text, "first", STRING_SIZE);
|
261
262
|
|
262
263
|
expected_solution[index].count = 2;
|
263
|
-
strncpy(expected_solution[index++].text, "don't",
|
264
|
+
strncpy(expected_solution[index++].text, "don't", STRING_SIZE);
|
264
265
|
|
265
266
|
expected_solution[index].count = 1;
|
266
|
-
strncpy(expected_solution[index++].text, "laugh",
|
267
|
+
strncpy(expected_solution[index++].text, "laugh", STRING_SIZE);
|
267
268
|
|
268
269
|
expected_solution[index].count = 1;
|
269
|
-
strncpy(expected_solution[index++].text, "then",
|
270
|
+
strncpy(expected_solution[index++].text, "then", STRING_SIZE);
|
270
271
|
|
271
272
|
expected_solution[index].count = 1;
|
272
|
-
strncpy(expected_solution[index++].text, "cry",
|
273
|
+
strncpy(expected_solution[index++].text, "cry", STRING_SIZE);
|
273
274
|
|
274
275
|
actual_word_count = word_count(input_text, actual_solution);
|
275
276
|
|
@@ -289,22 +290,22 @@ void test_word_count_with_quotation(void)
|
|
289
290
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
290
291
|
|
291
292
|
expected_solution[index].count = 1;
|
292
|
-
strncpy(expected_solution[index++].text, "joe",
|
293
|
+
strncpy(expected_solution[index++].text, "joe", STRING_SIZE);
|
293
294
|
|
294
295
|
expected_solution[index].count = 1;
|
295
|
-
strncpy(expected_solution[index++].text, "can't",
|
296
|
+
strncpy(expected_solution[index++].text, "can't", STRING_SIZE);
|
296
297
|
|
297
298
|
expected_solution[index].count = 1;
|
298
|
-
strncpy(expected_solution[index++].text, "tell",
|
299
|
+
strncpy(expected_solution[index++].text, "tell", STRING_SIZE);
|
299
300
|
|
300
301
|
expected_solution[index].count = 1;
|
301
|
-
strncpy(expected_solution[index++].text, "between",
|
302
|
+
strncpy(expected_solution[index++].text, "between", STRING_SIZE);
|
302
303
|
|
303
304
|
expected_solution[index].count = 2;
|
304
|
-
strncpy(expected_solution[index++].text, "large",
|
305
|
+
strncpy(expected_solution[index++].text, "large", STRING_SIZE);
|
305
306
|
|
306
307
|
expected_solution[index].count = 1;
|
307
|
-
strncpy(expected_solution[index++].text, "and",
|
308
|
+
strncpy(expected_solution[index++].text, "and", STRING_SIZE);
|
308
309
|
|
309
310
|
actual_word_count = word_count(input_text, actual_solution);
|
310
311
|
|
@@ -324,16 +325,16 @@ void test_word_count_from_example(void)
|
|
324
325
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
325
326
|
|
326
327
|
expected_solution[index].count = 2;
|
327
|
-
strncpy(expected_solution[index++].text, "olly",
|
328
|
+
strncpy(expected_solution[index++].text, "olly", STRING_SIZE);
|
328
329
|
|
329
330
|
expected_solution[index].count = 1;
|
330
|
-
strncpy(expected_solution[index++].text, "in",
|
331
|
+
strncpy(expected_solution[index++].text, "in", STRING_SIZE);
|
331
332
|
|
332
333
|
expected_solution[index].count = 1;
|
333
|
-
strncpy(expected_solution[index++].text, "come",
|
334
|
+
strncpy(expected_solution[index++].text, "come", STRING_SIZE);
|
334
335
|
|
335
336
|
expected_solution[index].count = 1;
|
336
|
-
strncpy(expected_solution[index++].text, "free",
|
337
|
+
strncpy(expected_solution[index++].text, "free", STRING_SIZE);
|
337
338
|
|
338
339
|
actual_word_count = word_count(input_text, actual_solution);
|
339
340
|
|
@@ -355,18 +356,17 @@ void test_max_length_word(void)
|
|
355
356
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
356
357
|
|
357
358
|
expected_solution[index].count = 2;
|
358
|
-
strncpy(expected_solution[index++].text, "look",
|
359
|
+
strncpy(expected_solution[index++].text, "look", STRING_SIZE);
|
359
360
|
|
360
361
|
expected_solution[index].count = 2;
|
361
362
|
strncpy(expected_solution[index++].text,
|
362
|
-
"thisisaveeeeeerylongwordtypedwithoutusinganyspaces",
|
363
|
-
MAX_WORD_LENGTH);
|
363
|
+
"thisisaveeeeeerylongwordtypedwithoutusinganyspaces", STRING_SIZE);
|
364
364
|
|
365
365
|
expected_solution[index].count = 1;
|
366
|
-
strncpy(expected_solution[index++].text, "and",
|
366
|
+
strncpy(expected_solution[index++].text, "and", STRING_SIZE);
|
367
367
|
|
368
368
|
expected_solution[index].count = 1;
|
369
|
-
strncpy(expected_solution[index++].text, "again",
|
369
|
+
strncpy(expected_solution[index++].text, "again", STRING_SIZE);
|
370
370
|
|
371
371
|
actual_word_count = word_count(input_text, actual_solution);
|
372
372
|
|
@@ -388,7 +388,7 @@ void test_excessive_length_word(void)
|
|
388
388
|
// build the expected solution
|
389
389
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
390
390
|
expected_solution[index].count = 1;
|
391
|
-
strncpy(expected_solution[index++].text, "look",
|
391
|
+
strncpy(expected_solution[index++].text, "look", STRING_SIZE);
|
392
392
|
|
393
393
|
actual_word_count = word_count(input_text, actual_solution);
|
394
394
|
|
@@ -410,64 +410,64 @@ void test_max_number_words(void)
|
|
410
410
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
411
411
|
|
412
412
|
expected_solution[index].count = 1;
|
413
|
-
strncpy(expected_solution[index++].text, "once",
|
413
|
+
strncpy(expected_solution[index++].text, "once", STRING_SIZE);
|
414
414
|
|
415
415
|
expected_solution[index].count = 1;
|
416
|
-
strncpy(expected_solution[index++].text, "upon",
|
416
|
+
strncpy(expected_solution[index++].text, "upon", STRING_SIZE);
|
417
417
|
|
418
418
|
expected_solution[index].count = 3;
|
419
|
-
strncpy(expected_solution[index++].text, "a",
|
419
|
+
strncpy(expected_solution[index++].text, "a", STRING_SIZE);
|
420
420
|
|
421
421
|
expected_solution[index].count = 1;
|
422
|
-
strncpy(expected_solution[index++].text, "time",
|
422
|
+
strncpy(expected_solution[index++].text, "time", STRING_SIZE);
|
423
423
|
|
424
424
|
expected_solution[index].count = 1;
|
425
|
-
strncpy(expected_solution[index++].text, "long",
|
425
|
+
strncpy(expected_solution[index++].text, "long", STRING_SIZE);
|
426
426
|
|
427
427
|
expected_solution[index].count = 1;
|
428
|
-
strncpy(expected_solution[index++].text, "while",
|
428
|
+
strncpy(expected_solution[index++].text, "while", STRING_SIZE);
|
429
429
|
|
430
430
|
expected_solution[index].count = 1;
|
431
|
-
strncpy(expected_solution[index++].text, "in",
|
431
|
+
strncpy(expected_solution[index++].text, "in", STRING_SIZE);
|
432
432
|
|
433
433
|
expected_solution[index].count = 1;
|
434
|
-
strncpy(expected_solution[index++].text, "the",
|
434
|
+
strncpy(expected_solution[index++].text, "the", STRING_SIZE);
|
435
435
|
|
436
436
|
expected_solution[index].count = 1;
|
437
|
-
strncpy(expected_solution[index++].text, "past",
|
437
|
+
strncpy(expected_solution[index++].text, "past", STRING_SIZE);
|
438
438
|
|
439
439
|
expected_solution[index].count = 1;
|
440
|
-
strncpy(expected_solution[index++].text, "there",
|
440
|
+
strncpy(expected_solution[index++].text, "there", STRING_SIZE);
|
441
441
|
|
442
442
|
expected_solution[index].count = 1;
|
443
|
-
strncpy(expected_solution[index++].text, "lived",
|
443
|
+
strncpy(expected_solution[index++].text, "lived", STRING_SIZE);
|
444
444
|
|
445
445
|
expected_solution[index].count = 1;
|
446
|
-
strncpy(expected_solution[index++].text, "strange",
|
446
|
+
strncpy(expected_solution[index++].text, "strange", STRING_SIZE);
|
447
447
|
|
448
448
|
expected_solution[index].count = 1;
|
449
|
-
strncpy(expected_solution[index++].text, "little",
|
449
|
+
strncpy(expected_solution[index++].text, "little", STRING_SIZE);
|
450
450
|
|
451
451
|
expected_solution[index].count = 1;
|
452
|
-
strncpy(expected_solution[index++].text, "man",
|
452
|
+
strncpy(expected_solution[index++].text, "man", STRING_SIZE);
|
453
453
|
|
454
454
|
expected_solution[index].count = 1;
|
455
|
-
strncpy(expected_solution[index++].text, "who",
|
455
|
+
strncpy(expected_solution[index++].text, "who", STRING_SIZE);
|
456
456
|
|
457
457
|
expected_solution[index].count = 1;
|
458
|
-
strncpy(expected_solution[index++].text, "could",
|
458
|
+
strncpy(expected_solution[index++].text, "could", STRING_SIZE);
|
459
459
|
|
460
460
|
expected_solution[index].count = 1;
|
461
|
-
strncpy(expected_solution[index++].text, "spin",
|
461
|
+
strncpy(expected_solution[index++].text, "spin", STRING_SIZE);
|
462
462
|
|
463
463
|
expected_solution[index].count = 1;
|
464
|
-
strncpy(expected_solution[index++].text, "straw",
|
464
|
+
strncpy(expected_solution[index++].text, "straw", STRING_SIZE);
|
465
465
|
|
466
466
|
expected_solution[index].count = 1;
|
467
|
-
strncpy(expected_solution[index++].text, "into",
|
467
|
+
strncpy(expected_solution[index++].text, "into", STRING_SIZE);
|
468
468
|
|
469
469
|
expected_solution[index].count = 1;
|
470
|
-
strncpy(expected_solution[index++].text, "gold",
|
470
|
+
strncpy(expected_solution[index++].text, "gold", STRING_SIZE);
|
471
471
|
|
472
472
|
actual_word_count = word_count(input_text, actual_solution);
|
473
473
|
|
@@ -489,64 +489,64 @@ void test_excessive_number_words(void)
|
|
489
489
|
memset(expected_solution, 0, sizeof(expected_solution)); // clear to start with a known value
|
490
490
|
|
491
491
|
expected_solution[index].count = 1;
|
492
|
-
strncpy(expected_solution[index++].text, "once",
|
492
|
+
strncpy(expected_solution[index++].text, "once", STRING_SIZE);
|
493
493
|
|
494
494
|
expected_solution[index].count = 1;
|
495
|
-
strncpy(expected_solution[index++].text, "upon",
|
495
|
+
strncpy(expected_solution[index++].text, "upon", STRING_SIZE);
|
496
496
|
|
497
497
|
expected_solution[index].count = 3;
|
498
|
-
strncpy(expected_solution[index++].text, "a",
|
498
|
+
strncpy(expected_solution[index++].text, "a", STRING_SIZE);
|
499
499
|
|
500
500
|
expected_solution[index].count = 1;
|
501
|
-
strncpy(expected_solution[index++].text, "time",
|
501
|
+
strncpy(expected_solution[index++].text, "time", STRING_SIZE);
|
502
502
|
|
503
503
|
expected_solution[index].count = 1;
|
504
|
-
strncpy(expected_solution[index++].text, "long",
|
504
|
+
strncpy(expected_solution[index++].text, "long", STRING_SIZE);
|
505
505
|
|
506
506
|
expected_solution[index].count = 1;
|
507
|
-
strncpy(expected_solution[index++].text, "while",
|
507
|
+
strncpy(expected_solution[index++].text, "while", STRING_SIZE);
|
508
508
|
|
509
509
|
expected_solution[index].count = 1;
|
510
|
-
strncpy(expected_solution[index++].text, "in",
|
510
|
+
strncpy(expected_solution[index++].text, "in", STRING_SIZE);
|
511
511
|
|
512
512
|
expected_solution[index].count = 1;
|
513
|
-
strncpy(expected_solution[index++].text, "the",
|
513
|
+
strncpy(expected_solution[index++].text, "the", STRING_SIZE);
|
514
514
|
|
515
515
|
expected_solution[index].count = 1;
|
516
|
-
strncpy(expected_solution[index++].text, "past",
|
516
|
+
strncpy(expected_solution[index++].text, "past", STRING_SIZE);
|
517
517
|
|
518
518
|
expected_solution[index].count = 1;
|
519
|
-
strncpy(expected_solution[index++].text, "there",
|
519
|
+
strncpy(expected_solution[index++].text, "there", STRING_SIZE);
|
520
520
|
|
521
521
|
expected_solution[index].count = 1;
|
522
|
-
strncpy(expected_solution[index++].text, "lived",
|
522
|
+
strncpy(expected_solution[index++].text, "lived", STRING_SIZE);
|
523
523
|
|
524
524
|
expected_solution[index].count = 1;
|
525
|
-
strncpy(expected_solution[index++].text, "strange",
|
525
|
+
strncpy(expected_solution[index++].text, "strange", STRING_SIZE);
|
526
526
|
|
527
527
|
expected_solution[index].count = 1;
|
528
|
-
strncpy(expected_solution[index++].text, "little",
|
528
|
+
strncpy(expected_solution[index++].text, "little", STRING_SIZE);
|
529
529
|
|
530
530
|
expected_solution[index].count = 1;
|
531
|
-
strncpy(expected_solution[index++].text, "man",
|
531
|
+
strncpy(expected_solution[index++].text, "man", STRING_SIZE);
|
532
532
|
|
533
533
|
expected_solution[index].count = 1;
|
534
|
-
strncpy(expected_solution[index++].text, "who",
|
534
|
+
strncpy(expected_solution[index++].text, "who", STRING_SIZE);
|
535
535
|
|
536
536
|
expected_solution[index].count = 1;
|
537
|
-
strncpy(expected_solution[index++].text, "could",
|
537
|
+
strncpy(expected_solution[index++].text, "could", STRING_SIZE);
|
538
538
|
|
539
539
|
expected_solution[index].count = 1;
|
540
|
-
strncpy(expected_solution[index++].text, "spin",
|
540
|
+
strncpy(expected_solution[index++].text, "spin", STRING_SIZE);
|
541
541
|
|
542
542
|
expected_solution[index].count = 1;
|
543
|
-
strncpy(expected_solution[index++].text, "straw",
|
543
|
+
strncpy(expected_solution[index++].text, "straw", STRING_SIZE);
|
544
544
|
|
545
545
|
expected_solution[index].count = 1;
|
546
|
-
strncpy(expected_solution[index++].text, "into",
|
546
|
+
strncpy(expected_solution[index++].text, "into", STRING_SIZE);
|
547
547
|
|
548
548
|
expected_solution[index].count = 1;
|
549
|
-
strncpy(expected_solution[index++].text, "gold",
|
549
|
+
strncpy(expected_solution[index++].text, "gold", STRING_SIZE);
|
550
550
|
|
551
551
|
actual_word_count = word_count(input_text, actual_solution);
|
552
552
|
|
data/tracks/delphi/config.json
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
{
|
18
18
|
"slug": "two-fer",
|
19
19
|
"uuid": "60eb0882-495d-45f4-8d38-5b10d8851cf6",
|
20
|
-
"core":
|
20
|
+
"core": true,
|
21
21
|
"unlocked_by": null,
|
22
22
|
"difficulty": 1,
|
23
23
|
"topics": [
|
@@ -201,6 +201,17 @@
|
|
201
201
|
"text_formatting"
|
202
202
|
]
|
203
203
|
},
|
204
|
+
{
|
205
|
+
"slug": "isogram",
|
206
|
+
"uuid": "7a489381-5ef6-49df-a05d-4c73b3ed9b53",
|
207
|
+
"core": false,
|
208
|
+
"unlocked_by": "two-fer",
|
209
|
+
"difficulty": 3,
|
210
|
+
"topics": [
|
211
|
+
"filtering",
|
212
|
+
"strings"
|
213
|
+
]
|
214
|
+
},
|
204
215
|
{
|
205
216
|
"slug": "phone-number",
|
206
217
|
"uuid": "cba5cf99-8001-4113-af80-cf9c041f1b21",
|
@@ -0,0 +1,60 @@
|
|
1
|
+
program Isogram;
|
2
|
+
|
3
|
+
{$IFNDEF TESTINSIGHT}
|
4
|
+
{$APPTYPE CONSOLE}
|
5
|
+
{$ENDIF}{$STRONGLINKTYPES ON}
|
6
|
+
uses
|
7
|
+
System.SysUtils,
|
8
|
+
{$IFDEF TESTINSIGHT}
|
9
|
+
TestInsight.DUnitX,
|
10
|
+
{$ENDIF }
|
11
|
+
DUnitX.Loggers.Console,
|
12
|
+
DUnitX.Loggers.Xml.NUnit,
|
13
|
+
DUnitX.TestFramework,
|
14
|
+
uIsogramTests in 'uIsogramTests.pas',
|
15
|
+
uIsogram in 'uIsogram.pas';
|
16
|
+
|
17
|
+
var
|
18
|
+
runner : ITestRunner;
|
19
|
+
results : IRunResults;
|
20
|
+
logger : ITestLogger;
|
21
|
+
nunitLogger : ITestLogger;
|
22
|
+
begin
|
23
|
+
{$IFDEF TESTINSIGHT}
|
24
|
+
TestInsight.DUnitX.RunRegisteredTests;
|
25
|
+
exit;
|
26
|
+
{$ENDIF}
|
27
|
+
try
|
28
|
+
//Check command line options, will exit if invalid
|
29
|
+
TDUnitX.CheckCommandLine;
|
30
|
+
//Create the test runner
|
31
|
+
runner := TDUnitX.CreateRunner;
|
32
|
+
//Tell the runner to use RTTI to find Fixtures
|
33
|
+
runner.UseRTTI := True;
|
34
|
+
//tell the runner how we will log things
|
35
|
+
//Log to the console window
|
36
|
+
logger := TDUnitXConsoleLogger.Create(true);
|
37
|
+
runner.AddLogger(logger);
|
38
|
+
//Generate an NUnit compatible XML File
|
39
|
+
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
|
40
|
+
runner.AddLogger(nunitLogger);
|
41
|
+
runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;
|
42
|
+
|
43
|
+
//Run tests
|
44
|
+
results := runner.Execute;
|
45
|
+
if not results.AllPassed then
|
46
|
+
System.ExitCode := EXIT_ERRORS;
|
47
|
+
|
48
|
+
{$IFNDEF CI}
|
49
|
+
//We don't want this happening when running under CI.
|
50
|
+
if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then
|
51
|
+
begin
|
52
|
+
System.Write('Done.. press <Enter> key to quit.');
|
53
|
+
System.Readln;
|
54
|
+
end;
|
55
|
+
{$ENDIF}
|
56
|
+
except
|
57
|
+
on E: Exception do
|
58
|
+
System.Writeln(E.ClassName, ': ', E.Message);
|
59
|
+
end;
|
60
|
+
end.
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Isogram
|
2
|
+
|
3
|
+
Determine if a word or phrase is an isogram.
|
4
|
+
|
5
|
+
An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times.
|
6
|
+
|
7
|
+
Examples of isograms:
|
8
|
+
|
9
|
+
- lumberjacks
|
10
|
+
- background
|
11
|
+
- downstream
|
12
|
+
- six-year-old
|
13
|
+
|
14
|
+
The word *isograms*, however, is not an isogram, because the s repeats.
|
15
|
+
|
16
|
+
## Testing
|
17
|
+
|
18
|
+
In order to run the tests for this track, you will need to install
|
19
|
+
DUnitX. Please see the [installation](http://www.exercism.io/languages/delphi/installation) instructions for more information.
|
20
|
+
|
21
|
+
### Loading Exercises into Delphi
|
22
|
+
|
23
|
+
If Delphi is properly installed, and `*.dpr` file types have been associated with Delphi, then double clicking the supplied `*.dpr` file will start Delphi and load the exercise/project. `control + F9` is the keyboard shortcut to compile the project or pressing `F9` will compile and run the project.
|
24
|
+
|
25
|
+
Alternatively you may opt to start Delphi and load your project via. the `File` drop down menu.
|
26
|
+
|
27
|
+
### When Questions Come Up
|
28
|
+
We monitor the [Pascal-Delphi](https://gitter.im/exercism/Pascal-Delphi) support room on [gitter.im](https://gitter.im) to help you with any questions that might arise.
|
29
|
+
|
30
|
+
### Submitting Exercises
|
31
|
+
|
32
|
+
Note that, when trying to submit an exercise, make sure the exercise file you're submitting is in the `exercism/delphi/<exerciseName>` directory.
|
33
|
+
|
34
|
+
For example, if you're submitting `ubob.pas` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/delphi/bob/ubob.pas`.
|
35
|
+
|
36
|
+
## Source
|
37
|
+
|
38
|
+
Wikipedia [https://en.wikipedia.org/wiki/Isogram](https://en.wikipedia.org/wiki/Isogram)
|
39
|
+
|
40
|
+
## Submitting Incomplete Solutions
|
41
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
unit uIsogram;
|
2
|
+
|
3
|
+
interface
|
4
|
+
uses
|
5
|
+
System.Generics.Collections;
|
6
|
+
|
7
|
+
function isIsogram(aWords: string): Boolean;
|
8
|
+
|
9
|
+
implementation
|
10
|
+
uses SysUtils;
|
11
|
+
|
12
|
+
function isIsogram(aWords: string): Boolean;
|
13
|
+
var
|
14
|
+
Letters: TList<char>;
|
15
|
+
lChar: char;
|
16
|
+
begin
|
17
|
+
Letters := TList<char>.Create;
|
18
|
+
try
|
19
|
+
aWords := aWords.ToLowerInvariant.Replace('-', '').Replace(' ','');
|
20
|
+
for lChar in aWords do
|
21
|
+
begin
|
22
|
+
if Letters.Contains(lChar) then
|
23
|
+
exit(false)
|
24
|
+
else
|
25
|
+
Letters.Add(lChar);
|
26
|
+
end;
|
27
|
+
result := true;
|
28
|
+
finally
|
29
|
+
Letters.Free;
|
30
|
+
end;
|
31
|
+
end;
|
32
|
+
|
33
|
+
end.
|
34
|
+
|
@@ -0,0 +1,104 @@
|
|
1
|
+
unit uIsogramTests;
|
2
|
+
|
3
|
+
interface
|
4
|
+
uses
|
5
|
+
DUnitX.TestFramework;
|
6
|
+
|
7
|
+
const
|
8
|
+
CanonicalVersion = '1.3.0';
|
9
|
+
|
10
|
+
type
|
11
|
+
|
12
|
+
[TestFixture]
|
13
|
+
IsogramTests = class(TObject)
|
14
|
+
public
|
15
|
+
[Test]
|
16
|
+
// [Ignore('Comment the "[Ignore]" statement to run the test')]
|
17
|
+
procedure empty_string;
|
18
|
+
|
19
|
+
[Test]
|
20
|
+
[Ignore]
|
21
|
+
procedure isogram_with_only_lower_case_characters;
|
22
|
+
|
23
|
+
[Test]
|
24
|
+
[Ignore]
|
25
|
+
procedure word_with_one_duplicated_character;
|
26
|
+
|
27
|
+
[Test]
|
28
|
+
[Ignore]
|
29
|
+
procedure longest_reported_english_isogram;
|
30
|
+
|
31
|
+
[Test]
|
32
|
+
[Ignore]
|
33
|
+
procedure word_with_duplicated_character_in_mixed_case;
|
34
|
+
|
35
|
+
[Test]
|
36
|
+
[Ignore]
|
37
|
+
procedure hypothetical_isogrammic_word_with_hyphen;
|
38
|
+
|
39
|
+
[Test]
|
40
|
+
[Ignore]
|
41
|
+
procedure isogram_with_duplicated_hyphen;
|
42
|
+
|
43
|
+
[Test]
|
44
|
+
[Ignore]
|
45
|
+
procedure made_up_name_that_is_an_isogram;
|
46
|
+
|
47
|
+
[Test]
|
48
|
+
[Ignore]
|
49
|
+
procedure duplicated_character_in_the_middle;
|
50
|
+
end;
|
51
|
+
|
52
|
+
implementation
|
53
|
+
uses SysUtils, uIsogram;
|
54
|
+
|
55
|
+
{ IsogramTests }
|
56
|
+
|
57
|
+
procedure IsogramTests.duplicated_character_in_the_middle;
|
58
|
+
begin
|
59
|
+
Assert.IsFalse(isIsogram('accentor'));
|
60
|
+
end;
|
61
|
+
|
62
|
+
procedure IsogramTests.empty_string;
|
63
|
+
begin
|
64
|
+
Assert.IsTrue(isIsogram(''));
|
65
|
+
end;
|
66
|
+
|
67
|
+
procedure IsogramTests.hypothetical_isogrammic_word_with_hyphen;
|
68
|
+
begin
|
69
|
+
Assert.IsTrue(isIsogram('thumbscrew-japingly'));
|
70
|
+
end;
|
71
|
+
|
72
|
+
procedure IsogramTests.isogram_with_duplicated_hyphen;
|
73
|
+
begin
|
74
|
+
Assert.IsTrue(isIsogram('six-year-old'));
|
75
|
+
end;
|
76
|
+
|
77
|
+
procedure IsogramTests.isogram_with_only_lower_case_characters;
|
78
|
+
begin
|
79
|
+
Assert.IsTrue(isIsogram('isogram'));
|
80
|
+
end;
|
81
|
+
|
82
|
+
procedure IsogramTests.longest_reported_english_isogram;
|
83
|
+
begin
|
84
|
+
Assert.IsTrue(isIsogram('subdermatoglyphic'));
|
85
|
+
end;
|
86
|
+
|
87
|
+
procedure IsogramTests.made_up_name_that_is_an_isogram;
|
88
|
+
begin
|
89
|
+
Assert.IsTrue(isIsogram('Emily Jung Schwartzkopf'));
|
90
|
+
end;
|
91
|
+
|
92
|
+
procedure IsogramTests.word_with_duplicated_character_in_mixed_case;
|
93
|
+
begin
|
94
|
+
Assert.IsFalse(isIsogram('Alphabet'));
|
95
|
+
end;
|
96
|
+
|
97
|
+
procedure IsogramTests.word_with_one_duplicated_character;
|
98
|
+
begin
|
99
|
+
Assert.IsFalse(isIsogram('eleven'));
|
100
|
+
end;
|
101
|
+
|
102
|
+
initialization
|
103
|
+
TDUnitX.RegisterTestFixture(IsogramTests);
|
104
|
+
end.
|
data/tracks/elm/config.json
CHANGED
data/tracks/reasonml/Makefile
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
EXERCISE ?= ""
|
2
|
-
IGNOREDIRS := "^(\.git|docs|bin|node_modules|.idea)$$"
|
2
|
+
IGNOREDIRS := "^(\.git|docs|bin|node_modules|.idea|.vscode)$$"
|
3
3
|
EXERCISES = $(shell find ./exercises -maxdepth 1 -mindepth 1 -type d | cut -d'/' -f3 | sort | grep -Ev $(IGNOREDIRS))
|
4
4
|
|
5
|
-
default:
|
5
|
+
default: copy-all-exercises
|
6
|
+
npm run build
|
7
|
+
npm run test:ci
|
6
8
|
|
7
9
|
# output directories
|
8
10
|
OUTDIR ?= "tmp"
|
data/tracks/reasonml/README.md
CHANGED
@@ -9,19 +9,17 @@ Follow the instructions under https://reasonml.github.io/docs/en/quickstart-java
|
|
9
9
|
|
10
10
|
## Contributing
|
11
11
|
|
12
|
-
|
12
|
+
We welcome all contributions, both large and small.
|
13
13
|
|
14
14
|
Please read about how to [get involved in a track](https://github.com/exercism/docs/tree/master/contributing-to-language-tracks). Be sure to read the Exercism [Code of Conduct](https://github.com/exercism/exercism.io/blob/master/CODE_OF_CONDUCT.md).
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
We encourage contributions that provide fixes and improvements to existing exercises. Please note that this track's exercises must conform to the Exercism-wide standards described in the [documentation](https://github.com/exercism/docs/tree/master/language-tracks/exercises). If you're unsure about how to make a change, then go ahead and open a GitHub issue, and we'll discuss it.
|
16
|
+
Fixes and improvements to existing exercises are welcome. Please note that this track's exercises must conform to the Exercism-wide standards described in the [documentation](https://github.com/exercism/docs/tree/master/language-tracks/exercises). If you're unsure about how to make a change, then go ahead and open a GitHub issue, and we'll discuss it.
|
19
17
|
|
20
18
|
## Exercise Tests
|
21
19
|
|
22
|
-
|
20
|
+
All Exercism exercises contain a test suite, which help to guide the user's implementation. You can read more about how we think about test suites in [the Exercism documentation](https://github.com/exercism/docs/blob/master/language-tracks/exercises/anatomy/test-suites.md).
|
23
21
|
|
24
|
-
|
22
|
+
Tests should be written using [bs-jest](https://github.com/glennsl/bs-jest).
|
25
23
|
|
26
24
|
```
|
27
25
|
open Jest;
|
@@ -45,22 +43,17 @@ If you plan to make significant or breaking changes, please open an issue so we
|
|
45
43
|
|
46
44
|
Pull requests should be focused on a single exercise, issue, or conceptually cohesive change. Please refer to Exercism's [pull request guidelines](https://github.com/exercism/docs/blob/master/contributing/pull-request-guidelines.md).
|
47
45
|
|
48
|
-
Please
|
46
|
+
Please use [refmt](https://reasonml.github.io/docs/en/extra-goodies.html) to ensure a consistent coding style.
|
47
|
+
```
|
48
|
+
refmt --in-place Example.re
|
49
|
+
```
|
49
50
|
|
50
51
|
### Verifying Your Change
|
51
52
|
|
52
53
|
Before submitting your pull request, you'll want to verify the changes in two ways:
|
53
54
|
|
54
|
-
* Run all the tests for the ReasonML exercises
|
55
|
-
* Run
|
56
|
-
|
57
|
-
All the tests for ReasonML exercises can be run from the top level of the repo with
|
58
|
-
|
59
|
-
```
|
60
|
-
# add this command
|
61
|
-
```
|
62
|
-
|
63
|
-
For the Exercism-specific linting, please see [the documentation](https://github.com/exercism/docs/blob/master/language-tracks/configuration/linting.md).
|
55
|
+
* Run all the tests for the ReasonML exercises. There is a top level Makefile, run: ```make```.
|
56
|
+
* Run checks on the repo using [configlet](https://github.com/exercism/docs/blob/master/language-tracks/configuration/configlet.md). From the top level, run: ```./bin/configlet lint --track-id reasonml .```
|
64
57
|
|
65
58
|
## Contributing a New Exercise
|
66
59
|
|
data/tracks/reasonml/config.json
CHANGED
@@ -81,104 +81,115 @@
|
|
81
81
|
]
|
82
82
|
},
|
83
83
|
{
|
84
|
-
"slug": "
|
85
|
-
"uuid": "
|
84
|
+
"slug": "raindrops",
|
85
|
+
"uuid": "d8ee28f4-bc35-408f-8380-a2eb54dec5b0",
|
86
86
|
"core": false,
|
87
87
|
"unlocked_by": null,
|
88
|
-
"difficulty":
|
88
|
+
"difficulty": 2,
|
89
89
|
"topics": [
|
90
|
-
"
|
91
|
-
"
|
90
|
+
"fun_expressions",
|
91
|
+
"list_map_function"
|
92
92
|
]
|
93
93
|
},
|
94
94
|
{
|
95
|
-
"slug": "
|
96
|
-
"uuid": "
|
95
|
+
"slug": "armstrong-numbers",
|
96
|
+
"uuid": "cc660762-4006-40c2-bc3b-a7bb4ac69202",
|
97
97
|
"core": false,
|
98
98
|
"unlocked_by": null,
|
99
99
|
"difficulty": 2,
|
100
100
|
"topics": [
|
101
|
-
"
|
102
|
-
"
|
101
|
+
"arrays",
|
102
|
+
"folding",
|
103
|
+
"algorithms",
|
104
|
+
"mathematics"
|
103
105
|
]
|
104
106
|
},
|
105
107
|
{
|
106
|
-
"slug": "
|
107
|
-
"uuid": "
|
108
|
+
"slug": "anagram",
|
109
|
+
"uuid": "1ddb534c-54e9-44a2-bd5f-fdcded7b03c8",
|
108
110
|
"core": false,
|
109
111
|
"unlocked_by": null,
|
110
112
|
"difficulty": 3,
|
111
113
|
"topics": [
|
114
|
+
"filtering",
|
112
115
|
"strings"
|
113
116
|
]
|
114
117
|
},
|
115
118
|
{
|
116
|
-
"slug": "
|
117
|
-
"uuid": "
|
119
|
+
"slug": "pangram",
|
120
|
+
"uuid": "dddf877a-a8d4-45d7-8543-882c08bad2e8",
|
118
121
|
"core": false,
|
119
122
|
"unlocked_by": null,
|
120
123
|
"difficulty": 3,
|
121
124
|
"topics": [
|
122
|
-
"
|
123
|
-
"recursion"
|
125
|
+
"strings"
|
124
126
|
]
|
125
127
|
},
|
126
128
|
{
|
127
|
-
"slug": "
|
128
|
-
"uuid": "
|
129
|
+
"slug": "isogram",
|
130
|
+
"uuid": "4e7e7b4b-b279-47c2-9d5a-3c44f7bbeb34",
|
129
131
|
"core": false,
|
130
132
|
"unlocked_by": null,
|
131
|
-
"difficulty":
|
133
|
+
"difficulty": 3,
|
132
134
|
"topics": [
|
133
135
|
"strings",
|
134
|
-
"
|
136
|
+
"lists"
|
135
137
|
]
|
136
138
|
},
|
137
139
|
{
|
138
|
-
"slug": "
|
139
|
-
"uuid": "
|
140
|
+
"slug": "phone-number",
|
141
|
+
"uuid": "2721c31b-773e-43c5-93ab-f704d62e5cde",
|
140
142
|
"core": false,
|
141
143
|
"unlocked_by": null,
|
142
|
-
"difficulty":
|
144
|
+
"difficulty": 3,
|
143
145
|
"topics": [
|
144
|
-
"
|
145
|
-
"
|
146
|
-
"dynamic_programming"
|
146
|
+
"strings",
|
147
|
+
"regular_expressions"
|
147
148
|
]
|
148
149
|
},
|
149
150
|
{
|
150
|
-
"slug": "
|
151
|
-
"uuid": "
|
151
|
+
"slug": "roman-numerals",
|
152
|
+
"uuid": "fb891c45-82f1-422d-ac4e-00409668d6a7",
|
152
153
|
"core": false,
|
153
154
|
"unlocked_by": null,
|
154
155
|
"difficulty": 3,
|
155
156
|
"topics": [
|
156
157
|
"strings",
|
157
|
-
"
|
158
|
+
"arithmetic"
|
158
159
|
]
|
159
160
|
},
|
160
161
|
{
|
161
|
-
"slug": "
|
162
|
-
"uuid": "
|
162
|
+
"slug": "binary-search",
|
163
|
+
"uuid": "eb635d37-a70b-47b2-883b-8ec9ca6098ef",
|
163
164
|
"core": false,
|
164
165
|
"unlocked_by": null,
|
165
|
-
"difficulty":
|
166
|
+
"difficulty": 4,
|
166
167
|
"topics": [
|
167
168
|
"arrays",
|
168
|
-
"
|
169
|
-
"algorithms",
|
170
|
-
"mathematics"
|
169
|
+
"recursion"
|
171
170
|
]
|
172
171
|
},
|
173
172
|
{
|
174
|
-
"slug": "
|
175
|
-
"uuid": "
|
173
|
+
"slug": "run-length-encoding",
|
174
|
+
"uuid": "1c8245de-3ae2-4b59-83a9-d34c540f67f0",
|
176
175
|
"core": false,
|
177
176
|
"unlocked_by": null,
|
178
|
-
"difficulty":
|
177
|
+
"difficulty": 5,
|
179
178
|
"topics": [
|
180
179
|
"strings",
|
181
|
-
"
|
180
|
+
"converting_strings_to_ints"
|
181
|
+
]
|
182
|
+
},
|
183
|
+
{
|
184
|
+
"slug": "change",
|
185
|
+
"uuid": "3526ae52-5962-43d6-ae83-dd6a9ca6e25b",
|
186
|
+
"core": false,
|
187
|
+
"unlocked_by": null,
|
188
|
+
"difficulty": 5,
|
189
|
+
"topics": [
|
190
|
+
"integers",
|
191
|
+
"recursion",
|
192
|
+
"dynamic_programming"
|
182
193
|
]
|
183
194
|
}
|
184
195
|
]
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Roman Numerals
|
2
|
+
|
3
|
+
Write a function to convert from normal numbers to Roman Numerals.
|
4
|
+
|
5
|
+
The Romans were a clever bunch. They conquered most of Europe and ruled
|
6
|
+
it for hundreds of years. They invented concrete and straight roads and
|
7
|
+
even bikinis. One thing they never discovered though was the number
|
8
|
+
zero. This made writing and dating extensive histories of their exploits
|
9
|
+
slightly more challenging, but the system of numbers they came up with
|
10
|
+
is still in use today. For example the BBC uses Roman numerals to date
|
11
|
+
their programmes.
|
12
|
+
|
13
|
+
The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice
|
14
|
+
these letters have lots of straight lines and are hence easy to hack
|
15
|
+
into stone tablets).
|
16
|
+
|
17
|
+
```text
|
18
|
+
1 => I
|
19
|
+
10 => X
|
20
|
+
7 => VII
|
21
|
+
```
|
22
|
+
|
23
|
+
There is no need to be able to convert numbers larger than about 3000.
|
24
|
+
(The Romans themselves didn't tend to go any higher)
|
25
|
+
|
26
|
+
Wikipedia says: Modern Roman numerals ... are written by expressing each
|
27
|
+
digit separately starting with the left most digit and skipping any
|
28
|
+
digit with a value of zero.
|
29
|
+
|
30
|
+
To see this in practice, consider the example of 1990.
|
31
|
+
|
32
|
+
In Roman numerals 1990 is MCMXC:
|
33
|
+
|
34
|
+
1000=M
|
35
|
+
900=CM
|
36
|
+
90=XC
|
37
|
+
|
38
|
+
2008 is written as MMVIII:
|
39
|
+
|
40
|
+
2000=MM
|
41
|
+
8=VIII
|
42
|
+
|
43
|
+
See also: http://www.novaroma.org/via_romana/numbers.html
|
44
|
+
|
45
|
+
## Building and testing
|
46
|
+
You will need the node package manager (npm) installed - download from [here](https://www.npmjs.com/get-npm)
|
47
|
+
There is one time setup for each exercise, which may take a few minutes:
|
48
|
+
```
|
49
|
+
npm install
|
50
|
+
```
|
51
|
+
|
52
|
+
Open two shells, and in the first, start the build process.
|
53
|
+
```
|
54
|
+
npm start
|
55
|
+
```
|
56
|
+
|
57
|
+
In the second, start the tests running.
|
58
|
+
```
|
59
|
+
npm test
|
60
|
+
```
|
61
|
+
|
62
|
+
As you edit the code, the two processes will continually rebuild and rerun the tests.
|
63
|
+
|
64
|
+
## Source
|
65
|
+
|
66
|
+
The Roman Numeral Kata [http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals](http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals)
|
67
|
+
|
68
|
+
## Submitting Incomplete Solutions
|
69
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,64 @@
|
|
1
|
+
open Jest;
|
2
|
+
open Expect;
|
3
|
+
open RomanNumerals;
|
4
|
+
|
5
|
+
describe("RomanNumerals", () => {
|
6
|
+
test("1 is a single I", () =>
|
7
|
+
expect(toRoman(1)) |> toEqual("I")
|
8
|
+
);
|
9
|
+
test("2 is two I's", () =>
|
10
|
+
expect(toRoman(2)) |> toEqual("II")
|
11
|
+
);
|
12
|
+
test("3 is three I's", () =>
|
13
|
+
expect(toRoman(3)) |> toEqual("III")
|
14
|
+
);
|
15
|
+
test("4, being 5 - 1, is IV", () =>
|
16
|
+
expect(toRoman(4)) |> toEqual("IV")
|
17
|
+
);
|
18
|
+
test("5 is a single V", () =>
|
19
|
+
expect(toRoman(5)) |> toEqual("V")
|
20
|
+
);
|
21
|
+
test("6, being 5 + 1, is VI", () =>
|
22
|
+
expect(toRoman(6)) |> toEqual("VI")
|
23
|
+
);
|
24
|
+
test("9, being 10 - 1, is IX", () =>
|
25
|
+
expect(toRoman(9)) |> toEqual("IX")
|
26
|
+
);
|
27
|
+
test("20 is two X's", () =>
|
28
|
+
expect(toRoman(27)) |> toEqual("XXVII")
|
29
|
+
);
|
30
|
+
test("48 is not 50 - 2 but rather 40 + 8", () =>
|
31
|
+
expect(toRoman(48)) |> toEqual("XLVIII")
|
32
|
+
);
|
33
|
+
test("49 is not 40 + 5 + 4 but rather 50 - 10 + 10 - 1", () =>
|
34
|
+
expect(toRoman(49)) |> toEqual("XLIX")
|
35
|
+
);
|
36
|
+
test("50 is a single L", () =>
|
37
|
+
expect(toRoman(59)) |> toEqual("LIX")
|
38
|
+
);
|
39
|
+
test("90, being 100 - 10, is XC", () =>
|
40
|
+
expect(toRoman(93)) |> toEqual("XCIII")
|
41
|
+
);
|
42
|
+
test("100 is a single C", () =>
|
43
|
+
expect(toRoman(141)) |> toEqual("CXLI")
|
44
|
+
);
|
45
|
+
test("60, being 50 + 10, is LX", () =>
|
46
|
+
expect(toRoman(163)) |> toEqual("CLXIII")
|
47
|
+
);
|
48
|
+
test("400, being 500 - 100, is CD", () =>
|
49
|
+
expect(toRoman(402)) |> toEqual("CDII")
|
50
|
+
);
|
51
|
+
test("500 is a single D", () =>
|
52
|
+
expect(toRoman(575)) |> toEqual("DLXXV")
|
53
|
+
);
|
54
|
+
test("900, being 1000 - 100, is CM", () =>
|
55
|
+
expect(toRoman(911)) |> toEqual("CMXI")
|
56
|
+
);
|
57
|
+
test("1000 is a single M", () =>
|
58
|
+
expect(toRoman(1024)) |> toEqual("MXXIV")
|
59
|
+
);
|
60
|
+
test("3000 is three M's", () =>
|
61
|
+
expect(toRoman(3000)) |> toEqual("MMM")
|
62
|
+
);
|
63
|
+
});
|
64
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// This is the configuration file used by BuckleScript's build system bsb. Its documentation lives here: http://bucklescript.github.io/bucklescript/docson/#build-schema.json
|
2
|
+
// BuckleScript comes with its own parser for bsconfig.json, which is normal JSON, with the extra support of comments and trailing commas.
|
3
|
+
{
|
4
|
+
"name": "roman-numerals",
|
5
|
+
"version": "0.1.0",
|
6
|
+
"sources": [
|
7
|
+
{
|
8
|
+
"dir" : "src",
|
9
|
+
"subdirs" : true
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"dir": "__tests__",
|
13
|
+
"type": "dev"
|
14
|
+
}
|
15
|
+
],
|
16
|
+
"package-specs": {
|
17
|
+
"module": "commonjs",
|
18
|
+
"in-source": true
|
19
|
+
},
|
20
|
+
"suffix": ".bs.js",
|
21
|
+
"bs-dependencies": [
|
22
|
+
// add your dependencies here. You'd usually install them normally through `npm install my-dependency`. If my-dependency has a bsconfig.json too, then everything will work seamlessly.
|
23
|
+
],
|
24
|
+
"bs-dev-dependencies": ["@glennsl/bs-jest"],
|
25
|
+
"warnings": {
|
26
|
+
"error" : "+101"
|
27
|
+
},
|
28
|
+
"namespace": true,
|
29
|
+
"refmt": 3
|
30
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"name": "roman-numerals",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"scripts": {
|
5
|
+
"build": "bsb -make-world",
|
6
|
+
"start": "bsb -make-world -w",
|
7
|
+
"clean": "bsb -clean-world",
|
8
|
+
"test": "jest --watchAll",
|
9
|
+
"test:ci": "jest --ci --bail --no-cache"
|
10
|
+
},
|
11
|
+
"keywords": [
|
12
|
+
"BuckleScript"
|
13
|
+
],
|
14
|
+
"author": "",
|
15
|
+
"license": "MIT",
|
16
|
+
"devDependencies": {
|
17
|
+
"@glennsl/bs-jest": "^0.4.2",
|
18
|
+
"bs-platform": "^3.1.5"
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
let toRoman = (n) => {
|
2
|
+
let rec go = (s) =>
|
3
|
+
fun
|
4
|
+
| n when n >= 1000 => go(s ++ "M", n - 1000)
|
5
|
+
| n when n >= 900 => go(s ++ "CM", n - 900)
|
6
|
+
| n when n >= 500 => go(s ++ "D", n - 500)
|
7
|
+
| n when n >= 400 => go(s ++ "CD", n - 400)
|
8
|
+
| n when n >= 100 => go(s ++ "C", n - 100)
|
9
|
+
| n when n >= 90 => go(s ++ "XC", n - 90)
|
10
|
+
| n when n >= 50 => go(s ++ "L", n - 50)
|
11
|
+
| n when n >= 40 => go(s ++ "XL", n - 40)
|
12
|
+
| n when n >= 10 => go(s ++ "X", n - 10)
|
13
|
+
| n when n == 9 => go(s ++ "IX", n - 9)
|
14
|
+
| n when n >= 5 => go(s ++ "V", n - 5)
|
15
|
+
| n when n == 4 => go(s ++ "IV", n - 4)
|
16
|
+
| n when n >= 1 => go(s ++ "I", n - 1)
|
17
|
+
| _ => s;
|
18
|
+
go("", n);
|
19
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
let toRoman: int => string;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trackler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.1.
|
4
|
+
version: 2.2.1.179
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -3666,6 +3666,10 @@ files:
|
|
3666
3666
|
- tracks/delphi/exercises/isbn-verifier/README.md
|
3667
3667
|
- tracks/delphi/exercises/isbn-verifier/uISBNVerifierExample.pas
|
3668
3668
|
- tracks/delphi/exercises/isbn-verifier/uTestISBNVerifier.pas
|
3669
|
+
- tracks/delphi/exercises/isogram/Isogram.dpr
|
3670
|
+
- tracks/delphi/exercises/isogram/README.md
|
3671
|
+
- tracks/delphi/exercises/isogram/uIsogramExample.pas
|
3672
|
+
- tracks/delphi/exercises/isogram/uIsogramTests.pas
|
3669
3673
|
- tracks/delphi/exercises/leap/Leap.dpr
|
3670
3674
|
- tracks/delphi/exercises/leap/README.md
|
3671
3675
|
- tracks/delphi/exercises/leap/uLeapExample.pas
|
@@ -12723,6 +12727,12 @@ files:
|
|
12723
12727
|
- tracks/reasonml/exercises/rna-transcription/package.json
|
12724
12728
|
- tracks/reasonml/exercises/rna-transcription/src/Example.re
|
12725
12729
|
- tracks/reasonml/exercises/rna-transcription/src/RnaTranscription.rei
|
12730
|
+
- tracks/reasonml/exercises/roman-numerals/README.md
|
12731
|
+
- tracks/reasonml/exercises/roman-numerals/__tests__/RomanNumerals_test.re
|
12732
|
+
- tracks/reasonml/exercises/roman-numerals/bsconfig.json
|
12733
|
+
- tracks/reasonml/exercises/roman-numerals/package.json
|
12734
|
+
- tracks/reasonml/exercises/roman-numerals/src/Example.re
|
12735
|
+
- tracks/reasonml/exercises/roman-numerals/src/RomanNumerals.rei
|
12726
12736
|
- tracks/reasonml/exercises/run-length-encoding/README.md
|
12727
12737
|
- tracks/reasonml/exercises/run-length-encoding/__tests__/RunLengthEncoding_test.re
|
12728
12738
|
- tracks/reasonml/exercises/run-length-encoding/bsconfig.json
|