trackler 2.0.0.5 → 2.0.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/bash/docs/TESTS.md +1 -1
  4. data/tracks/bash/exercises/bob/bob_test.sh +2 -0
  5. data/tracks/bash/exercises/gigasecond/gigasecond_test.sh +2 -0
  6. data/tracks/bash/exercises/hamming/hamming_test.sh +2 -0
  7. data/tracks/bash/exercises/hello-world/hello_world_test.sh +2 -0
  8. data/tracks/bash/exercises/leap/leap_test.sh +2 -0
  9. data/tracks/bash/exercises/raindrops/raindrops_test.sh +2 -0
  10. data/tracks/bash/exercises/rna-transcription/rna_transcription_test.sh +2 -0
  11. data/tracks/c/bin/verify-indent +5 -1
  12. data/tracks/c/config.json +10 -1
  13. data/tracks/c/exercises/clock/src/clock.h +1 -1
  14. data/tracks/c/exercises/largest-series-product/test/test_largest_series_product.c +1 -1
  15. data/tracks/c/exercises/phone-number/src/example.c +4 -2
  16. data/tracks/c/exercises/roman-numerals/src/example.c +20 -21
  17. data/tracks/c/exercises/roman-numerals/src/example.h +1 -1
  18. data/tracks/c/exercises/roman-numerals/test/test_roman_numerals.c +1 -0
  19. data/tracks/c/exercises/sum-of-multiples/src/example.c +3 -1
  20. data/tracks/c/exercises/sum-of-multiples/src/example.h +3 -1
  21. data/tracks/c/exercises/sum-of-multiples/test/test_sum_of_multiples.c +44 -22
  22. data/tracks/c/exercises/word-count/makefile +16 -0
  23. data/tracks/c/exercises/word-count/src/example.c +65 -0
  24. data/tracks/c/exercises/word-count/src/word_count.h +22 -0
  25. data/tracks/c/exercises/word-count/test/test_word_count.c +372 -0
  26. data/tracks/c/exercises/word-count/test/vendor/unity.c +1300 -0
  27. data/tracks/c/exercises/word-count/test/vendor/unity.h +274 -0
  28. data/tracks/c/exercises/word-count/test/vendor/unity_internals.h +701 -0
  29. data/tracks/crystal/.gitignore +1 -0
  30. data/tracks/crystal/Makefile +6 -0
  31. data/tracks/crystal/README.md +25 -0
  32. data/tracks/crystal/config.json +10 -2
  33. data/tracks/crystal/exercises/acronym/spec/acronym_spec.cr +32 -0
  34. data/tracks/crystal/exercises/acronym/src/example.cr +7 -0
  35. data/tracks/crystal/exercises/hello-world/spec/hello_world_spec.cr +8 -10
  36. data/tracks/crystal/exercises/hello-world/src/example.cr +1 -1
  37. data/tracks/crystal/src/generator/exercises/acronym.cr +34 -0
  38. data/tracks/crystal/src/generator/exercises/exercise_generator.cr +39 -0
  39. data/tracks/crystal/src/generator/exercises/exercise_test_case.cr +8 -0
  40. data/tracks/crystal/src/generator/exercises/hello_world.cr +38 -0
  41. data/tracks/crystal/src/generator/exercises/templates/example.tt +10 -0
  42. data/tracks/crystal/src/generator/generate.cr +15 -0
  43. data/tracks/crystal/src/generator/spec/exercise_generator_spec.cr +27 -0
  44. data/tracks/crystal/src/generator/spec/exercise_test_case_spec.cr +23 -0
  45. data/tracks/elixir/exercises/space-age/space_age.exs +1 -1
  46. data/tracks/elm/config.json +5 -31
  47. data/tracks/elm/elm-package.json +1 -0
  48. data/tracks/elm/exercises/bob/BobTests.elm +1 -1
  49. data/tracks/elm/exercises/run-length-encoding/RunLengthEncoding.elm +5 -0
  50. data/tracks/elm/exercises/scrabble-score/ScrabbleScore.elm +1 -0
  51. data/tracks/elm/exercises/scrabble-score/ScrabbleScore.example +32 -0
  52. data/tracks/elm/exercises/scrabble-score/ScrabbleScoreTests.elm +43 -0
  53. data/tracks/elm/exercises/scrabble-score/elm-package.json +16 -0
  54. data/tracks/elm/exercises/scrabble-score/runtests.bat +1 -0
  55. data/tracks/elm/exercises/scrabble-score/runtests.sh +2 -0
  56. data/tracks/elm/exercises/sublist/Sublist.elm +5 -0
  57. data/tracks/fsharp/exercises/sum-of-multiples/SumOfMultiplesTest.fs +6 -1
  58. data/tracks/haskell/docs/LEARNING.md +11 -2
  59. data/tracks/haskell/exercises/list-ops/test/Tests.hs +2 -0
  60. data/tracks/java/config.json +13 -1
  61. data/tracks/java/exercises/etl/src/test/java/EtlTest.java +101 -55
  62. data/tracks/java/exercises/hello-world/TUTORIAL.md +1 -1
  63. data/tracks/java/exercises/largest-series-product/build.gradle +17 -0
  64. data/tracks/java/exercises/largest-series-product/src/example/java/LargestSeriesProductCalculator.java +56 -0
  65. data/tracks/java/exercises/largest-series-product/src/main/java/LargestSeriesProductCalculator.java +5 -0
  66. data/tracks/java/exercises/largest-series-product/src/test/java/LargestSeriesProductCalculatorTest.java +218 -0
  67. data/tracks/java/exercises/queen-attack/build.gradle +17 -0
  68. data/tracks/java/exercises/queen-attack/src/example/java/BoardCoordinate.java +39 -0
  69. data/tracks/java/exercises/queen-attack/src/example/java/QueenAttackCalculator.java +54 -0
  70. data/tracks/java/exercises/queen-attack/src/main/java/BoardCoordinate.java +5 -0
  71. data/tracks/java/exercises/queen-attack/src/main/java/QueenAttackCalculator.java +5 -0
  72. data/tracks/java/exercises/queen-attack/src/test/java/QueenAttackCalculatorTest.java +135 -0
  73. data/tracks/java/exercises/settings.gradle +2 -0
  74. data/tracks/ocaml/exercises/leap/test.ml +17 -6
  75. data/tracks/rust/_test/check-exercises.sh +5 -0
  76. data/tracks/swift/docs/TESTS.md +23 -3
  77. metadata +35 -2
@@ -0,0 +1,135 @@
1
+ import org.junit.Ignore;
2
+ import org.junit.Rule;
3
+ import org.junit.Test;
4
+ import org.junit.rules.ExpectedException;
5
+
6
+ import static org.junit.Assert.assertFalse;
7
+ import static org.junit.Assert.assertTrue;
8
+
9
+ public final class QueenAttackCalculatorTest {
10
+
11
+ /*
12
+ * See https://github.com/junit-team/junit4/wiki/Rules for information on JUnit Rules in general and
13
+ * ExpectedExceptions in particular.
14
+ */
15
+ @Rule
16
+ public ExpectedException expectedException = ExpectedException.none();
17
+
18
+ @Ignore
19
+ @Test
20
+ public void testCoordinateWithNegativeRankNotAllowed() {
21
+ expectedException.expect(IllegalArgumentException.class);
22
+ expectedException.expectMessage("Coordinate must have positive rank.");
23
+
24
+ new BoardCoordinate(-2, 2);
25
+ }
26
+
27
+ @Ignore
28
+ @Test
29
+ public void testCoordinateWithRankGreaterThan7NotAllowed() {
30
+ expectedException.expect(IllegalArgumentException.class);
31
+ expectedException.expectMessage("Coordinate must have rank <= 7.");
32
+
33
+ new BoardCoordinate(8, 4);
34
+ }
35
+
36
+ @Ignore
37
+ @Test
38
+ public void testCoordinateWithNegativeFileNotAllowed() {
39
+ expectedException.expect(IllegalArgumentException.class);
40
+ expectedException.expectMessage("Coordinate must have positive file.");
41
+
42
+ new BoardCoordinate(2, -2);
43
+ }
44
+
45
+ @Ignore
46
+ @Test
47
+ public void testCoordinateWithFileGreaterThan7NotAllowed() {
48
+ expectedException.expect(IllegalArgumentException.class);
49
+ expectedException.expectMessage("Coordinate must have file <= 7.");
50
+
51
+ new BoardCoordinate(4, 8);
52
+ }
53
+
54
+ @Ignore
55
+ @Test
56
+ public void testNullCoordinateNotAllowed() {
57
+ expectedException.expect(IllegalArgumentException.class);
58
+ expectedException.expectMessage("You must supply valid board coordinates for both Queens.");
59
+
60
+ new QueenAttackCalculator(null, new BoardCoordinate(0, 7));
61
+ }
62
+
63
+ @Ignore
64
+ @Test
65
+ public void testQueensMustNotOccupyTheSameSquare() {
66
+ expectedException.expect(IllegalArgumentException.class);
67
+ expectedException.expectMessage("Queens may not occupy the same board coordinate.");
68
+
69
+ new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(2, 2));
70
+ }
71
+
72
+ @Ignore
73
+ @Test
74
+ public void testQueensThatDoNotShareRankFileOrDiagonalCannotAttack() {
75
+ final QueenAttackCalculator calculator
76
+ = new QueenAttackCalculator(new BoardCoordinate(2, 4), new BoardCoordinate(6, 6));
77
+
78
+ assertFalse(calculator.canQueensAttackOneAnother());
79
+ }
80
+
81
+ @Ignore
82
+ @Test
83
+ public void testQueensCanAttackOnTheSameRank() {
84
+ final QueenAttackCalculator calculator
85
+ = new QueenAttackCalculator(new BoardCoordinate(2, 4), new BoardCoordinate(2, 6));
86
+
87
+ assertTrue(calculator.canQueensAttackOneAnother());
88
+ }
89
+
90
+ @Ignore
91
+ @Test
92
+ public void testQueensCanAttackOnTheSameFile() {
93
+ final QueenAttackCalculator calculator
94
+ = new QueenAttackCalculator(new BoardCoordinate(4, 5), new BoardCoordinate(2, 5));
95
+
96
+ assertTrue(calculator.canQueensAttackOneAnother());
97
+ }
98
+
99
+ @Ignore
100
+ @Test
101
+ public void testQueensCanAttackOnFirstDiagonal() {
102
+ final QueenAttackCalculator calculator
103
+ = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(0, 4));
104
+
105
+ assertTrue(calculator.canQueensAttackOneAnother());
106
+ }
107
+
108
+ @Ignore
109
+ @Test
110
+ public void testQueensCanAttackOnSecondDiagonal() {
111
+ final QueenAttackCalculator calculator
112
+ = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(3, 1));
113
+
114
+ assertTrue(calculator.canQueensAttackOneAnother());
115
+ }
116
+
117
+ @Ignore
118
+ @Test
119
+ public void testQueensCanAttackOnThirdDiagonal() {
120
+ final QueenAttackCalculator calculator
121
+ = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(1, 1));
122
+
123
+ assertTrue(calculator.canQueensAttackOneAnother());
124
+ }
125
+
126
+ @Ignore
127
+ @Test
128
+ public void testQueensCanAttackOnFourthDiagonal() {
129
+ final QueenAttackCalculator calculator
130
+ = new QueenAttackCalculator(new BoardCoordinate(2, 2), new BoardCoordinate(5, 5));
131
+
132
+ assertTrue(calculator.canQueensAttackOneAnother());
133
+ }
134
+
135
+ }
@@ -14,6 +14,7 @@ include 'grade-school'
14
14
  include 'hamming'
15
15
  include 'hexadecimal'
16
16
  include 'hello-world'
17
+ include 'largest-series-product'
17
18
  include 'linked-list'
18
19
  include 'luhn'
19
20
  include 'meetup'
@@ -24,6 +25,7 @@ include 'pangram'
24
25
  include 'pascals-triangle'
25
26
  include 'phone-number'
26
27
  include 'pig-latin'
28
+ include 'queen-attack'
27
29
  include 'raindrops'
28
30
  include 'rna-transcription'
29
31
  include 'robot-name'
@@ -4,11 +4,22 @@ open Leap
4
4
 
5
5
  let ae exp got _test_ctxt = assert_equal exp got
6
6
 
7
- let tests = ["leap year" >:: ae true (leap_year 1996);
8
- "not leap year" >:: ae false (leap_year 1997);
9
- "century" >:: ae false (leap_year 1900);
10
- "fourth century" >:: ae true (leap_year 2400);
11
- ]
7
+ let tests = [
8
+ "leap year" >::
9
+ ae true (leap_year 1996);
10
+ "standard and odd year" >::
11
+ ae false (leap_year 1997);
12
+ "standard even year" >::
13
+ ae false (leap_year 1998);
14
+ "standard nineteenth century" >::
15
+ ae false (leap_year 1900);
16
+ "standard eighteenth century" >::
17
+ ae false (leap_year 1800);
18
+ "leap twenty fourth century" >::
19
+ ae true (leap_year 2400);
20
+ "leap y2k" >::
21
+ ae true (leap_year 2000);
22
+ ]
12
23
 
13
24
  let () =
14
- run_test_tt_main ("leap tests" >::: tests)
25
+ run_test_tt_main ("leap tests" >::: tests)
@@ -28,6 +28,11 @@ for exercise in exercises/*/tests; do
28
28
  [ -d src ] || mkdir src
29
29
  cp example.rs src/lib.rs
30
30
 
31
+ # Overwrite empty Cargo.toml if an example specific file exists
32
+ if [ -f Cargo-example.toml ]; then
33
+ cp Cargo-example.toml Cargo.toml
34
+ fi
35
+
31
36
  # Forcibly strip all "ignore" statements from the testing files
32
37
  for test in tests/*.rs; do
33
38
  sed -i '/\[ignore\]/d' $test
@@ -1,19 +1,39 @@
1
1
  ### Creating the project in Xcode
2
2
 
3
- Please see [Apple's guide on XCTest](https://developer.apple.com/library/tvos/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/02-quick_start.html#//apple_ref/doc/uid/TP40014132-CH2-SW1)
3
+ Please see <a href="https://developer.apple.com/library/tvos/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/02-quick_start.html#//apple_ref/doc/uid/TP40014132-CH2-SW1" target="_blank">Apple's guide on XCTest</a>
4
4
 
5
5
  These steps will use the `bob` exercise as an example. If you are not working on `bob`, replace `bob` with your exercise name in the steps below.
6
6
 
7
7
  * Select iOS-->Application and then Single View Application and click Next.
8
+
8
9
  * Enter `bob-swift`* as your Product Name, set the language to Swift, and check "Include Unit Tests", and then click Next.
10
+
9
11
  * Save the project in the same folder as the Exercism test file:
12
+
10
13
  ![screen shot 2016-02-29 at 1 50 17 pm](https://cloud.githubusercontent.com/assets/1554169/13405215/67123310-deeb-11e5-9a2e-7c375ee5fad6.png)
14
+
11
15
  * You will see two targets in your project, one for the application named `bob-swift` and one for tests named `bob-swiftTests`. If you chose to create an OSX application instead of an iOS application, you will not see a `bob-swiftTests` target and will have to create it manually.
16
+
12
17
  * Drag the Exercism test file into the bob-swiftTests group, ensure that "Copy items if needed" is checked, and add the line `@testable import bob_swift ` on the second line of the Exercism test file:
18
+
13
19
  ![screen shot 2016-02-29 at 1 50 48 pm](https://cloud.githubusercontent.com/assets/1554169/13405240/7f1aadfc-deeb-11e5-8aa5-3ca7e1a12312.png)
14
- * Create the working file/class (in this case, `Bob.swift`), and save **in the same folder as the Exercism test file**: _[see first image]_
20
+
21
+ * Create the working file/class (in this case, `Bob.swift`), and save **in the same folder as the Exercism test file**: _[see first image]_. Then, in Xcode, drag this file inside the bob-swift folder _[see second image]_.
22
+
15
23
  * Select `Bob.swift` and in the File Inspector make sure that both `bob-swift` and `bob-swiftTests` are checked in the Target Membership area.
16
- * Now use CMD-U to run the tests, and happy coding!
24
+
25
+ * Write the solution of the exercise in your working file (Bob.swift), in order to make the tests from the test file (BobTest.swift) succeed. Now the BobTest.swift file will show you some errors, but writing the right code in your working file Bob.swift should make them disappear.
26
+
27
+ * Don't write code or modify the BobTest.swift file, this file is only to verify if the code you wrote in your Bob.swift file is right. Neither add in your working file anything from the testing file, just take it as a reference to figure out how to solve the exercise. _If you prefer, you can also work in an independent Playground file and then copy your final code into your working file (Bob.swift) and continue with the testing._
28
+
29
+ * Then you just need to go to the Test Navigator _[see image below]_ and click on the grey play button next to the main test (BobTest in this case). If the tests passed, they will show you a green checkmark, if not, a red x mark. Modify your code on your working file (Bob.swift) until all the tests succeed.
30
+
31
+ <img width="256" alt="twx-runtst-6_2x" src="https://cloud.githubusercontent.com/assets/22910264/20458849/b8cd18ce-aeb0-11e6-833d-eb97aac2cb36.png">
32
+
33
+ * Some notes: XCTestCase is the XCTest subclass that contains our tests methods and XCTAssert lines are the expected results, with different types depending on what are you testing. Learn more about XCTAssert Methods and XCTesting itself <a href="http://rshankar.com/assertions-supported-in-xctest/" target="_blank">here</a> and <a href="http://nshipster.com/xctestcase/" target="_blank">here</a>.
34
+
35
+ * Now run the tests, and happy coding!
36
+
17
37
  * When you are ready to submit, do so from the folder that contains the working file (`Bob.swift`) and the Exercism test file (`BobTest.swift`):
18
38
  `$> exercism submit Bob.swift`
19
39
 
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.0.0.5
4
+ version: 2.0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-13 00:00:00.000000000 Z
11
+ date: 2016-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -668,6 +668,13 @@ files:
668
668
  - tracks/c/exercises/sum-of-multiples/test/vendor/unity.c
669
669
  - tracks/c/exercises/sum-of-multiples/test/vendor/unity.h
670
670
  - tracks/c/exercises/sum-of-multiples/test/vendor/unity_internals.h
671
+ - tracks/c/exercises/word-count/makefile
672
+ - tracks/c/exercises/word-count/src/example.c
673
+ - tracks/c/exercises/word-count/src/word_count.h
674
+ - tracks/c/exercises/word-count/test/test_word_count.c
675
+ - tracks/c/exercises/word-count/test/vendor/unity.c
676
+ - tracks/c/exercises/word-count/test/vendor/unity.h
677
+ - tracks/c/exercises/word-count/test/vendor/unity_internals.h
671
678
  - tracks/c/img/icon.png
672
679
  - tracks/c/indent.sh
673
680
  - tracks/ceylon/.git
@@ -1109,6 +1116,8 @@ files:
1109
1116
  - tracks/crystal/docs/LEARNING.md
1110
1117
  - tracks/crystal/docs/RESOURCES.md
1111
1118
  - tracks/crystal/docs/TESTS.md
1119
+ - tracks/crystal/exercises/acronym/spec/acronym_spec.cr
1120
+ - tracks/crystal/exercises/acronym/src/example.cr
1112
1121
  - tracks/crystal/exercises/anagram/spec/anagram_spec.cr
1113
1122
  - tracks/crystal/exercises/anagram/src/example.cr
1114
1123
  - tracks/crystal/exercises/atbash-cipher/spec/atbash_cipher_spec.cr
@@ -1141,6 +1150,14 @@ files:
1141
1150
  - tracks/crystal/exercises/sieve/spec/sieve_spec.cr
1142
1151
  - tracks/crystal/exercises/sieve/src/example.cr
1143
1152
  - tracks/crystal/img/icon.png
1153
+ - tracks/crystal/src/generator/exercises/acronym.cr
1154
+ - tracks/crystal/src/generator/exercises/exercise_generator.cr
1155
+ - tracks/crystal/src/generator/exercises/exercise_test_case.cr
1156
+ - tracks/crystal/src/generator/exercises/hello_world.cr
1157
+ - tracks/crystal/src/generator/exercises/templates/example.tt
1158
+ - tracks/crystal/src/generator/generate.cr
1159
+ - tracks/crystal/src/generator/spec/exercise_generator_spec.cr
1160
+ - tracks/crystal/src/generator/spec/exercise_test_case_spec.cr
1144
1161
  - tracks/csharp/.git
1145
1162
  - tracks/csharp/.gitignore
1146
1163
  - tracks/csharp/.paket/paket.bootstrapper.exe
@@ -2119,6 +2136,12 @@ files:
2119
2136
  - tracks/elm/exercises/say/elm-package.json
2120
2137
  - tracks/elm/exercises/say/runtests.bat
2121
2138
  - tracks/elm/exercises/say/runtests.sh
2139
+ - tracks/elm/exercises/scrabble-score/ScrabbleScore.elm
2140
+ - tracks/elm/exercises/scrabble-score/ScrabbleScore.example
2141
+ - tracks/elm/exercises/scrabble-score/ScrabbleScoreTests.elm
2142
+ - tracks/elm/exercises/scrabble-score/elm-package.json
2143
+ - tracks/elm/exercises/scrabble-score/runtests.bat
2144
+ - tracks/elm/exercises/scrabble-score/runtests.sh
2122
2145
  - tracks/elm/exercises/series/Series.elm
2123
2146
  - tracks/elm/exercises/series/Series.example
2124
2147
  - tracks/elm/exercises/series/SeriesTests.elm
@@ -3431,6 +3454,10 @@ files:
3431
3454
  - tracks/java/exercises/hexadecimal/src/main/java/.keep
3432
3455
  - tracks/java/exercises/hexadecimal/src/test/java/.keep
3433
3456
  - tracks/java/exercises/hexadecimal/src/test/java/HexadecimalTest.java
3457
+ - tracks/java/exercises/largest-series-product/build.gradle
3458
+ - tracks/java/exercises/largest-series-product/src/example/java/LargestSeriesProductCalculator.java
3459
+ - tracks/java/exercises/largest-series-product/src/main/java/LargestSeriesProductCalculator.java
3460
+ - tracks/java/exercises/largest-series-product/src/test/java/LargestSeriesProductCalculatorTest.java
3434
3461
  - tracks/java/exercises/linked-list/build.gradle
3435
3462
  - tracks/java/exercises/linked-list/src/example/java/.keep
3436
3463
  - tracks/java/exercises/linked-list/src/example/java/Deque.java
@@ -3486,6 +3513,12 @@ files:
3486
3513
  - tracks/java/exercises/prime-factors/src/example/java/PrimeFactors.java
3487
3514
  - tracks/java/exercises/prime-factors/src/main/java/.keep
3488
3515
  - tracks/java/exercises/prime-factors/src/test/java/PrimeFactorsTest.java
3516
+ - tracks/java/exercises/queen-attack/build.gradle
3517
+ - tracks/java/exercises/queen-attack/src/example/java/BoardCoordinate.java
3518
+ - tracks/java/exercises/queen-attack/src/example/java/QueenAttackCalculator.java
3519
+ - tracks/java/exercises/queen-attack/src/main/java/BoardCoordinate.java
3520
+ - tracks/java/exercises/queen-attack/src/main/java/QueenAttackCalculator.java
3521
+ - tracks/java/exercises/queen-attack/src/test/java/QueenAttackCalculatorTest.java
3489
3522
  - tracks/java/exercises/raindrops/build.gradle
3490
3523
  - tracks/java/exercises/raindrops/src/example/java/Raindrops.java
3491
3524
  - tracks/java/exercises/raindrops/src/main/java/.keep