trackler 2.2.1.55 → 2.2.1.56
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/CONTRIBUTING.md +1 -1
- data/problem-specifications/exercises/phone-number/description.md +1 -1
- data/tracks/clojure/config.json +9 -1
- data/tracks/clojure/exercises/complex-numbers/README.md +37 -0
- data/tracks/clojure/exercises/complex-numbers/project.clj +4 -0
- data/tracks/clojure/exercises/complex-numbers/src/complex_numbers.clj +17 -0
- data/tracks/clojure/exercises/complex-numbers/src/example.clj +20 -0
- data/tracks/clojure/exercises/complex-numbers/test/complex_numbers_test.clj +141 -0
- data/tracks/dart/exercises/hello-world/lib/example.dart +3 -1
- data/tracks/dart/exercises/hello-world/lib/hello_world.dart +1 -1
- data/tracks/dart/exercises/hello-world/test/hello_world_test.dart +2 -16
- data/tracks/dart/exercises/leap/test/leap_test.dart +1 -1
- data/tracks/dart/tool/create-exercise +35 -25
- data/tracks/ecmascript/config.json +13 -0
- data/tracks/ecmascript/exercises/accumulate/README.md +1 -1
- data/tracks/ecmascript/exercises/acronym/README.md +1 -1
- data/tracks/ecmascript/exercises/all-your-base/README.md +1 -1
- data/tracks/ecmascript/exercises/allergies/README.md +1 -1
- data/tracks/ecmascript/exercises/alphametics/README.md +1 -1
- data/tracks/ecmascript/exercises/anagram/README.md +1 -1
- data/tracks/ecmascript/exercises/atbash-cipher/README.md +1 -1
- data/tracks/ecmascript/exercises/beer-song/README.md +1 -1
- data/tracks/ecmascript/exercises/binary-search-tree/README.md +1 -1
- data/tracks/ecmascript/exercises/binary-search/README.md +1 -1
- data/tracks/ecmascript/exercises/binary/README.md +1 -1
- data/tracks/ecmascript/exercises/bob/README.md +1 -1
- data/tracks/ecmascript/exercises/bowling/README.md +1 -1
- data/tracks/ecmascript/exercises/bracket-push/README.md +1 -1
- data/tracks/ecmascript/exercises/change/README.md +1 -1
- data/tracks/ecmascript/exercises/circular-buffer/README.md +1 -1
- data/tracks/ecmascript/exercises/clock/README.md +1 -1
- data/tracks/ecmascript/exercises/collatz-conjecture/README.md +1 -1
- data/tracks/ecmascript/exercises/connect/README.md +1 -1
- data/tracks/ecmascript/exercises/crypto-square/README.md +1 -1
- data/tracks/ecmascript/exercises/custom-set/README.md +1 -1
- data/tracks/ecmascript/exercises/diamond/README.md +1 -1
- data/tracks/ecmascript/exercises/difference-of-squares/README.md +1 -1
- data/tracks/ecmascript/exercises/diffie-hellman/README.md +1 -1
- data/tracks/ecmascript/exercises/etl/README.md +1 -1
- data/tracks/ecmascript/exercises/flatten-array/README.md +1 -1
- data/tracks/ecmascript/exercises/food-chain/README.md +1 -1
- data/tracks/ecmascript/exercises/gigasecond/README.md +1 -1
- data/tracks/ecmascript/exercises/grade-school/README.md +1 -1
- data/tracks/ecmascript/exercises/grains/README.md +1 -1
- data/tracks/ecmascript/exercises/hamming/README.md +1 -1
- data/tracks/ecmascript/exercises/hello-world/README.md +1 -1
- data/tracks/ecmascript/exercises/hexadecimal/README.md +1 -1
- data/tracks/ecmascript/exercises/isbn-verifier/README.md +1 -1
- data/tracks/ecmascript/exercises/isogram/README.md +1 -1
- data/tracks/ecmascript/exercises/kindergarten-garden/README.md +1 -1
- data/tracks/ecmascript/exercises/largest-series-product/README.md +1 -1
- data/tracks/ecmascript/exercises/leap/README.md +1 -1
- data/tracks/ecmascript/exercises/linked-list/README.md +1 -1
- data/tracks/ecmascript/exercises/list-ops/README.md +1 -1
- data/tracks/ecmascript/exercises/luhn/README.md +1 -1
- data/tracks/ecmascript/exercises/matrix/README.md +1 -1
- data/tracks/ecmascript/exercises/meetup/README.md +1 -1
- data/tracks/ecmascript/exercises/minesweeper/README.md +1 -1
- data/tracks/ecmascript/exercises/nth-prime/README.md +1 -1
- data/tracks/ecmascript/exercises/ocr-numbers/README.md +1 -1
- data/tracks/ecmascript/exercises/octal/README.md +1 -1
- data/tracks/ecmascript/exercises/palindrome-products/README.md +1 -1
- data/tracks/ecmascript/exercises/pangram/README.md +1 -1
- data/tracks/ecmascript/exercises/pascals-triangle/README.md +1 -1
- data/tracks/ecmascript/exercises/perfect-numbers/README.md +1 -1
- data/tracks/ecmascript/exercises/phone-number/README.md +1 -1
- data/tracks/ecmascript/exercises/pig-latin/README.md +1 -1
- data/tracks/ecmascript/exercises/prime-factors/README.md +1 -1
- data/tracks/ecmascript/exercises/protein-translation/README.md +78 -0
- data/tracks/ecmascript/exercises/protein-translation/example.js +45 -0
- data/tracks/ecmascript/exercises/protein-translation/package.json +71 -0
- data/tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js +59 -0
- data/tracks/ecmascript/exercises/proverb/README.md +1 -1
- data/tracks/ecmascript/exercises/pythagorean-triplet/README.md +1 -1
- data/tracks/ecmascript/exercises/queen-attack/README.md +1 -1
- data/tracks/ecmascript/exercises/raindrops/README.md +1 -1
- data/tracks/ecmascript/exercises/rna-transcription/README.md +1 -1
- data/tracks/ecmascript/exercises/robot-name/README.md +1 -1
- data/tracks/ecmascript/exercises/robot-simulator/README.md +1 -1
- data/tracks/ecmascript/exercises/roman-numerals/README.md +1 -1
- data/tracks/ecmascript/exercises/run-length-encoding/README.md +1 -1
- data/tracks/ecmascript/exercises/saddle-points/README.md +1 -1
- data/tracks/ecmascript/exercises/say/README.md +1 -1
- data/tracks/ecmascript/exercises/scrabble-score/README.md +1 -1
- data/tracks/ecmascript/exercises/secret-handshake/README.md +1 -1
- data/tracks/ecmascript/exercises/series/README.md +1 -1
- data/tracks/ecmascript/exercises/sieve/README.md +1 -1
- data/tracks/ecmascript/exercises/simple-cipher/README.md +1 -1
- data/tracks/ecmascript/exercises/simple-linked-list/README.md +1 -1
- data/tracks/ecmascript/exercises/space-age/README.md +1 -1
- data/tracks/ecmascript/exercises/strain/README.md +1 -1
- data/tracks/ecmascript/exercises/sublist/README.md +1 -1
- data/tracks/ecmascript/exercises/sum-of-multiples/README.md +1 -1
- data/tracks/ecmascript/exercises/transpose/README.md +1 -1
- data/tracks/ecmascript/exercises/triangle/README.md +1 -1
- data/tracks/ecmascript/exercises/trinary/README.md +1 -1
- data/tracks/ecmascript/exercises/twelve-days/README.md +1 -1
- data/tracks/ecmascript/exercises/two-bucket/README.md +1 -1
- data/tracks/ecmascript/exercises/two-fer/README.md +1 -1
- data/tracks/ecmascript/exercises/word-count/README.md +1 -1
- data/tracks/ecmascript/exercises/word-search/README.md +1 -1
- data/tracks/ecmascript/exercises/wordy/README.md +1 -1
- data/tracks/erlang/exercises/bob/src/bob.erl +4 -4
- data/tracks/erlang/exercises/bob/src/example.erl +30 -15
- data/tracks/erlang/exercises/bob/test/bob_tests.erl +84 -45
- data/tracks/erlang/exercises/collatz-conjecture/test/collatz_conjecture_tests.erl +2 -0
- data/tracks/erlang/exercises/hamming/src/example.erl +10 -10
- data/tracks/erlang/exercises/hamming/src/hamming.erl +4 -4
- data/tracks/erlang/exercises/hamming/test/hamming_tests.erl +54 -13
- data/tracks/erlang/exercises/hello-world/test/hello_world_tests.erl +2 -0
- data/tracks/erlang/exercises/leap/test/leap_tests.erl +2 -0
- data/tracks/erlang/exercises/rna-transcription/src/example.erl +6 -2
- data/tracks/erlang/exercises/rna-transcription/src/rna_transcription.erl +3 -3
- data/tracks/erlang/exercises/rna-transcription/test/rna_transcription_tests.erl +24 -14
- data/tracks/erlang/testgen/src/tgen.erl +1 -0
- data/tracks/erlang/testgen/src/tgen_bob.erl +29 -0
- data/tracks/erlang/testgen/src/tgen_hamming.erl +41 -0
- data/tracks/erlang/testgen/src/tgen_rna-transcription.erl +38 -0
- data/tracks/fsharp/exercises/etl/Etl.fs +2 -2
- data/tracks/fsharp/exercises/etl/EtlTest.fs +72 -29
- data/tracks/fsharp/exercises/etl/Example.fs +10 -5
- data/tracks/fsharp/exercises/nth-prime/NthPrimeTest.fs +1 -1
- data/tracks/fsharp/exercises/nucleotide-count/Example.fs +7 -3
- data/tracks/fsharp/exercises/nucleotide-count/NucleotideCount.fs +1 -3
- data/tracks/fsharp/exercises/nucleotide-count/NucleotideCountTest.fs +51 -33
- data/tracks/fsharp/generators/Generators.fs +48 -2
- data/tracks/gnu-apl/README.md +49 -14
- data/tracks/python/exercises/flatten-array/flatten_array_test.py +18 -11
- data/tracks/python/exercises/pig-latin/example.py +2 -1
- data/tracks/python/exercises/pig-latin/pig_latin_test.py +10 -4
- metadata +14 -2
@@ -1,45 +1,63 @@
|
|
1
|
-
|
1
|
+
// This file was auto-generated based on version 1.2.0 of the canonical data.
|
2
|
+
|
3
|
+
module NucleotideCountTest
|
2
4
|
|
3
|
-
open Xunit
|
4
5
|
open FsUnit.Xunit
|
5
|
-
open
|
6
|
+
open Xunit
|
6
7
|
|
7
|
-
open
|
8
|
+
open NucleotideCount
|
8
9
|
|
9
10
|
[<Fact>]
|
10
|
-
let ``
|
11
|
+
let ``Empty strand`` () =
|
11
12
|
let strand = ""
|
12
|
-
let expected =
|
13
|
+
let expected =
|
14
|
+
[ ('A', 0)
|
15
|
+
('C', 0)
|
16
|
+
('G', 0)
|
17
|
+
('T', 0) ]
|
18
|
+
|> Map.ofList
|
19
|
+
|> Some
|
13
20
|
nucleotideCounts strand |> should equal expected
|
14
|
-
|
15
|
-
[<Fact(Skip = "Remove to run test")>]
|
16
|
-
let ``Has no adenosine`` () =
|
17
|
-
let strand = ""
|
18
|
-
count 'A' strand |> should equal 0
|
19
|
-
|
20
|
-
[<Fact(Skip = "Remove to run test")>]
|
21
|
-
let ``Repetitive cytidine gets counts`` () =
|
22
|
-
let strand = "CCCCC"
|
23
|
-
count 'C' strand |> should equal 5
|
24
|
-
|
21
|
+
|
25
22
|
[<Fact(Skip = "Remove to run test")>]
|
26
|
-
let ``
|
27
|
-
let strand = "
|
28
|
-
let expected =
|
23
|
+
let ``Can count one nucleotide in single-character input`` () =
|
24
|
+
let strand = "G"
|
25
|
+
let expected =
|
26
|
+
[ ('A', 0)
|
27
|
+
('C', 0)
|
28
|
+
('G', 1)
|
29
|
+
('T', 0) ]
|
30
|
+
|> Map.ofList
|
31
|
+
|> Some
|
29
32
|
nucleotideCounts strand |> should equal expected
|
30
|
-
|
31
|
-
[<Fact(Skip = "Remove to run test")>]
|
32
|
-
let ``Counts only thymidine`` () =
|
33
|
-
let strand = "GGGGTAACCCGG"
|
34
|
-
count 'T' strand |> should equal 1
|
35
|
-
|
33
|
+
|
36
34
|
[<Fact(Skip = "Remove to run test")>]
|
37
|
-
let ``
|
38
|
-
let strand = "
|
39
|
-
|
40
|
-
|
35
|
+
let ``Strand with repeated nucleotide`` () =
|
36
|
+
let strand = "GGGGGGG"
|
37
|
+
let expected =
|
38
|
+
[ ('A', 0)
|
39
|
+
('C', 0)
|
40
|
+
('G', 7)
|
41
|
+
('T', 0) ]
|
42
|
+
|> Map.ofList
|
43
|
+
|> Some
|
44
|
+
nucleotideCounts strand |> should equal expected
|
45
|
+
|
41
46
|
[<Fact(Skip = "Remove to run test")>]
|
42
|
-
let ``
|
47
|
+
let ``Strand with multiple nucleotides`` () =
|
43
48
|
let strand = "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"
|
44
|
-
let expected =
|
45
|
-
|
49
|
+
let expected =
|
50
|
+
[ ('A', 20)
|
51
|
+
('C', 12)
|
52
|
+
('G', 17)
|
53
|
+
('T', 21) ]
|
54
|
+
|> Map.ofList
|
55
|
+
|> Some
|
56
|
+
nucleotideCounts strand |> should equal expected
|
57
|
+
|
58
|
+
[<Fact(Skip = "Remove to run test")>]
|
59
|
+
let ``Strand with invalid nucleotides`` () =
|
60
|
+
let strand = "AGXXACT"
|
61
|
+
let expected = None
|
62
|
+
nucleotideCounts strand |> should equal expected
|
63
|
+
|
@@ -201,6 +201,28 @@ type Dominoes() =
|
|
201
201
|
|
202
202
|
override this.PropertiesWithIdentifier canonicalDataCase = this.PropertiesUsedAsSutParameter canonicalDataCase
|
203
203
|
|
204
|
+
type Etl() =
|
205
|
+
inherit Exercise()
|
206
|
+
|
207
|
+
member this.formatMap<'TKey, 'TValue> (value: obj) =
|
208
|
+
let input = value :?> JObject
|
209
|
+
let dict = input.ToObject<Collections.Generic.Dictionary<'TKey, 'TValue>>();
|
210
|
+
let formattedList =
|
211
|
+
dict
|
212
|
+
|> Seq.map (fun kv -> formatTuple (kv.Key, kv.Value))
|
213
|
+
|> formatMultiLineList
|
214
|
+
|
215
|
+
if (formattedList.Contains("\n")) then
|
216
|
+
sprintf "%s\n%s" formattedList (indent 2 "|> Map.ofList")
|
217
|
+
else
|
218
|
+
sprintf "%s |> Map.ofList" formattedList
|
219
|
+
|
220
|
+
override this.RenderInput (canonicalDataCase, key, value) = this.formatMap<int, List<char>> value
|
221
|
+
|
222
|
+
override this.RenderExpected (canonicalDataCase, key, value) = this.formatMap<char, int> value
|
223
|
+
|
224
|
+
override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
|
225
|
+
|
204
226
|
type FoodChain() =
|
205
227
|
inherit Exercise()
|
206
228
|
|
@@ -356,11 +378,35 @@ type NthPrime() =
|
|
356
378
|
inherit Exercise()
|
357
379
|
|
358
380
|
override this.RenderExpected (canonicalDataCase, key, value) =
|
359
|
-
value
|
360
|
-
|> Option.
|
381
|
+
value
|
382
|
+
|> Option.ofNonError
|
361
383
|
|> formatValue
|
362
384
|
|> parenthesizeOption
|
363
385
|
|
386
|
+
type NucleotideCount() =
|
387
|
+
inherit Exercise()
|
388
|
+
|
389
|
+
member this.formatMap<'TKey, 'TValue> (value: obj) =
|
390
|
+
match Option.ofNonError value with
|
391
|
+
| None ->
|
392
|
+
"None"
|
393
|
+
| _ ->
|
394
|
+
let input = value :?> JObject
|
395
|
+
let dict = input.ToObject<Collections.Generic.Dictionary<'TKey, 'TValue>>();
|
396
|
+
let formattedList =
|
397
|
+
dict
|
398
|
+
|> Seq.map (fun kv -> formatTuple (kv.Key, kv.Value))
|
399
|
+
|> formatMultiLineList
|
400
|
+
|
401
|
+
if (formattedList.Contains("\n")) then
|
402
|
+
sprintf "%s\n%s\n%s" formattedList (indent 2 "|> Map.ofList") (indent 2 "|> Some")
|
403
|
+
else
|
404
|
+
sprintf "%s |> Map.ofList |> Some" formattedList
|
405
|
+
|
406
|
+
override this.RenderExpected (canonicalDataCase, key, value) = this.formatMap<char, int> value
|
407
|
+
|
408
|
+
override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
|
409
|
+
|
364
410
|
type OcrNumbers() =
|
365
411
|
inherit Exercise()
|
366
412
|
|
data/tracks/gnu-apl/README.md
CHANGED
@@ -6,7 +6,16 @@ Exercism exercises in GNU APL.
|
|
6
6
|
|
7
7
|
## Setup
|
8
8
|
|
9
|
-
|
9
|
+
### Installing GNU APL
|
10
|
+
|
11
|
+
On MacOS, GNU APL is available as a [Homebrew](http://brew.sh) formula; just type `brew install gnu-apl` to install it.
|
12
|
+
|
13
|
+
On other operating systems, the simplest way to install GNU APL is probably to follow the instructions on the [GNU APL website](https://www.gnu.org/software/apl/). Note that version 1.7 seems to have build issues on some systems; if you can't build 1.7, then 1.6 should work.
|
14
|
+
|
15
|
+
### Installing a keyboard layout
|
16
|
+
|
17
|
+
APL uses many symbols that don't appear on most keyboard layouts, so you'll probably want to install an APL keyboard layout. The [keyboard layouts from Dyalog](https://www.dyalog.com/apl-font-keyboard.htm) seem to work well, and are available for free download for all modern operating systems. The same page also has links to fonts optimized for APL code (and even ordering information for physical keyboards with APL symbols on them).
|
18
|
+
|
10
19
|
|
11
20
|
## Contributing
|
12
21
|
|
@@ -22,12 +31,32 @@ We encourage contributions that provide fixes and improvements to existing exerc
|
|
22
31
|
|
23
32
|
At the most basic level, Exercism is all about the tests. 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).
|
24
33
|
|
25
|
-
|
34
|
+
We are currently using GNU APL's testing framework, with some extra tooling found in the test.apl file at the root of the track. So test files should be called `<exercise-name>.tc`, and should be in the following format. (`⍝` indicates comments that should be in the actual test file; `#` are explanatory comments for the purposes of this README.)
|
26
35
|
|
27
|
-
```
|
28
|
-
|
36
|
+
```apl
|
37
|
+
log←'./<exercise-name>.tc.log'
|
38
|
+
⍎ ')COPY ',(⎕FIO 30),'/../../test.apl'
|
39
|
+
|
40
|
+
test∆copy_relative '<exercise-name>.apl'
|
41
|
+
test∆clear_log log
|
42
|
+
|
43
|
+
# The preceding lines are boilerplate, and must be in every test file (sorry about that!). The actual test code follows.
|
44
|
+
|
45
|
+
⍝ ∇greet # Name of function being tested; not mandatory, but nice.
|
46
|
+
|
47
|
+
⍝ it returns a greeting to the supplied name # description of test case
|
48
|
+
1⎕CR greet 'Chris' # APL code to execute; 1⎕CR quotes strings and does other nice things
|
49
|
+
'Hello, Chris!' # exact expected output
|
50
|
+
|
51
|
+
⍝ when left argument is supplied, uses it instead of 'Hello' # another test case
|
52
|
+
1⎕CR 'Good morning' greet 'Sandy'
|
53
|
+
'Good morning, Sandy!'
|
54
|
+
|
55
|
+
test∆show_log log # this must be at the end of the file so that the test results get displayed to STDERR
|
29
56
|
```
|
30
57
|
|
58
|
+
When in doubt, copy the format of the existing test files, or otherwise do what seems sensible.
|
59
|
+
|
31
60
|
## Opening an Issue
|
32
61
|
|
33
62
|
If you plan to make significant or breaking changes, please open an issue so we can discuss it first. If this is a discussion that is relevant to more than just the GNU APL track, please open an issue in [exercism/discussions](https://github.com/exercism/discussions/issues).
|
@@ -36,8 +65,6 @@ If you plan to make significant or breaking changes, please open an issue so we
|
|
36
65
|
|
37
66
|
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).
|
38
67
|
|
39
|
-
Please follow the coding standards for GNU APL. (If there is a formatter for the track's language, add instructions for using it here.)
|
40
|
-
|
41
68
|
### Verifying Your Change
|
42
69
|
|
43
70
|
Before submitting your pull request, you'll want to verify the changes in two ways:
|
@@ -48,20 +75,28 @@ Before submitting your pull request, you'll want to verify the changes in two wa
|
|
48
75
|
All the tests for GNU APL exercises can be run from the top level of the repo with
|
49
76
|
|
50
77
|
```
|
51
|
-
|
78
|
+
bin/run-all-tests
|
52
79
|
```
|
53
80
|
|
54
|
-
For the Exercism-specific linting, please see [the documentation](https://github.com/exercism/docs/blob/
|
81
|
+
For the Exercism-specific linting, please see [the documentation](https://github.com/exercism/docs/blob/a8ea5db92e2a2d2839e66ec10c7687b3b7db002a/language-tracks/configuration/configlet.md).
|
55
82
|
|
56
83
|
## Contributing a New Exercise
|
57
84
|
|
58
85
|
Please see the documentation about [adding new exercises](https://github.com/exercism/docs/blob/master/you-can-help/make-up-new-exercises.md).
|
59
86
|
|
60
|
-
|
87
|
+
Useful notes:
|
61
88
|
|
62
|
-
- Each exercise must stand on its own. Do not reference files outside the exercise directory. They will not be included when the user fetches the exercise.
|
63
|
-
- Exercises should use only the GNU APL core
|
89
|
+
- Each exercise must stand on its own. Do not reference files outside the exercise directory (except for the supplied test.apl). They will not be included when the user fetches the exercise.
|
90
|
+
- Exercises should use only the GNU APL core language. If it is feasible, they should be portable to other APL interpreters too (such as Dyalog). This shouldn't be hard in most cases, since GNU APL adheres closely to the ISO 13751 standard.
|
64
91
|
- Exercises must conform to the Exercism-wide standards described in [the documentation](https://github.com/exercism/docs/tree/master/language-tracks/exercises).
|
65
|
-
- Each exercise should have a test suite, an example solution, a template file for the real implementation
|
66
|
-
-
|
67
|
-
-
|
92
|
+
- Each exercise should have a test suite, an example solution, a README (generated by Configlet), and a template file for the real implementation (optional). The CI build expects files to be named using the following convention (where `<exercise-name>` is the slug as it appears in the config file):
|
93
|
+
- `<exercise-name>/`
|
94
|
+
- `README.md`
|
95
|
+
- `<exercise-name>.tc` (test suite)
|
96
|
+
- `<exercise-name>-example.apl` (example solution)
|
97
|
+
- `<exercise-name>.apl` (optional template)
|
98
|
+
- Make sure your example file (and template, if you have one) has an initial `#!` (shebang) line; GNU APL doesn't seem to like to execute files without it when they're loaded from the command line. We recommend something like the following:
|
99
|
+
```apl
|
100
|
+
#!/usr/bin/env apl --script
|
101
|
+
```
|
102
|
+
- Be sure to add the exercise to the appropriate place in the `config.json` file.
|
@@ -3,23 +3,21 @@ import unittest
|
|
3
3
|
from flatten_array import flatten
|
4
4
|
|
5
5
|
|
6
|
+
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0
|
7
|
+
|
6
8
|
class FlattenArrayTests(unittest.TestCase):
|
7
9
|
|
8
10
|
def test_no_nesting(self):
|
9
11
|
self.assertEqual(flatten([0, 1, 2]), [0, 1, 2])
|
10
12
|
|
11
|
-
def
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
self.assertEqual(flatten([0, [1, [2, 3]], [4]]), [0, 1, 2, 3, 4])
|
16
|
-
|
17
|
-
def test_empty_nested_lists(self):
|
18
|
-
self.assertEqual(flatten([[()]]), [])
|
13
|
+
def test_flatten_integers(self):
|
14
|
+
inputs = [1, [2, 3, 4, 5, 6, 7], 8]
|
15
|
+
expected = [1, 2, 3, 4, 5, 6, 7, 8]
|
16
|
+
self.assertEqual(flatten(inputs), expected)
|
19
17
|
|
20
|
-
def
|
21
|
-
inputs = [0, 2, [[2, 3], 8,
|
22
|
-
expected = [0, 2, 2, 3, 8, 100, -2]
|
18
|
+
def test_five_level_nesting(self):
|
19
|
+
inputs = [0, 2, [[2, 3], 8, 100, 4, [[[50]]]], -2]
|
20
|
+
expected = [0, 2, 2, 3, 8, 100, 4, 50, -2]
|
23
21
|
self.assertEqual(flatten(inputs), expected)
|
24
22
|
|
25
23
|
def test_six_level_nesting(self):
|
@@ -27,11 +25,20 @@ class FlattenArrayTests(unittest.TestCase):
|
|
27
25
|
expected = [1, 2, 3, 4, 5, 6, 7, 8]
|
28
26
|
self.assertEqual(flatten(inputs), expected)
|
29
27
|
|
28
|
+
def test_with_none_values(self):
|
29
|
+
inputs = [0, 2, [[2, 3], 8, [[100]], None, [[None]]], -2]
|
30
|
+
expected = [0, 2, 2, 3, 8, 100, -2]
|
31
|
+
self.assertEqual(flatten(inputs), expected)
|
32
|
+
|
30
33
|
def test_all_values_are_none(self):
|
31
34
|
inputs = [None, [[[None]]], None, None, [[None, None], None], None]
|
32
35
|
expected = []
|
33
36
|
self.assertEqual(flatten(inputs), expected)
|
34
37
|
|
38
|
+
# Additional tests for this track
|
39
|
+
def test_empty_nested_lists(self):
|
40
|
+
self.assertEqual(flatten([[()]]), [])
|
41
|
+
|
35
42
|
def test_strings(self):
|
36
43
|
self.assertEqual(flatten(['0', ['1', '2']]), ['0', '1', '2'])
|
37
44
|
|
@@ -3,7 +3,7 @@ import unittest
|
|
3
3
|
from pig_latin import translate
|
4
4
|
|
5
5
|
|
6
|
-
#
|
6
|
+
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.1.0
|
7
7
|
|
8
8
|
class PigLatinTests(unittest.TestCase):
|
9
9
|
def test_word_beginning_with_a(self):
|
@@ -30,9 +30,6 @@ class PigLatinTests(unittest.TestCase):
|
|
30
30
|
def test_word_beginning_with_k(self):
|
31
31
|
self.assertEqual(translate("koala"), "oalakay")
|
32
32
|
|
33
|
-
def test_word_beginning_with_y(self):
|
34
|
-
self.assertEqual(translate("yellow"), "ellowyay")
|
35
|
-
|
36
33
|
def test_word_beginning_with_x(self):
|
37
34
|
self.assertEqual(translate("xenon"), "enonxay")
|
38
35
|
|
@@ -63,6 +60,15 @@ class PigLatinTests(unittest.TestCase):
|
|
63
60
|
def test_word_beginning_with_xr(self):
|
64
61
|
self.assertEqual(translate("xray"), "xrayay")
|
65
62
|
|
63
|
+
def test_y_is_treated_like_a_consonant_at_the_beginning_of_a_word(self):
|
64
|
+
self.assertEqual(translate("yellow"), "ellowyay")
|
65
|
+
|
66
|
+
def test_y_is_treated_like_a_vowel_at_the_end_of_a_consonant_cluster(self):
|
67
|
+
self.assertEqual(translate("rhythm"), "ythmrhay")
|
68
|
+
|
69
|
+
def test_y_as_second_letter_in_two_letter_word(self):
|
70
|
+
self.assertEqual(translate("my"), "ymay")
|
71
|
+
|
66
72
|
def test_a_whole_phrase(self):
|
67
73
|
self.assertEqual(translate("quick fast run"), "ickquay astfay unray")
|
68
74
|
|
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.56
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -1420,6 +1420,11 @@ files:
|
|
1420
1420
|
- tracks/clojure/exercises/collatz-conjecture/src/collatz_conjecture.clj
|
1421
1421
|
- tracks/clojure/exercises/collatz-conjecture/src/example.clj
|
1422
1422
|
- tracks/clojure/exercises/collatz-conjecture/test/collatz_conjecture_test.clj
|
1423
|
+
- tracks/clojure/exercises/complex-numbers/README.md
|
1424
|
+
- tracks/clojure/exercises/complex-numbers/project.clj
|
1425
|
+
- tracks/clojure/exercises/complex-numbers/src/complex_numbers.clj
|
1426
|
+
- tracks/clojure/exercises/complex-numbers/src/example.clj
|
1427
|
+
- tracks/clojure/exercises/complex-numbers/test/complex_numbers_test.clj
|
1423
1428
|
- tracks/clojure/exercises/crypto-square/README.md
|
1424
1429
|
- tracks/clojure/exercises/crypto-square/project.clj
|
1425
1430
|
- tracks/clojure/exercises/crypto-square/src/example.clj
|
@@ -3524,6 +3529,10 @@ files:
|
|
3524
3529
|
- tracks/ecmascript/exercises/prime-factors/example.js
|
3525
3530
|
- tracks/ecmascript/exercises/prime-factors/package.json
|
3526
3531
|
- tracks/ecmascript/exercises/prime-factors/prime-factors.spec.js
|
3532
|
+
- tracks/ecmascript/exercises/protein-translation/README.md
|
3533
|
+
- tracks/ecmascript/exercises/protein-translation/example.js
|
3534
|
+
- tracks/ecmascript/exercises/protein-translation/package.json
|
3535
|
+
- tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
|
3527
3536
|
- tracks/ecmascript/exercises/proverb/README.md
|
3528
3537
|
- tracks/ecmascript/exercises/proverb/example.js
|
3529
3538
|
- tracks/ecmascript/exercises/proverb/package.json
|
@@ -4717,9 +4726,12 @@ files:
|
|
4717
4726
|
- tracks/erlang/testgen/src/tg_file_tools.erl
|
4718
4727
|
- tracks/erlang/testgen/src/tg_git_tools.erl
|
4719
4728
|
- tracks/erlang/testgen/src/tgen.erl
|
4729
|
+
- tracks/erlang/testgen/src/tgen_bob.erl
|
4720
4730
|
- tracks/erlang/testgen/src/tgen_collatz-conjecture.erl
|
4731
|
+
- tracks/erlang/testgen/src/tgen_hamming.erl
|
4721
4732
|
- tracks/erlang/testgen/src/tgen_hello-world.erl
|
4722
4733
|
- tracks/erlang/testgen/src/tgen_leap.erl
|
4734
|
+
- tracks/erlang/testgen/src/tgen_rna-transcription.erl
|
4723
4735
|
- tracks/erlang/testgen/src/tgs.erl
|
4724
4736
|
- tracks/factor/.git
|
4725
4737
|
- tracks/factor/.gitignore
|