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.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/CONTRIBUTING.md +1 -1
  4. data/problem-specifications/exercises/phone-number/description.md +1 -1
  5. data/tracks/clojure/config.json +9 -1
  6. data/tracks/clojure/exercises/complex-numbers/README.md +37 -0
  7. data/tracks/clojure/exercises/complex-numbers/project.clj +4 -0
  8. data/tracks/clojure/exercises/complex-numbers/src/complex_numbers.clj +17 -0
  9. data/tracks/clojure/exercises/complex-numbers/src/example.clj +20 -0
  10. data/tracks/clojure/exercises/complex-numbers/test/complex_numbers_test.clj +141 -0
  11. data/tracks/dart/exercises/hello-world/lib/example.dart +3 -1
  12. data/tracks/dart/exercises/hello-world/lib/hello_world.dart +1 -1
  13. data/tracks/dart/exercises/hello-world/test/hello_world_test.dart +2 -16
  14. data/tracks/dart/exercises/leap/test/leap_test.dart +1 -1
  15. data/tracks/dart/tool/create-exercise +35 -25
  16. data/tracks/ecmascript/config.json +13 -0
  17. data/tracks/ecmascript/exercises/accumulate/README.md +1 -1
  18. data/tracks/ecmascript/exercises/acronym/README.md +1 -1
  19. data/tracks/ecmascript/exercises/all-your-base/README.md +1 -1
  20. data/tracks/ecmascript/exercises/allergies/README.md +1 -1
  21. data/tracks/ecmascript/exercises/alphametics/README.md +1 -1
  22. data/tracks/ecmascript/exercises/anagram/README.md +1 -1
  23. data/tracks/ecmascript/exercises/atbash-cipher/README.md +1 -1
  24. data/tracks/ecmascript/exercises/beer-song/README.md +1 -1
  25. data/tracks/ecmascript/exercises/binary-search-tree/README.md +1 -1
  26. data/tracks/ecmascript/exercises/binary-search/README.md +1 -1
  27. data/tracks/ecmascript/exercises/binary/README.md +1 -1
  28. data/tracks/ecmascript/exercises/bob/README.md +1 -1
  29. data/tracks/ecmascript/exercises/bowling/README.md +1 -1
  30. data/tracks/ecmascript/exercises/bracket-push/README.md +1 -1
  31. data/tracks/ecmascript/exercises/change/README.md +1 -1
  32. data/tracks/ecmascript/exercises/circular-buffer/README.md +1 -1
  33. data/tracks/ecmascript/exercises/clock/README.md +1 -1
  34. data/tracks/ecmascript/exercises/collatz-conjecture/README.md +1 -1
  35. data/tracks/ecmascript/exercises/connect/README.md +1 -1
  36. data/tracks/ecmascript/exercises/crypto-square/README.md +1 -1
  37. data/tracks/ecmascript/exercises/custom-set/README.md +1 -1
  38. data/tracks/ecmascript/exercises/diamond/README.md +1 -1
  39. data/tracks/ecmascript/exercises/difference-of-squares/README.md +1 -1
  40. data/tracks/ecmascript/exercises/diffie-hellman/README.md +1 -1
  41. data/tracks/ecmascript/exercises/etl/README.md +1 -1
  42. data/tracks/ecmascript/exercises/flatten-array/README.md +1 -1
  43. data/tracks/ecmascript/exercises/food-chain/README.md +1 -1
  44. data/tracks/ecmascript/exercises/gigasecond/README.md +1 -1
  45. data/tracks/ecmascript/exercises/grade-school/README.md +1 -1
  46. data/tracks/ecmascript/exercises/grains/README.md +1 -1
  47. data/tracks/ecmascript/exercises/hamming/README.md +1 -1
  48. data/tracks/ecmascript/exercises/hello-world/README.md +1 -1
  49. data/tracks/ecmascript/exercises/hexadecimal/README.md +1 -1
  50. data/tracks/ecmascript/exercises/isbn-verifier/README.md +1 -1
  51. data/tracks/ecmascript/exercises/isogram/README.md +1 -1
  52. data/tracks/ecmascript/exercises/kindergarten-garden/README.md +1 -1
  53. data/tracks/ecmascript/exercises/largest-series-product/README.md +1 -1
  54. data/tracks/ecmascript/exercises/leap/README.md +1 -1
  55. data/tracks/ecmascript/exercises/linked-list/README.md +1 -1
  56. data/tracks/ecmascript/exercises/list-ops/README.md +1 -1
  57. data/tracks/ecmascript/exercises/luhn/README.md +1 -1
  58. data/tracks/ecmascript/exercises/matrix/README.md +1 -1
  59. data/tracks/ecmascript/exercises/meetup/README.md +1 -1
  60. data/tracks/ecmascript/exercises/minesweeper/README.md +1 -1
  61. data/tracks/ecmascript/exercises/nth-prime/README.md +1 -1
  62. data/tracks/ecmascript/exercises/ocr-numbers/README.md +1 -1
  63. data/tracks/ecmascript/exercises/octal/README.md +1 -1
  64. data/tracks/ecmascript/exercises/palindrome-products/README.md +1 -1
  65. data/tracks/ecmascript/exercises/pangram/README.md +1 -1
  66. data/tracks/ecmascript/exercises/pascals-triangle/README.md +1 -1
  67. data/tracks/ecmascript/exercises/perfect-numbers/README.md +1 -1
  68. data/tracks/ecmascript/exercises/phone-number/README.md +1 -1
  69. data/tracks/ecmascript/exercises/pig-latin/README.md +1 -1
  70. data/tracks/ecmascript/exercises/prime-factors/README.md +1 -1
  71. data/tracks/ecmascript/exercises/protein-translation/README.md +78 -0
  72. data/tracks/ecmascript/exercises/protein-translation/example.js +45 -0
  73. data/tracks/ecmascript/exercises/protein-translation/package.json +71 -0
  74. data/tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js +59 -0
  75. data/tracks/ecmascript/exercises/proverb/README.md +1 -1
  76. data/tracks/ecmascript/exercises/pythagorean-triplet/README.md +1 -1
  77. data/tracks/ecmascript/exercises/queen-attack/README.md +1 -1
  78. data/tracks/ecmascript/exercises/raindrops/README.md +1 -1
  79. data/tracks/ecmascript/exercises/rna-transcription/README.md +1 -1
  80. data/tracks/ecmascript/exercises/robot-name/README.md +1 -1
  81. data/tracks/ecmascript/exercises/robot-simulator/README.md +1 -1
  82. data/tracks/ecmascript/exercises/roman-numerals/README.md +1 -1
  83. data/tracks/ecmascript/exercises/run-length-encoding/README.md +1 -1
  84. data/tracks/ecmascript/exercises/saddle-points/README.md +1 -1
  85. data/tracks/ecmascript/exercises/say/README.md +1 -1
  86. data/tracks/ecmascript/exercises/scrabble-score/README.md +1 -1
  87. data/tracks/ecmascript/exercises/secret-handshake/README.md +1 -1
  88. data/tracks/ecmascript/exercises/series/README.md +1 -1
  89. data/tracks/ecmascript/exercises/sieve/README.md +1 -1
  90. data/tracks/ecmascript/exercises/simple-cipher/README.md +1 -1
  91. data/tracks/ecmascript/exercises/simple-linked-list/README.md +1 -1
  92. data/tracks/ecmascript/exercises/space-age/README.md +1 -1
  93. data/tracks/ecmascript/exercises/strain/README.md +1 -1
  94. data/tracks/ecmascript/exercises/sublist/README.md +1 -1
  95. data/tracks/ecmascript/exercises/sum-of-multiples/README.md +1 -1
  96. data/tracks/ecmascript/exercises/transpose/README.md +1 -1
  97. data/tracks/ecmascript/exercises/triangle/README.md +1 -1
  98. data/tracks/ecmascript/exercises/trinary/README.md +1 -1
  99. data/tracks/ecmascript/exercises/twelve-days/README.md +1 -1
  100. data/tracks/ecmascript/exercises/two-bucket/README.md +1 -1
  101. data/tracks/ecmascript/exercises/two-fer/README.md +1 -1
  102. data/tracks/ecmascript/exercises/word-count/README.md +1 -1
  103. data/tracks/ecmascript/exercises/word-search/README.md +1 -1
  104. data/tracks/ecmascript/exercises/wordy/README.md +1 -1
  105. data/tracks/erlang/exercises/bob/src/bob.erl +4 -4
  106. data/tracks/erlang/exercises/bob/src/example.erl +30 -15
  107. data/tracks/erlang/exercises/bob/test/bob_tests.erl +84 -45
  108. data/tracks/erlang/exercises/collatz-conjecture/test/collatz_conjecture_tests.erl +2 -0
  109. data/tracks/erlang/exercises/hamming/src/example.erl +10 -10
  110. data/tracks/erlang/exercises/hamming/src/hamming.erl +4 -4
  111. data/tracks/erlang/exercises/hamming/test/hamming_tests.erl +54 -13
  112. data/tracks/erlang/exercises/hello-world/test/hello_world_tests.erl +2 -0
  113. data/tracks/erlang/exercises/leap/test/leap_tests.erl +2 -0
  114. data/tracks/erlang/exercises/rna-transcription/src/example.erl +6 -2
  115. data/tracks/erlang/exercises/rna-transcription/src/rna_transcription.erl +3 -3
  116. data/tracks/erlang/exercises/rna-transcription/test/rna_transcription_tests.erl +24 -14
  117. data/tracks/erlang/testgen/src/tgen.erl +1 -0
  118. data/tracks/erlang/testgen/src/tgen_bob.erl +29 -0
  119. data/tracks/erlang/testgen/src/tgen_hamming.erl +41 -0
  120. data/tracks/erlang/testgen/src/tgen_rna-transcription.erl +38 -0
  121. data/tracks/fsharp/exercises/etl/Etl.fs +2 -2
  122. data/tracks/fsharp/exercises/etl/EtlTest.fs +72 -29
  123. data/tracks/fsharp/exercises/etl/Example.fs +10 -5
  124. data/tracks/fsharp/exercises/nth-prime/NthPrimeTest.fs +1 -1
  125. data/tracks/fsharp/exercises/nucleotide-count/Example.fs +7 -3
  126. data/tracks/fsharp/exercises/nucleotide-count/NucleotideCount.fs +1 -3
  127. data/tracks/fsharp/exercises/nucleotide-count/NucleotideCountTest.fs +51 -33
  128. data/tracks/fsharp/generators/Generators.fs +48 -2
  129. data/tracks/gnu-apl/README.md +49 -14
  130. data/tracks/python/exercises/flatten-array/flatten_array_test.py +18 -11
  131. data/tracks/python/exercises/pig-latin/example.py +2 -1
  132. data/tracks/python/exercises/pig-latin/pig_latin_test.py +10 -4
  133. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3a2949812d8896565fdc94b7e575782eae5e655
4
- data.tar.gz: 651589d72bebc56d98389e62c426f073e8041eb9
3
+ metadata.gz: b0c0c7112b74d60e756fef9303430876ce7be49d
4
+ data.tar.gz: bd3104d6dfb0c233bbdf623e9808f246e5809742
5
5
  SHA512:
6
- metadata.gz: 1cea56c0f33205d1f42bdebe2ba12a7ebb7f403dd6b6862fb73127679961fd2a42ec2b14a1a32c3277d82a6162ed70a772948b288b93adeecad070d6ce4fdbff
7
- data.tar.gz: 35fabeed490a5830e2549ca93ad28312dc30234b94e2b7df4b1602b4076c35ee1f6c8274b90e8b5ef1ecabf8095f997a9a0422d79567c46066a29721c3cefcfc
6
+ metadata.gz: 56c13967f711c9dced182ddd89f0adf1cbbaa334993e0e9b94c23e13f7ab42135be63b46e57dfd6ba55b473a7d0f7a64ad9ea141872e400a598074dda8510f03
7
+ data.tar.gz: 11b81bc90cab6037db2614c4b461758fc1f884315163c6392ba8283bf76d4481c57c1bed510e6d64d82dfbe6a8499ebd90fae2cc2a12af831cc3dd172f80ce2d
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.55"
2
+ VERSION = "2.2.1.56"
3
3
  end
@@ -371,7 +371,7 @@ A problem might be foregone for a number of reasons, typically because it's a
371
371
  bad exercise for the language.
372
372
 
373
373
  Optional keys:
374
- * `test_pattern` - A (case sensitive) regex pattern that test filenames will match. It is used to determine which files will be visible on a problem's test-suite page on the exercism.io site. The default value used if this key is not present is `test` (note: this is case _insensitve_)
374
+ * `test_pattern` - A (case sensitive) regex pattern that test filenames will match. It is used to determine which files will be visible on a problem's test-suite page on the exercism.io site. The default value used if this key is not present is `test` (note: this is case _insensitive_)
375
375
  * `ignore_pattern` - A (case insensitive) regex pattern that will cause files matching it to not be served to the student by `exercism fetch`. The default value used if this key is not present is `example`
376
376
  * `solution_pattern` - A (case sensitive) regex pattern that matches solution files in the track repository. Used by [configlet](https://github.com/exercism/configlet) to check for the presence of an example solution for each problem implemented by the track. The default value used if this key is not present is `[Ee]xample`.
377
377
 
@@ -12,7 +12,7 @@ The format is usually represented as
12
12
 
13
13
  where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9.
14
14
 
15
- Your task is to clean up differently formated telephone numbers by removing punctuation and the country code (1) if present.
15
+ Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present.
16
16
 
17
17
  For example, the inputs
18
18
  - `+1 (613)-995-0253`
@@ -105,6 +105,14 @@
105
105
  "unlocked_by": null,
106
106
  "uuid": "f4cf3676-4399-4d1c-b21f-8e735c7af8cc"
107
107
  },
108
+ {
109
+ "core": false,
110
+ "difficulty": 1,
111
+ "slug": "complex-numbers",
112
+ "topics": null,
113
+ "unlocked_by": null,
114
+ "uuid": "95580d10-92db-4809-b5e7-4085319d19e9"
115
+ },
108
116
  {
109
117
  "core": false,
110
118
  "difficulty": 1,
@@ -510,4 +518,4 @@
510
518
  ],
511
519
  "foregone": [],
512
520
  "language": "Clojure"
513
- }
521
+ }
@@ -0,0 +1,37 @@
1
+ A complex number is a number in the form `a + b * i` where `a` and `b` are real and `i` satisfies `i^2 = -1`.
2
+
3
+ `a` is called the real part and `b` is called the imaginary part of `z`.
4
+ The conjugate of the number `a + b * i` is the number `a - b * i`.
5
+ The absolute value of a complex number `z = a + b * i` is a real number `|z| = sqrt(a^2 + b^2)`. The square of the absolute value `|z|^2` is the result of multiplication of `z` by its complex conjugate.
6
+
7
+ The sum/difference of two complex numbers involves adding/subtracting their real and imaginary parts separately:
8
+ `(a + i * b) + (c + i * d) = (a + c) + (b + d) * i`,
9
+ `(a + i * b) - (c + i * d) = (a - c) + (b - d) * i`.
10
+
11
+ Multiplication result is by definition
12
+ `(a + i * b) * (c + i * d) = (a * c - b * d) + (b * c + a * d) * i`.
13
+
14
+ The reciprocal of a non-zero complex number is
15
+ `1 / (a + i * b) = a/(a^2 + b^2) - b/(a^2 + b^2) * i`.
16
+
17
+ Dividing a complex number `a + i * b` by another `c + i * d` gives:
18
+ `(a + i * b) / (c + i * d) = (a * c + b * d)/(c^2 + d^2) + (b * c - a * d)/(c^2 + d^2) * i`.
19
+
20
+ Exponent of a complex number can be expressed as
21
+ `exp(a + i * b) = exp(a) * exp(i * b)`,
22
+ and the last term is given by Euler's formula `exp(i * b) = cos(b) + i * sin(b)`.
23
+
24
+
25
+ Implement the following operations:
26
+ - addition, subtraction, multiplication and division of two complex numbers,
27
+ - conjugate, absolute value, exponent of a given complex number.
28
+
29
+
30
+ Assume the programming language you are using does not have an implementation of complex numbers.
31
+
32
+ ## Source
33
+
34
+ [wikipedia page](https://en.wikipedia.org/wiki/Complex_number)
35
+
36
+ ## Submitting Incomplete Solutions
37
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,4 @@
1
+ (defproject complex-numbers "0.1.0-SNAPSHOT"
2
+ :description "complex-numbers exercise"
3
+ :url "https://github.com/exercism/xclojure/tree/master/exercises/complex-numbers"
4
+ :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -0,0 +1,17 @@
1
+ (ns complex-numbers)
2
+
3
+ (defn real [[a b]])
4
+
5
+ (defn imaginary [[a b]])
6
+
7
+ (defn abs [[a b]])
8
+
9
+ (defn conjugate [[a b]])
10
+
11
+ (defn add [[a b] [c d]])
12
+
13
+ (defn sub [[a b] [c d]])
14
+
15
+ (defn mul [[a b] [c d]])
16
+
17
+ (defn div [[a b] [c d]])
@@ -0,0 +1,20 @@
1
+ (ns complex-numbers)
2
+
3
+ (defn real [[a _]] a)
4
+
5
+ (defn imaginary [[_ b]] b)
6
+
7
+ (defn abs [[a b]] (Math/sqrt (apply + (map #(Math/pow % 2) [a b]))))
8
+
9
+ (defn conjugate [[a b]] [a (- b)])
10
+
11
+ (defn add [[a b] [c d]] [(+ a c) (+ b d)])
12
+
13
+ (defn sub [[a b] [c d]] [(- a c) (- b d)])
14
+
15
+ (defn mul [[a b] [c d]] [(- (* a c) (* b d)) (+ (* a d) (* b c))])
16
+
17
+ (defn div [[a b] [c d]]
18
+ (let [denominator (apply + (map #(Math/pow % 2) [c d]))]
19
+ [(/ (+ (* a c) (* b d)) denominator)
20
+ (/ (- (* b c) (* a d)) denominator)]))
@@ -0,0 +1,141 @@
1
+ (ns complex-numbers-test
2
+ (require [clojure.test :refer [deftest is testing]]
3
+ [complex-numbers :as c]))
4
+
5
+ ;; Tests for Addition
6
+ (deftest add-purely-real-numbers
7
+ (testing "Add purely real numbers"
8
+ (is (= (c/add [1 0] [2 0])
9
+ [3 0]))))
10
+
11
+ (deftest add-purely-imaginary-numbers
12
+ (testing "Add purely imaginary numbers"
13
+ (is (= (c/add [0 1] [0 2])
14
+ [0 3]))))
15
+
16
+ (deftest add-numbers-with-real-and-imaginary-part
17
+ (testing "Add numbers with real and imaginary part"
18
+ (is (= (c/add [1 2] [3 4])
19
+ [4 6]))))
20
+
21
+ ;; Tests for Subtraction
22
+ (deftest subtract-purely-real-numbers
23
+ (testing "Subtract purely real numbers"
24
+ (is (= (c/sub [1 0] [2 0])
25
+ [-1 0]))))
26
+
27
+ (deftest subtract-purely-imaginary-numbers
28
+ (testing "Subtract purely imaginary numbers"
29
+ (is (= (c/sub [0 1] [0 2])
30
+ [0 -1]))))
31
+
32
+ (deftest subtract-numbers-with-real-and-imaginary-part
33
+ (testing "Subtract numbers with real and imaginary part"
34
+ (is (= (c/sub [1 2] [3 4])
35
+ [-2 -2]))))
36
+
37
+ ;; Tests for Multiplication
38
+ (deftest multiply-purely-real-numbers
39
+ (testing "Multiply purely real numbers"
40
+ (is (= (c/mul [1 0] [2 0])
41
+ [2 0]))))
42
+
43
+ (deftest multiply-purely-imaginary-numbers
44
+ (testing "Multiply purely imaginary numbers"
45
+ (is (= (c/mul [0 1] [0 2])
46
+ [-2 0]))))
47
+
48
+ (deftest multiply-numbers-with-real-and-imaginary-part
49
+ (testing "Multiply numbers with real and imaginary part"
50
+ (is (= (c/mul [1 2] [3 4])
51
+ [-5 10]))))
52
+
53
+ ;; Tests for division
54
+ (deftest divide-purely-real-numbers
55
+ (testing "Divide purely real numbers"
56
+ (is (= (c/div [1 0] [2 0])
57
+ [0.5 0.0]))))
58
+
59
+ (deftest dividey-purely-imaginary-numbers
60
+ (testing "Divide purely imaginary numbers"
61
+ (is (= (c/div [0 1] [0 2])
62
+ [0.5 0.0]))))
63
+
64
+ (deftest divide-numbers-with-real-and-imaginary-part
65
+ (testing "Divide numbers with real and imaginary part"
66
+ (is (= (c/div [1 2] [3 4])
67
+ [0.44 0.08]))))
68
+
69
+ ;; Tests for Absolute Value
70
+ (deftest absolute-of-positive-purely-real-number
71
+ (testing "Absolute value of a positive purely real number"
72
+ (is (= (c/abs [5 0])
73
+ 5.0))))
74
+
75
+ (deftest absolute-of-negative-purely-real-number
76
+ (testing "Absolute value of a negative purely real number"
77
+ (is (= (c/abs [-5 0])
78
+ 5.0))))
79
+
80
+ (deftest absolute-of-positive-purely-imaginary-number
81
+ (testing "Absolute value of a purely imaginary number with positive imaginary part"
82
+ (is (= (c/abs [0 5])
83
+ 5.0))))
84
+
85
+ (deftest absolute-of-negative-purely-imaginary-number
86
+ (testing "Absolute value of a purely imaginary number with negative imaginary part"
87
+ (is (= (c/abs [0 -5])
88
+ 5.0))))
89
+
90
+ (deftest absolute-of-real-and-imaginary-number
91
+ (testing "Absolute value of a number with real and imaginary part"
92
+ (is (= (c/abs [3 4])
93
+ 5.0))))
94
+
95
+ ;; Tests for Conjugate
96
+ (deftest conjugate-of-purely-real-number
97
+ (testing "Conjugate a purely real number"
98
+ (is (= (c/conjugate [5 0])
99
+ [5 0]))))
100
+
101
+ (deftest conjugate-of-purely-imaginary-number
102
+ (testing "Conjugate a purely imaginary number"
103
+ (is (= (c/conjugate [0 5])
104
+ [0 -5]))))
105
+
106
+ (deftest conjugate-of-real-and-imaginary-number
107
+ (testing "Conjugate a number with real and imaginary part"
108
+ (is (= (c/conjugate [1 1])
109
+ [1 -1]))))
110
+
111
+ ;; Tests for Real Part
112
+ (deftest real-of-purely-real-number
113
+ (testing "Real part of a purely real number"
114
+ (is (= (c/real [1 0])
115
+ 1))))
116
+
117
+ (deftest real-of-purely-imaginary-number
118
+ (testing "Real part of a purely imaginary number"
119
+ (is (= (c/real [0 1])
120
+ 0))))
121
+
122
+ (deftest real-of-real-and-imaginary-number
123
+ (testing "Real part of a number with real and imaginary part"
124
+ (is (= (c/real [1 2])
125
+ 1))))
126
+
127
+ ;; Tests for Imaginary Part
128
+ (deftest imaginary-of-purely-real-number
129
+ (testing "Imaginary part of a purely real number"
130
+ (is (= (c/imaginary [1 0])
131
+ 0))))
132
+
133
+ (deftest imaginary-of-purely-imaginary-number
134
+ (testing "Imaginary part of a purely imaginary number"
135
+ (is (= (c/imaginary [0 1])
136
+ 1))))
137
+
138
+ (deftest imaginary-of-real-and-imaginary-number
139
+ (testing "Imaginary part of a number with real and imaginary part"
140
+ (is (= (c/imaginary [1 2])
141
+ 2))))
@@ -1,3 +1,5 @@
1
1
  class HelloWorld {
2
- String hello([String name = "World"]) => "Hello, $name!";
2
+ String hello() {
3
+ return "Hello, World!";
4
+ }
3
5
  }
@@ -1,5 +1,5 @@
1
1
  class HelloWorld {
2
- String hello([String name]) {
2
+ String hello() {
3
3
  // Put your code here
4
4
  }
5
5
  }
@@ -2,21 +2,7 @@ import "package:test/test.dart";
2
2
  import "package:hello_world/hello_world.dart";
3
3
 
4
4
  void main() {
5
- var helloWorld = new HelloWorld();
6
-
7
- test("should work", () {
8
- helloWorld.hello();
5
+ test("returns \"Hello, World!\"", () {
6
+ expect(new HelloWorld().hello(), equals("Hello, World!"));
9
7
  });
10
-
11
- test("says hello world with no name", () {
12
- expect(helloWorld.hello(), equals("Hello, World!"));
13
- }, skip: true);
14
-
15
- test("says hello to bob", () {
16
- expect(helloWorld.hello("Bob"), equals("Hello, Bob!"));
17
- }, skip: true);
18
-
19
- test("says hello to sally", () {
20
- expect(helloWorld.hello("Sally"), equals("Hello, Sally!"));
21
- }, skip: true);
22
8
  }
@@ -10,7 +10,7 @@ void main() {
10
10
  });
11
11
 
12
12
  test("is introduced every 4 years to adjust about a day", () {
13
- final year = new Year(2020);
13
+ final year = new Year(1996);
14
14
 
15
15
  expect(year.isLeap(), equals(true));
16
16
  }, skip: true);
@@ -5,6 +5,7 @@ import "dart:io";
5
5
  import "dart:async";
6
6
  import "dart:convert";
7
7
  import "package:args/args.dart";
8
+ import "package:path/path.dart" show dirname;
8
9
 
9
10
  /** Constants */
10
11
  const ME = "create-exercise";
@@ -178,6 +179,21 @@ String getFriendlyType(Object x) {
178
179
  return x.runtimeType;
179
180
  }
180
181
 
182
+ // runProcess runs a process, writes any stdout/stderr output.
183
+ // Returns true if the cmd was successful, false otherwise
184
+ Future<bool> runProcess(String cmd, List<String> arguments) async {
185
+ final res = await Process.run(cmd, arguments, runInShell: true);
186
+ if (!res.stdout.toString().isEmpty) {
187
+ stdout.write(res.stdout);
188
+ }
189
+
190
+ if (!res.stderr.toString().isEmpty) {
191
+ stderr.write(res.stderr);
192
+ }
193
+
194
+ return res.exitCode == 0;
195
+ }
196
+
181
197
  Future main(args) async {
182
198
  final arguments = parser.parse(args);
183
199
  final restArgs = arguments.rest;
@@ -226,38 +242,32 @@ Future main(args) async {
226
242
  await new File("${exerciseDir.path}/pubspec.yaml").writeAsString(pubTemplate(name));
227
243
 
228
244
  if (arguments["spec-path"] != null) {
229
- // The output from test generation is not always well-formatted, use dartfmt to clean it up
230
- final res = await Process.run("dartfmt", ["-l", "120", "-w", testFileName], runInShell: true);
231
- if (!res.stdout.toString().isEmpty) {
232
- stdout.write(res.stdout);
233
- }
234
-
235
- if (!res.stderr.toString().isEmpty) {
236
- stderr.write(res.stderr);
237
- }
238
-
239
- if (res.exitCode != 0) {
240
- stderr.write("Warning: dartfmt exited with a code of ${res.exitCode}, '$testFileName' is likely malformed.\n");
245
+ // Generate README
246
+ final dartRoot = "${dirname(Platform.script.toFilePath())}/..";
247
+ final configletLoc = "$dartRoot/bin/configlet";
248
+ final genSuccess = await runProcess(
249
+ configletLoc, ["generate", "$dartRoot", "--spec-path", arguments["spec-path"], "--only", name]);
250
+ if (genSuccess) {
251
+ stdout.write("Successfully created README.md\n");
241
252
  } else {
242
- stdout.write("Successfully created a rough-draft of tests at '$testFileName'.\n");
243
- stdout.write("You should check this over and fix or refine as necessary.\n");
253
+ stderr.write("Warning: `configlet generate` exited with an error, 'README.md' is likely malformed.\n");
244
254
  }
245
255
  }
246
256
 
247
- // Install deps
248
- Directory.current = exerciseDir;
249
-
250
- final res = await Process.run("pub", ["get"], runInShell: true);
251
-
252
- if (!res.stdout.toString().isEmpty) {
253
- stdout.write(res.stdout);
257
+ // The output from file generation is not always well-formatted, use dartfmt to clean it up
258
+ final fmtSuccess = await runProcess("dartfmt", ["-l", "120", "-w", exerciseDir.path]);
259
+ if (fmtSuccess) {
260
+ stdout.write("Successfully created a rough-draft of tests at '$testFileName'.\n");
261
+ stdout.write("You should check this over and fix or refine as necessary.\n");
262
+ } else {
263
+ stderr.write("Warning: dartfmt exited with an error, files in '${exerciseDir.path}' may be malformed.\n");
254
264
  }
255
265
 
256
- if (!res.stderr.toString().isEmpty) {
257
- stderr.write(res.stderr);
258
- }
266
+ // Install deps
267
+ Directory.current = exerciseDir;
259
268
 
260
- assert(res.exitCode == 0);
269
+ final pubSuccess = await runProcess("pub", ["get"]);
270
+ assert(pubSuccess);
261
271
 
262
272
  Directory.current = currentDir;
263
273
  }
@@ -1160,6 +1160,19 @@
1160
1160
  "strings",
1161
1161
  "text_formatting"
1162
1162
  ]
1163
+ },
1164
+ {
1165
+ "uuid": "775ae0ec-8db7-4568-a188-963931cf5ee1",
1166
+ "slug": "protein-translation",
1167
+ "core": false,
1168
+ "unlocked_by": null,
1169
+ "difficulty": 1,
1170
+ "topics": [
1171
+ "control-flow-(conditionals)",
1172
+ "control-flow-(loops)",
1173
+ "strings",
1174
+ "algorithms"
1175
+ ]
1163
1176
  }
1164
1177
  ],
1165
1178
  "foregone": []
@@ -33,7 +33,7 @@ as this is idiomatic Lisp, not a library function.
33
33
  Go through the setup instructions for ECMAScript to
34
34
  install the necessary dependencies:
35
35
 
36
- http://exercism.io/languages/ecmascript
36
+ http://exercism.io/languages/ecmascript/installation
37
37
 
38
38
  ## Requirements
39
39