trackler 2.0.8.24 → 2.0.8.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/c/config.json +9 -0
  4. data/tracks/c/exercises/nucleotide-count/makefile +15 -0
  5. data/tracks/c/exercises/nucleotide-count/src/example.c +43 -0
  6. data/tracks/c/exercises/nucleotide-count/src/example.h +6 -0
  7. data/tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c +58 -0
  8. data/tracks/c/exercises/nucleotide-count/test/vendor/unity.c +1300 -0
  9. data/tracks/c/exercises/nucleotide-count/test/vendor/unity.h +274 -0
  10. data/tracks/c/exercises/nucleotide-count/test/vendor/unity_internals.h +701 -0
  11. data/tracks/ceylon/README.md +2 -2
  12. data/tracks/csharp/.gitattributes +11 -0
  13. data/tracks/csharp/appveyor.yml +1 -4
  14. data/tracks/csharp/exercises/acronym/AcronymTest.cs +1 -1
  15. data/tracks/csharp/exercises/atbash-cipher/AtbashCipher.cs +8 -3
  16. data/tracks/csharp/exercises/atbash-cipher/AtbashCipherTest.cs +76 -0
  17. data/tracks/csharp/exercises/atbash-cipher/Example.cs +22 -23
  18. data/tracks/csharp/exercises/isogram/Example.cs +2 -2
  19. data/tracks/csharp/exercises/isogram/IsogramTest.cs +47 -15
  20. data/tracks/csharp/exercises/nth-prime/Example.cs +4 -1
  21. data/tracks/csharp/exercises/nth-prime/NthPrime.cs +1 -1
  22. data/tracks/csharp/exercises/nth-prime/NthPrimeTest.cs +29 -15
  23. data/tracks/csharp/exercises/perfect-numbers/Example.cs +14 -16
  24. data/tracks/csharp/exercises/perfect-numbers/PerfectNumbers.cs +2 -2
  25. data/tracks/csharp/exercises/perfect-numbers/PerfectNumbersTest.cs +78 -26
  26. data/tracks/csharp/exercises/pig-latin/PigLatinTest.cs +69 -24
  27. data/tracks/csharp/exercises/raindrops/Example.cs +1 -1
  28. data/tracks/csharp/exercises/raindrops/RaindropsTest.cs +93 -31
  29. data/tracks/csharp/exercises/roman-numerals/HINTS.md +2 -0
  30. data/tracks/csharp/exercises/roman-numerals/RomanNumeralsTest.cs +106 -23
  31. data/tracks/csharp/exercises/word-search/HINTS.md +6 -0
  32. data/tracks/csharp/generators/{TestClass.cs → Classes/TestClass.cs} +2 -1
  33. data/tracks/csharp/generators/{TestClassNameTransformer.cs → Classes/TestClassNameTransformer.cs} +1 -1
  34. data/tracks/csharp/generators/{TestClassRenderer.cs → Classes/TestClassRenderer.cs} +2 -1
  35. data/tracks/csharp/generators/Classes/TestedClassNameTransformer.cs +9 -0
  36. data/tracks/csharp/generators/{CanonicalData.cs → Data/CanonicalData.cs} +1 -1
  37. data/tracks/csharp/generators/{CanonicalDataCase.cs → Data/CanonicalDataCase.cs} +3 -3
  38. data/tracks/csharp/generators/{CanonicalDataCaseJsonConverter.cs → Data/CanonicalDataCaseJsonConverter.cs} +1 -1
  39. data/tracks/csharp/generators/{CanonicalDataCasesJsonConverter.cs → Data/CanonicalDataCasesJsonConverter.cs} +2 -2
  40. data/tracks/csharp/generators/{CanonicalDataParser.cs → Data/CanonicalDataParser.cs} +5 -5
  41. data/tracks/csharp/generators/{ExerciseCollection.cs → Data/ExerciseCollection.cs} +3 -3
  42. data/tracks/csharp/generators/Exercises/AcronymExercise.cs +20 -0
  43. data/tracks/csharp/generators/Exercises/AtbashCipherExercise.cs +20 -0
  44. data/tracks/csharp/generators/Exercises/BooleanExercise.cs +14 -0
  45. data/tracks/csharp/generators/Exercises/EqualityExercise.cs +14 -0
  46. data/tracks/csharp/generators/Exercises/Exercise.cs +59 -4
  47. data/tracks/csharp/generators/Exercises/IsogramExercise.cs +9 -0
  48. data/tracks/csharp/generators/Exercises/LeapExercise.cs +1 -4
  49. data/tracks/csharp/generators/Exercises/NthPrimeExercise.cs +25 -0
  50. data/tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs +29 -0
  51. data/tracks/csharp/generators/Exercises/PigLatinExercise.cs +9 -0
  52. data/tracks/csharp/generators/Exercises/RaindropsExercise.cs +20 -0
  53. data/tracks/csharp/generators/Exercises/RomanNumeralsExercise.cs +30 -0
  54. data/tracks/csharp/generators/Helpers/StringExtensions.cs +8 -0
  55. data/tracks/csharp/generators/{To.cs → Helpers/To.cs} +4 -1
  56. data/tracks/csharp/generators/Methods/BooleanTestMethodGenerator.cs +32 -0
  57. data/tracks/csharp/generators/Methods/EqualityTestMethodGenerator.cs +25 -0
  58. data/tracks/csharp/generators/Methods/ExceptionTestMethodGenerator.cs +30 -0
  59. data/tracks/csharp/generators/{TestMethod.cs → Methods/TestMethod.cs} +6 -3
  60. data/tracks/csharp/generators/Methods/TestMethodData.cs +12 -0
  61. data/tracks/csharp/generators/Methods/TestMethodGenerator.cs +64 -0
  62. data/tracks/csharp/generators/Methods/TestMethodNameTransformer.cs +23 -0
  63. data/tracks/csharp/generators/Methods/TestMethodOptions.cs +13 -0
  64. data/tracks/csharp/generators/{TestMethodRenderer.cs → Methods/TestMethodRenderer.cs} +1 -1
  65. data/tracks/csharp/generators/{TestedMethodNameTransformer.cs → Methods/TestedMethodNameTransformer.cs} +1 -1
  66. data/tracks/csharp/generators/Methods/TestedMethodType.cs +9 -0
  67. data/tracks/csharp/generators/Program.cs +2 -0
  68. data/tracks/elixir/config.json +7 -0
  69. data/tracks/elixir/exercises/diffie-hellman/HINTS.md +10 -0
  70. data/tracks/elixir/exercises/diffie-hellman/diffie_hellman.exs +61 -0
  71. data/tracks/elixir/exercises/diffie-hellman/diffie_hellman_test.exs +99 -0
  72. data/tracks/elixir/exercises/diffie-hellman/example.exs +64 -0
  73. data/tracks/haskell/exercises/pov/src/POV.hs +2 -2
  74. data/tracks/haskell/exercises/pythagorean-triplet/src/Triplet.hs +6 -3
  75. data/tracks/haskell/exercises/queen-attack/src/Queens.hs +1 -1
  76. data/tracks/haskell/exercises/raindrops/src/Raindrops.hs +2 -1
  77. data/tracks/haskell/exercises/robot-name/src/Robot.hs +2 -2
  78. data/tracks/haskell/exercises/robot-simulator/src/Robot.hs +6 -6
  79. data/tracks/haskell/exercises/roman-numerals/src/Roman.hs +2 -1
  80. data/tracks/haskell/exercises/run-length-encoding/src/RunLength.hs +2 -2
  81. data/tracks/haskell/exercises/saddle-points/src/Matrix.hs +2 -1
  82. data/tracks/haskell/exercises/say/src/Say.hs +2 -1
  83. data/tracks/haskell/exercises/scrabble-score/src/Scrabble.hs +4 -2
  84. data/tracks/haskell/exercises/secret-handshake/src/SecretHandshake.hs +1 -1
  85. data/tracks/haskell/exercises/sgf-parsing/src/Sgf.hs +1 -1
  86. data/tracks/java/exercises/acronym/src/example/java/Acronym.java +11 -1
  87. data/tracks/java/exercises/acronym/src/test/java/AcronymTest.java +8 -9
  88. data/tracks/java/exercises/grade-school/src/test/java/SchoolTest.java +8 -2
  89. data/tracks/java/exercises/luhn/src/test/java/LuhnValidatorTest.java +20 -13
  90. data/tracks/java/exercises/robot-name/src/test/java/RobotTest.java +6 -1
  91. data/tracks/javascript/README.md +1 -1
  92. data/tracks/javascript/docs/TESTS.md +9 -1
  93. data/tracks/kotlin/exercises/luhn/src/example/kotlin/Luhn.kt +18 -26
  94. data/tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt +40 -38
  95. data/tracks/php/README.md +1 -1
  96. data/tracks/php/config.json +5 -0
  97. data/tracks/php/exercises/perfect-numbers/example.php +23 -0
  98. data/tracks/php/exercises/perfect-numbers/perfect-numbers_test.php +99 -0
  99. data/tracks/purescript/.travis.yml +1 -0
  100. data/tracks/purescript/bin/test.sh +33 -8
  101. data/tracks/purescript/config.json +7 -0
  102. data/tracks/purescript/exercises/meetup/bower.json +17 -0
  103. data/tracks/purescript/exercises/meetup/examples/src/Meetup.purs +37 -0
  104. data/tracks/purescript/exercises/meetup/src/Meetup.purs +11 -0
  105. data/tracks/purescript/exercises/meetup/test/Main.purs +395 -0
  106. data/tracks/python/README.md +7 -6
  107. data/tracks/python/docs/TOOLS.md +3 -3
  108. data/tracks/python/exercises/bracket-push/bracket_push_test.py +32 -15
  109. data/tracks/python/exercises/hamming/hamming_test.py +2 -0
  110. data/tracks/python/exercises/luhn/luhn_test.py +2 -0
  111. data/tracks/python/test/check-exercises.py +7 -1
  112. metadata +56 -20
  113. data/tracks/csharp/exercises/atbash-cipher/AtbashTest.cs +0 -17
  114. data/tracks/csharp/generators/BooleanTestMethod.cs +0 -36
  115. data/tracks/csharp/generators/TestMethodNameTransformer.cs +0 -11
  116. data/tracks/csharp/generators/TestedClassNameTransformer.cs +0 -11
  117. data/tracks/java/exercises/allergies/src/main/java/.keep +0 -0
@@ -0,0 +1,395 @@
1
+ module Test.Main where
2
+
3
+ import Prelude
4
+ import Test.Unit.Assert as Assert
5
+ import Control.Monad.Eff (Eff)
6
+ import Data.Date (Weekday(..), canonicalDate)
7
+ import Data.Enum (toEnum)
8
+ import Data.Maybe (Maybe(..))
9
+ import Meetup (Week(..), meetup)
10
+ import Test.Unit (suite, test)
11
+ import Test.Unit.Main (runTest)
12
+
13
+ main :: Eff _ Unit
14
+ main = runTest do
15
+ suite "Meetup.meetup" do
16
+
17
+ test "monteenth of May 2013" $
18
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 5 <*> toEnum 13)
19
+ (meetup <$> toEnum 2013 <*> toEnum 5 <@> Teenth <@> Monday)
20
+
21
+ test "monteenth of August 2013" $
22
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 8 <*> toEnum 19)
23
+ (meetup <$> toEnum 2013 <*> toEnum 8 <@> Teenth <@> Monday)
24
+
25
+ test "monteenth of September 2013" $
26
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 9 <*> toEnum 16)
27
+ (meetup <$> toEnum 2013 <*> toEnum 9 <@> Teenth <@> Monday)
28
+
29
+ test "tuesteenth of March 2013" $
30
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 3 <*> toEnum 19)
31
+ (meetup <$> toEnum 2013 <*> toEnum 3 <@> Teenth <@> Tuesday)
32
+
33
+ test "tuesteenth of April 2013" $
34
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 16)
35
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> Teenth <@> Tuesday)
36
+
37
+ test "tuesteenth of August 2013" $
38
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 8 <*> toEnum 13)
39
+ (meetup <$> toEnum 2013 <*> toEnum 8 <@> Teenth <@> Tuesday)
40
+
41
+ test "wednesteenth of January 2013" $
42
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 1 <*> toEnum 16)
43
+ (meetup <$> toEnum 2013 <*> toEnum 1 <@> Teenth <@> Wednesday)
44
+
45
+ test "wednesteenth of February 2013" $
46
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 2 <*> toEnum 13)
47
+ (meetup <$> toEnum 2013 <*> toEnum 2 <@> Teenth <@> Wednesday)
48
+
49
+ test "wednesteenth of June 2013" $
50
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 6 <*> toEnum 19)
51
+ (meetup <$> toEnum 2013 <*> toEnum 6 <@> Teenth <@> Wednesday)
52
+
53
+ test "thursteenth of May 2013" $
54
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 5 <*> toEnum 16)
55
+ (meetup <$> toEnum 2013 <*> toEnum 5 <@> Teenth <@> Thursday)
56
+
57
+ test "thursteenth of June 2013" $
58
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 6 <*> toEnum 13)
59
+ (meetup <$> toEnum 2013 <*> toEnum 6 <@> Teenth <@> Thursday)
60
+
61
+ test "thursteenth of September 2013" $
62
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 9 <*> toEnum 19)
63
+ (meetup <$> toEnum 2013 <*> toEnum 9 <@> Teenth <@> Thursday)
64
+
65
+ test "friteenth of April 2013" $
66
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 19)
67
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> Teenth <@> Friday)
68
+
69
+ test "friteenth of August 2013" $
70
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 8 <*> toEnum 16)
71
+ (meetup <$> toEnum 2013 <*> toEnum 8 <@> Teenth <@> Friday)
72
+
73
+ test "friteenth of September 2013" $
74
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 9 <*> toEnum 13)
75
+ (meetup <$> toEnum 2013 <*> toEnum 9 <@> Teenth <@> Friday)
76
+
77
+ test "saturteenth of February 2013" $
78
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 2 <*> toEnum 16)
79
+ (meetup <$> toEnum 2013 <*> toEnum 2 <@> Teenth <@> Saturday)
80
+
81
+ test "saturteenth of April 2013" $
82
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 13)
83
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> Teenth <@> Saturday)
84
+
85
+ test "saturteenth of October 2013" $
86
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 10 <*> toEnum 19)
87
+ (meetup <$> toEnum 2013 <*> toEnum 10 <@> Teenth <@> Saturday)
88
+
89
+ test "sunteenth of May 2013" $
90
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 5 <*> toEnum 19)
91
+ (meetup <$> toEnum 2013 <*> toEnum 5 <@> Teenth <@> Sunday)
92
+
93
+ test "sunteenth of June 2013" $
94
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 6 <*> toEnum 16)
95
+ (meetup <$> toEnum 2013 <*> toEnum 6 <@> Teenth <@> Sunday)
96
+
97
+ test "sunteenth of October 2013" $
98
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 10 <*> toEnum 13)
99
+ (meetup <$> toEnum 2013 <*> toEnum 10 <@> Teenth <@> Sunday)
100
+
101
+ test "first Monday of March 2013" $
102
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 3 <*> toEnum 4)
103
+ (meetup <$> toEnum 2013 <*> toEnum 3 <@> First <@> Monday)
104
+
105
+ test "first Monday of April 2013" $
106
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 1)
107
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> First <@> Monday)
108
+
109
+ test "first Tuesday of May 2013" $
110
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 5 <*> toEnum 7)
111
+ (meetup <$> toEnum 2013 <*> toEnum 5 <@> First <@> Tuesday)
112
+
113
+ test "first Tuesday of June 2013" $
114
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 6 <*> toEnum 4)
115
+ (meetup <$> toEnum 2013 <*> toEnum 6 <@> First <@> Tuesday)
116
+
117
+ test "first Wednesday of July 2013" $
118
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 7 <*> toEnum 3)
119
+ (meetup <$> toEnum 2013 <*> toEnum 7 <@> First <@> Wednesday)
120
+
121
+ test "first Wednesday of August 2013" $
122
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 8 <*> toEnum 7)
123
+ (meetup <$> toEnum 2013 <*> toEnum 8 <@> First <@> Wednesday)
124
+
125
+ test "first Thursday of September 2013" $
126
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 9 <*> toEnum 5)
127
+ (meetup <$> toEnum 2013 <*> toEnum 9 <@> First <@> Thursday)
128
+
129
+ test "first Thursday of October 2013" $
130
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 10 <*> toEnum 3)
131
+ (meetup <$> toEnum 2013 <*> toEnum 10 <@> First <@> Thursday)
132
+
133
+ test "first Friday of November 2013" $
134
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 11 <*> toEnum 1)
135
+ (meetup <$> toEnum 2013 <*> toEnum 11 <@> First <@> Friday)
136
+
137
+ test "first Friday of December 2013" $
138
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 12 <*> toEnum 6)
139
+ (meetup <$> toEnum 2013 <*> toEnum 12 <@> First <@> Friday)
140
+
141
+ test "first Saturday of January 2013" $
142
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 1 <*> toEnum 5)
143
+ (meetup <$> toEnum 2013 <*> toEnum 1 <@> First <@> Saturday)
144
+
145
+ test "first Saturday of February 2013" $
146
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 2 <*> toEnum 2)
147
+ (meetup <$> toEnum 2013 <*> toEnum 2 <@> First <@> Saturday)
148
+
149
+ test "first Sunday of March 2013" $
150
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 3 <*> toEnum 3)
151
+ (meetup <$> toEnum 2013 <*> toEnum 3 <@> First <@> Sunday)
152
+
153
+ test "first Sunday of April 2013" $
154
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 7)
155
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> First <@> Sunday)
156
+
157
+ test "second Monday of March 2013" $
158
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 3 <*> toEnum 11)
159
+ (meetup <$> toEnum 2013 <*> toEnum 3 <@> Second <@> Monday)
160
+
161
+ test "second Monday of April 2013" $
162
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 8)
163
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> Second <@> Monday)
164
+
165
+ test "second Tuesday of May 2013" $
166
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 5 <*> toEnum 14)
167
+ (meetup <$> toEnum 2013 <*> toEnum 5 <@> Second <@> Tuesday)
168
+
169
+ test "second Tuesday of June 2013" $
170
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 6 <*> toEnum 11)
171
+ (meetup <$> toEnum 2013 <*> toEnum 6 <@> Second <@> Tuesday)
172
+
173
+ test "second Wednesday of July 2013" $
174
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 7 <*> toEnum 10)
175
+ (meetup <$> toEnum 2013 <*> toEnum 7 <@> Second <@> Wednesday)
176
+
177
+ test "second Wednesday of August 2013" $
178
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 8 <*> toEnum 14)
179
+ (meetup <$> toEnum 2013 <*> toEnum 8 <@> Second <@> Wednesday)
180
+
181
+ test "second Thursday of September 2013" $
182
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 9 <*> toEnum 12)
183
+ (meetup <$> toEnum 2013 <*> toEnum 9 <@> Second <@> Thursday)
184
+
185
+ test "second Thursday of October 2013" $
186
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 10 <*> toEnum 10)
187
+ (meetup <$> toEnum 2013 <*> toEnum 10 <@> Second <@> Thursday)
188
+
189
+ test "second Friday of November 2013" $
190
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 11 <*> toEnum 8)
191
+ (meetup <$> toEnum 2013 <*> toEnum 11 <@> Second <@> Friday)
192
+
193
+ test "second Friday of December 2013" $
194
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 12 <*> toEnum 13)
195
+ (meetup <$> toEnum 2013 <*> toEnum 12 <@> Second <@> Friday)
196
+
197
+ test "second Saturday of January 2013" $
198
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 1 <*> toEnum 12)
199
+ (meetup <$> toEnum 2013 <*> toEnum 1 <@> Second <@> Saturday)
200
+
201
+ test "second Saturday of February 2013" $
202
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 2 <*> toEnum 9)
203
+ (meetup <$> toEnum 2013 <*> toEnum 2 <@> Second <@> Saturday)
204
+
205
+ test "second Sunday of March 2013" $
206
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 3 <*> toEnum 10)
207
+ (meetup <$> toEnum 2013 <*> toEnum 3 <@> Second <@> Sunday)
208
+
209
+ test "second Sunday of April 2013" $
210
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 14)
211
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> Second <@> Sunday)
212
+
213
+ test "third Monday of March 2013" $
214
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 3 <*> toEnum 18)
215
+ (meetup <$> toEnum 2013 <*> toEnum 3 <@> Third <@> Monday)
216
+
217
+ test "third Monday of April 2013" $
218
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 15)
219
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> Third <@> Monday)
220
+
221
+ test "third Tuesday of May 2013" $
222
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 5 <*> toEnum 21)
223
+ (meetup <$> toEnum 2013 <*> toEnum 5 <@> Third <@> Tuesday)
224
+
225
+ test "third Tuesday of June 2013" $
226
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 6 <*> toEnum 18)
227
+ (meetup <$> toEnum 2013 <*> toEnum 6 <@> Third <@> Tuesday)
228
+
229
+ test "third Wednesday of July 2013" $
230
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 7 <*> toEnum 17)
231
+ (meetup <$> toEnum 2013 <*> toEnum 7 <@> Third <@> Wednesday)
232
+
233
+ test "third Wednesday of August 2013" $
234
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 8 <*> toEnum 21)
235
+ (meetup <$> toEnum 2013 <*> toEnum 8 <@> Third <@> Wednesday)
236
+
237
+ test "third Thursday of September 2013" $
238
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 9 <*> toEnum 19)
239
+ (meetup <$> toEnum 2013 <*> toEnum 9 <@> Third <@> Thursday)
240
+
241
+ test "third Thursday of October 2013" $
242
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 10 <*> toEnum 17)
243
+ (meetup <$> toEnum 2013 <*> toEnum 10 <@> Third <@> Thursday)
244
+
245
+ test "third Friday of November 2013" $
246
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 11 <*> toEnum 15)
247
+ (meetup <$> toEnum 2013 <*> toEnum 11 <@> Third <@> Friday)
248
+
249
+ test "third Friday of December 2013" $
250
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 12 <*> toEnum 20)
251
+ (meetup <$> toEnum 2013 <*> toEnum 12 <@> Third <@> Friday)
252
+
253
+ test "third Saturday of January 2013" $
254
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 1 <*> toEnum 19)
255
+ (meetup <$> toEnum 2013 <*> toEnum 1 <@> Third <@> Saturday)
256
+
257
+ test "third Saturday of February 2013" $
258
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 2 <*> toEnum 16)
259
+ (meetup <$> toEnum 2013 <*> toEnum 2 <@> Third <@> Saturday)
260
+
261
+ test "third Sunday of March 2013" $
262
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 3 <*> toEnum 17)
263
+ (meetup <$> toEnum 2013 <*> toEnum 3 <@> Third <@> Sunday)
264
+
265
+ test "third Sunday of April 2013" $
266
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 21)
267
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> Third <@> Sunday)
268
+
269
+ test "fourth Monday of March 2013" $
270
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 3 <*> toEnum 25)
271
+ (meetup <$> toEnum 2013 <*> toEnum 3 <@> Fourth <@> Monday)
272
+
273
+ test "fourth Monday of April 2013" $
274
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 22)
275
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> Fourth <@> Monday)
276
+
277
+ test "fourth Tuesday of May 2013" $
278
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 5 <*> toEnum 28)
279
+ (meetup <$> toEnum 2013 <*> toEnum 5 <@> Fourth <@> Tuesday)
280
+
281
+ test "fourth Tuesday of June 2013" $
282
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 6 <*> toEnum 25)
283
+ (meetup <$> toEnum 2013 <*> toEnum 6 <@> Fourth <@> Tuesday)
284
+
285
+ test "fourth Wednesday of July 2013" $
286
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 7 <*> toEnum 24)
287
+ (meetup <$> toEnum 2013 <*> toEnum 7 <@> Fourth <@> Wednesday)
288
+
289
+ test "fourth Wednesday of August 2013" $
290
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 8 <*> toEnum 28)
291
+ (meetup <$> toEnum 2013 <*> toEnum 8 <@> Fourth <@> Wednesday)
292
+
293
+ test "fourth Thursday of September 2013" $
294
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 9 <*> toEnum 26)
295
+ (meetup <$> toEnum 2013 <*> toEnum 9 <@> Fourth <@> Thursday)
296
+
297
+ test "fourth Thursday of October 2013" $
298
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 10 <*> toEnum 24)
299
+ (meetup <$> toEnum 2013 <*> toEnum 10 <@> Fourth <@> Thursday)
300
+
301
+ test "fourth Friday of November 2013" $
302
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 11 <*> toEnum 22)
303
+ (meetup <$> toEnum 2013 <*> toEnum 11 <@> Fourth <@> Friday)
304
+
305
+ test "fourth Friday of December 2013" $
306
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 12 <*> toEnum 27)
307
+ (meetup <$> toEnum 2013 <*> toEnum 12 <@> Fourth <@> Friday)
308
+
309
+ test "fourth Saturday of January 2013" $
310
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 1 <*> toEnum 26)
311
+ (meetup <$> toEnum 2013 <*> toEnum 1 <@> Fourth <@> Saturday)
312
+
313
+ test "fourth Saturday of February 2013" $
314
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 2 <*> toEnum 23)
315
+ (meetup <$> toEnum 2013 <*> toEnum 2 <@> Fourth <@> Saturday)
316
+
317
+ test "fourth Sunday of March 2013" $
318
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 3 <*> toEnum 24)
319
+ (meetup <$> toEnum 2013 <*> toEnum 3 <@> Fourth <@> Sunday)
320
+
321
+ test "fourth Sunday of April 2013" $
322
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 28)
323
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> Fourth <@> Sunday)
324
+
325
+ test "last Monday of March 2013" $
326
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 3 <*> toEnum 25)
327
+ (meetup <$> toEnum 2013 <*> toEnum 3 <@> Last <@> Monday)
328
+
329
+ test "last Monday of April 2013" $
330
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 29)
331
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> Last <@> Monday)
332
+
333
+ test "last Tuesday of May 2013" $
334
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 5 <*> toEnum 28)
335
+ (meetup <$> toEnum 2013 <*> toEnum 5 <@> Last <@> Tuesday)
336
+
337
+ test "last Tuesday of June 2013" $
338
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 6 <*> toEnum 25)
339
+ (meetup <$> toEnum 2013 <*> toEnum 6 <@> Last <@> Tuesday)
340
+
341
+ test "last Wednesday of July 2013" $
342
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 7 <*> toEnum 31)
343
+ (meetup <$> toEnum 2013 <*> toEnum 7 <@> Last <@> Wednesday)
344
+
345
+ test "last Wednesday of August 2013" $
346
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 8 <*> toEnum 28)
347
+ (meetup <$> toEnum 2013 <*> toEnum 8 <@> Last <@> Wednesday)
348
+
349
+ test "last Thursday of September 2013" $
350
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 9 <*> toEnum 26)
351
+ (meetup <$> toEnum 2013 <*> toEnum 9 <@> Last <@> Thursday)
352
+
353
+ test "last Thursday of October 2013" $
354
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 10 <*> toEnum 31)
355
+ (meetup <$> toEnum 2013 <*> toEnum 10 <@> Last <@> Thursday)
356
+
357
+ test "last Friday of November 2013" $
358
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 11 <*> toEnum 29)
359
+ (meetup <$> toEnum 2013 <*> toEnum 11 <@> Last <@> Friday)
360
+
361
+ test "last Friday of December 2013" $
362
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 12 <*> toEnum 27)
363
+ (meetup <$> toEnum 2013 <*> toEnum 12 <@> Last <@> Friday)
364
+
365
+ test "last Saturday of January 2013" $
366
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 1 <*> toEnum 26)
367
+ (meetup <$> toEnum 2013 <*> toEnum 1 <@> Last <@> Saturday)
368
+
369
+ test "last Saturday of February 2013" $
370
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 2 <*> toEnum 23)
371
+ (meetup <$> toEnum 2013 <*> toEnum 2 <@> Last <@> Saturday)
372
+
373
+ test "last Sunday of March 2013" $
374
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 3 <*> toEnum 31)
375
+ (meetup <$> toEnum 2013 <*> toEnum 3 <@> Last <@> Sunday)
376
+
377
+ test "last Sunday of April 2013" $
378
+ Assert.equal (Just $ canonicalDate <$> toEnum 2013 <*> toEnum 4 <*> toEnum 28)
379
+ (meetup <$> toEnum 2013 <*> toEnum 4 <@> Last <@> Sunday)
380
+
381
+ test "last Wednesday of February 2012" $
382
+ Assert.equal (Just $ canonicalDate <$> toEnum 2012 <*> toEnum 2 <*> toEnum 29)
383
+ (meetup <$> toEnum 2012 <*> toEnum 2 <@> Last <@> Wednesday)
384
+
385
+ test "last Wednesday of December 2014" $
386
+ Assert.equal (Just $ canonicalDate <$> toEnum 2014 <*> toEnum 12 <*> toEnum 31)
387
+ (meetup <$> toEnum 2014 <*> toEnum 12 <@> Last <@> Wednesday)
388
+
389
+ test "last Sunday of February 2015" $
390
+ Assert.equal (Just $ canonicalDate <$> toEnum 2015 <*> toEnum 2 <*> toEnum 22)
391
+ (meetup <$> toEnum 2015 <*> toEnum 2 <@> Last <@> Sunday)
392
+
393
+ test "first Friday of December 2012" $
394
+ Assert.equal (Just $ canonicalDate <$> toEnum 2012 <*> toEnum 12 <*> toEnum 7)
395
+ (meetup <$> toEnum 2012 <*> toEnum 12 <@> First <@> Friday)
@@ -15,18 +15,19 @@ We welcome both improvements to the existing exercises and new exercises.
15
15
  A pool of exercise ideas can be found in the [x-common repo](https://github.com/exercism/x-common).
16
16
 
17
17
  All exercises must be compatible with Python versions 2.7 and 3.3 upwards.
18
- Therefore please test your changes at least with Python2.7 and Python3.5.
18
+ Therefore please test your changes with these versions.
19
19
 
20
- To test a single exercise, say crypto-square, run:
20
+ Test a single exercise with Python 2.7:
21
21
  ```
22
- python2.7 test/check-exercises.py crypto-square
22
+ python2.7 test/check-exercises.py [exercise-name]
23
23
  ```
24
- and
24
+
25
+ Test a single exercise with Python 3.3:
25
26
  ```
26
- python3.5 test/check-exercises.py crypto-square
27
+ python3.3 test/check-exercises.py [exercise-name]
27
28
  ```
28
29
 
29
- To run the tests for all exercises type:
30
+ Test all exercises:
30
31
  ```
31
32
  python test/check-exercises.py
32
33
  ```
@@ -8,7 +8,7 @@ You can either start by creating your own project for working with the Exercism
8
8
 
9
9
  This is a Visual Studio template that comes pre-configured to work on the problems in as many languages as Visual Studio supports.
10
10
 
11
- ![Solution Explorer](/img/SolutionExplorer.png)
11
+ ![Solution Explorer](/docs/img/SolutionExplorer.png)
12
12
 
13
13
  1. Download the [Exercism.io Visual Studio Template](https://github.com/rprouse/Exercism.VisualStudio) from GitHub by clicking the Download Zip button on the page.
14
14
  2. Unzip the template into your exercises directory, for example `C:\src\exercises`
@@ -23,11 +23,11 @@ This is a Visual Studio template that comes pre-configured to work on the proble
23
23
  10. The exercise you just fetched will appear greyed out. Right click on the folder and **Include In Project**
24
24
  11. Get coding...
25
25
 
26
- ![Add files](/img/AddFiles.png)
26
+ ![Add files](/docs/img/AddFiles.png)
27
27
 
28
28
  To run the tests, you can do so at the command line, or within Visual Studio.
29
29
 
30
- ![Test Explorer](/img/TestExplorer.png)
30
+ ![Test Explorer](/docs/img/TestExplorer.png)
31
31
 
32
32
  ## Code Style and Linting
33
33
 
@@ -3,34 +3,51 @@ import unittest
3
3
  from bracket_push import check_brackets
4
4
 
5
5
 
6
+ # test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
7
+
6
8
  class BracketPushTests(unittest.TestCase):
9
+ def test_paired_square_brackets(self):
10
+ self.assertEqual(check_brackets("[]"), True)
7
11
 
8
- def test_input_empty(self):
12
+ def test_empty_string(self):
9
13
  self.assertEqual(check_brackets(""), True)
10
14
 
11
- def test_single(self):
12
- self.assertEqual(check_brackets("{}"), True)
13
-
14
- def test_unclosed(self):
15
- self.assertEqual(check_brackets("{{"), False)
15
+ def test_unpaired_brackets(self):
16
+ self.assertEqual(check_brackets("[["), False)
16
17
 
17
- def test_wrong_order(self):
18
+ def test_wrong_ordered_brackets(self):
18
19
  self.assertEqual(check_brackets("}{"), False)
19
20
 
20
- def test_mixed_not_nested(self):
21
- self.assertEqual(check_brackets("{}[]"), True)
21
+ def test_paired_with_whitespace(self):
22
+ self.assertEqual(check_brackets("{ }"), True)
22
23
 
23
- def test_mixed_nested(self):
24
+ def test_simple_nested_brackets(self):
24
25
  self.assertEqual(check_brackets("{[]}"), True)
25
26
 
26
- def test_improperly_nested(self):
27
- self.assertEqual(check_brackets("{[}]"), False)
27
+ def test_several_paired_brackets(self):
28
+ self.assertEqual(check_brackets("{}[]"), True)
29
+
30
+ def test_paired_and_nested_brackets(self):
31
+ self.assertEqual(check_brackets("([{}({}[])])"), True)
28
32
 
29
- def test_not_opened_nested(self):
33
+ def test_unopened_closing_brackets(self):
30
34
  self.assertEqual(check_brackets("{[)][]}"), False)
31
35
 
32
- def test_nested_ensemble(self):
33
- self.assertEqual(check_brackets("{[]([()])}"), True)
36
+ def test_unpaired_and_nested_brackets(self):
37
+ self.assertEqual(check_brackets("([{])"), False)
38
+
39
+ def test_paired_and_wrong_nested_brackets(self):
40
+ self.assertEqual(check_brackets("[({]})"), False)
41
+
42
+ def test_math_expression(self):
43
+ self.assertEqual(
44
+ check_brackets("(((185 + 223.85) * 15) - 543)/2"), True)
45
+
46
+ def test_complex_latex_expression(self):
47
+ self.assertEqual(
48
+ check_brackets(
49
+ ("\\left(\\begin{array}{cc} \\frac{1}{3} & x\\\\ \\mathrm{e}^{"
50
+ "x} &... x^2 \\end{array}\\right)")), True)
34
51
 
35
52
 
36
53
  if __name__ == '__main__':
@@ -3,6 +3,8 @@ import unittest
3
3
  import hamming
4
4
 
5
5
 
6
+ # test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
7
+
6
8
  class HammingTest(unittest.TestCase):
7
9
 
8
10
  def test_identical_strands(self):
@@ -5,6 +5,8 @@ import unittest
5
5
  from luhn import Luhn
6
6
 
7
7
 
8
+ # test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
9
+
8
10
  class LuhnTests(unittest.TestCase):
9
11
  def test_single_digit_strings_can_not_be_valid(self):
10
12
  self.assertFalse(Luhn("1").is_valid())
@@ -12,6 +12,10 @@ import tempfile
12
12
  import json
13
13
 
14
14
 
15
+ def python_executable_name():
16
+ return 'python{}.{}'.format(sys.version_info.major, sys.version_info.minor)
17
+
18
+
15
19
  def check_assignment(name, test_file):
16
20
  # Returns the exit code of the tests
17
21
  workdir = tempfile.mkdtemp(name)
@@ -21,7 +25,7 @@ def check_assignment(name, test_file):
21
25
  shutil.copyfile(test_file, test_file_out)
22
26
  shutil.copyfile(os.path.join(os.path.dirname(test_file), 'example.py'),
23
27
  os.path.join(workdir, '{}.py'.format(example_name)))
24
- return subprocess.call(['python', test_file_out])
28
+ return subprocess.call([python_executable_name(), test_file_out])
25
29
  finally:
26
30
  shutil.rmtree(workdir)
27
31
 
@@ -91,6 +95,8 @@ def main():
91
95
  failures.append('{} (TestFailed)'.format(exercise))
92
96
  print('')
93
97
 
98
+ print('TestEnvironment:', python_executable_name().capitalize(), end='\n\n')
99
+
94
100
  if failures:
95
101
  print('FAILURES: ', ', '.join(failures))
96
102
  raise SystemExit(1)