trackler 2.1.0.14 → 2.1.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/csharp/exercises/acronym/AcronymTest.cs +2 -2
  4. data/tracks/ecmascript/config.json +8 -1
  5. data/tracks/ecmascript/exercises/connect/connect.spec.js +110 -0
  6. data/tracks/ecmascript/exercises/connect/example.js +68 -0
  7. data/tracks/ecmascript/exercises/connect/package.json +82 -0
  8. data/tracks/haskell/exercises/difference-of-squares/package.yaml +1 -1
  9. data/tracks/haskell/exercises/difference-of-squares/test/Tests.hs +3 -4
  10. data/tracks/java/exercises/all-your-base/src/test/java/BaseConverterTest.java +1 -1
  11. data/tracks/java/exercises/bracket-push/src/test/java/BracketCheckerTest.java +1 -1
  12. data/tracks/java/exercises/wordy/src/test/java/WordProblemSolverTest.java +1 -1
  13. data/tracks/lisp/.travis.yml +12 -14
  14. data/tracks/lisp/README.md +16 -48
  15. data/tracks/objective-c/config.json +9 -0
  16. data/tracks/objective-c/exercises/luhn/LuhnExample.h +9 -0
  17. data/tracks/objective-c/exercises/luhn/LuhnExample.m +50 -0
  18. data/tracks/objective-c/exercises/luhn/LuhnTest.m +80 -0
  19. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/project.pbxproj +18 -0
  20. data/tracks/php/config.json +397 -382
  21. data/tracks/php/exercises/binary-search/binary-search_test.php +58 -0
  22. data/tracks/php/exercises/binary-search/example.php +21 -0
  23. data/tracks/php/exercises/nth-prime/example.php +19 -0
  24. data/tracks/php/exercises/nth-prime/nth-prime_test.php +31 -0
  25. data/tracks/php/exercises/pascals-triangle/example.php +28 -0
  26. data/tracks/php/exercises/pascals-triangle/pascals-triangle_test.php +42 -0
  27. data/tracks/python/exercises/difference-of-squares/difference_of_squares_test.py +9 -12
  28. data/tracks/r/docs/INSTALLATION.md +2 -6
  29. data/tracks/rust/exercises/difference-of-squares/Cargo.toml +1 -1
  30. data/tracks/rust/exercises/difference-of-squares/tests/difference-of-square.rs +24 -6
  31. data/tracks/typescript/config.json +6 -0
  32. data/tracks/typescript/exercises/raindrops/package.json +36 -0
  33. data/tracks/typescript/exercises/raindrops/raindrops.example.ts +17 -0
  34. data/tracks/typescript/exercises/raindrops/raindrops.test.ts +38 -0
  35. data/tracks/typescript/exercises/raindrops/tsconfig.json +21 -0
  36. data/tracks/typescript/exercises/raindrops/tslint.json +127 -0
  37. data/tracks/typescript/exercises/raindrops/yarn.lock +2739 -0
  38. metadata +20 -3
  39. data/tracks/lisp/bin/cl-travis-install.sh +0 -325
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4133c47757d7a255d9a21636f63b479e766488b1
4
- data.tar.gz: 54b3438d332c5590e545bccb26376e435c27bcef
3
+ metadata.gz: 4cc8feb981bb581bf3e184bc80c36e688a053780
4
+ data.tar.gz: 99ba32cbd4a8150d8e61cd98529c24e0b9e84560
5
5
  SHA512:
6
- metadata.gz: 87f951253be363fa194a43de8f2fd4b68bdc1e41d08f71e0e7a514d3bfabc8948b452768090215954a1b73e293e28f863cccce2d0a3cce4d149beacc1b2bb8fa
7
- data.tar.gz: e669c4d8420d092bf9e5ce12dabc7ed89bc67a7cdb8ba3537af6895b31e6a1fe71c1a125b723d1a1365bfc93589efb1cf47d5895d7172028c257870ae55a82cd
6
+ metadata.gz: 8ff2e026ea8852d5d536b4c2e2438fe61d73a7f0a3fa5f7722960f9a78425178b9aff48121fbce323625b136869339cf0f2edf407fe56cd72c47c2b3892fce52
7
+ data.tar.gz: d96344f2ceb0c6e8179c1b23c5f1c914ecf329e7ab49a8fc0bcd6afae2e41c304296c1a26efe5414d1eea88df30ed6ed9d924f6364c09610c7f4ff302c4483f4
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.1.0.14"
2
+ VERSION = "2.1.0.15"
3
3
  end
@@ -15,7 +15,7 @@ public void Lowercase_words()
15
15
  }
16
16
 
17
17
  [Fact(Skip = "Remove to run test")]
18
- public void Camelcase()
18
+ public void PascalCase()
19
19
  {
20
20
  Assert.Equal("HTML", Acronym.Abbreviate("HyperText Markup Language"));
21
21
  }
@@ -43,4 +43,4 @@ public void Hyphenated()
43
43
  {
44
44
  Assert.Equal("CMOS", Acronym.Abbreviate("Complementary metal-oxide semiconductor"));
45
45
  }
46
- }
46
+ }
@@ -66,7 +66,8 @@
66
66
  "two-bucket",
67
67
  "diamond",
68
68
  "isogram",
69
- "all-your-base"
69
+ "all-your-base",
70
+ "connect"
70
71
  ],
71
72
  "exercises": [
72
73
  {
@@ -440,6 +441,12 @@
440
441
  "difficulty": 1,
441
442
  "topics": [
442
443
  ]
444
+ },
445
+ {
446
+ "slug": "connect",
447
+ "difficulty": 7,
448
+ "topics": [
449
+ ]
443
450
  }
444
451
  ],
445
452
  "deprecated": [
@@ -0,0 +1,110 @@
1
+ import Board from './connect';
2
+
3
+ describe('Judging a game of connect', () => {
4
+
5
+ it("an empty board has no winner", () => {
6
+ let board = [
7
+ ". . . . .",
8
+ " . . . . .",
9
+ " . . . . .",
10
+ " . . . . .",
11
+ " . . . . ."
12
+ ];
13
+ expect(new Board(board).winner()).toEqual("");
14
+ });
15
+
16
+ xit("X can win on a 1x1 board", () => {
17
+ let board = [
18
+ "X"
19
+ ];
20
+ expect(new Board(board).winner()).toEqual("X");
21
+ });
22
+
23
+ xit("O can win on a 1x1 board", () => {
24
+ let board = [
25
+ "O"
26
+ ];
27
+ expect(new Board(board).winner()).toEqual("O");
28
+ });
29
+
30
+ xit( "only edges does not make a winner", () => {
31
+ let board = [
32
+ "O O O X",
33
+ " X . . X",
34
+ " X . . X",
35
+ " X O O O"
36
+ ];
37
+ expect(new Board(board).winner()).toEqual("");
38
+ });
39
+
40
+ xit("illegal diagonal does not make a winner", () => {
41
+ let board = [
42
+ "X O . .",
43
+ " O X X X",
44
+ " O X O .",
45
+ " . O X .",
46
+ " X X O O"
47
+ ];
48
+ expect(new Board(board).winner()).toEqual("");
49
+ });
50
+
51
+ xit("nobody wins crossing adjacent angles", () => {
52
+ let board = [
53
+ "X . . .",
54
+ " . X O .",
55
+ " O . X O",
56
+ " . O . X",
57
+ " . . O ."
58
+ ];
59
+ expect(new Board(board).winner()).toEqual("");
60
+ });
61
+
62
+ xit("X wins crossing from left to right", () => {
63
+ let board = [
64
+ ". O . .",
65
+ " O X X X",
66
+ " O X O .",
67
+ " X X O X",
68
+ " . O X ."
69
+ ];
70
+ expect(new Board(board).winner()).toEqual("X");
71
+ });
72
+
73
+ xit("O wins crossing from top to bottom", () => {
74
+ let board = [
75
+ ". O . .",
76
+ " O X X X",
77
+ " O O O .",
78
+ " X X O X",
79
+ " . O X ."
80
+ ];
81
+ expect(new Board(board).winner()).toEqual("O");
82
+ });
83
+
84
+ xit("X wins using a convoluted path", () => {
85
+ let board = [
86
+ ". X X . .",
87
+ " X . X . X",
88
+ " . X . X .",
89
+ " . X X . .",
90
+ " O O O O O"
91
+ ];
92
+ expect(new Board(board).winner()).toEqual("X");
93
+ });
94
+
95
+ xit("X wins using a spiral path", () => {
96
+ let board = [
97
+ "O X X X X X X X X",
98
+ " O X O O O O O O O",
99
+ " O X O X X X X X O",
100
+ " O X O X O O O X O",
101
+ " O X O X X X O X O",
102
+ " O X O O O X O X O",
103
+ " O X X X X X O X O",
104
+ " O O O O O O O X O",
105
+ " X X X X X X X X O"
106
+ ];
107
+ expect(new Board(board).winner()).toEqual("X");
108
+ });
109
+
110
+ });
@@ -0,0 +1,68 @@
1
+ /**
2
+ * "Player O" plays from top to bottom, "Player X" plays from left to right.
3
+ * @param board
4
+ */
5
+ export default class {
6
+ constructor(board) {
7
+ this.board = board.map((b) => [...b]);
8
+ }
9
+ winner() {
10
+ const players = ['X','O'];
11
+ for(let player of players) {
12
+ if(this.checkWin(player)) {
13
+ return player;
14
+ }
15
+ }
16
+ return "";
17
+ }
18
+ checkWin(player) {
19
+ let positions = this.startPositions(player);
20
+ for(let position of positions) {
21
+ if(this.search(position, player,[])) {
22
+ return true;
23
+ }
24
+ }
25
+ return false;
26
+ }
27
+ search(pos, XorO, checked) {
28
+ if(! this.matches(pos, XorO)) {
29
+ return false;
30
+ }
31
+ if(this.winningSpot(pos, XorO)) {
32
+ return true;
33
+ }
34
+ checked = checked.slice(0);
35
+ checked.push(pos);
36
+ const matches = this.neighbors(pos).filter(({x,y}) => {
37
+ return this.matches({x,y}, XorO) && checked.filter((spot) => spot.x === x && spot.y === y).length === 0;
38
+ });
39
+ if(matches.length === 0) return false;
40
+ return matches.filter(spot => this.search(spot, XorO, checked)).length > 0;
41
+ }
42
+ neighbors({x,y}) {
43
+ return [
44
+ {x, y: y + 2},
45
+ {x, y: y - 2},
46
+
47
+ {x: x + 1, y: y + 1},
48
+ {x: x - 1, y: y + 1},
49
+
50
+ {x: x + 1, y: y - 1},
51
+ {x: x - 1, y: y - 1}
52
+ ];
53
+ }
54
+ startPositions(XorO) {
55
+ return XorO === "X" ?
56
+ this.board.map((pos, i) => ({x:i,y:i})) :
57
+ this.board[0].map((pos, i) => ({x:0, y:i}));
58
+ }
59
+ winningSpot({x,y},XorO) {
60
+ return XorO === "X" ?
61
+ y === this.board[0].length - 1 + x:
62
+ x === this.board.length - 1;
63
+ }
64
+ matches({x,y}, XorO) {
65
+ return this.board[x] !== undefined && this.board[x][y] === XorO;
66
+ }
67
+ }
68
+
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "xecmascript",
3
+ "version": "0.0.0",
4
+ "description": "Exercism exercises in ECMAScript 6.",
5
+ "author": "Katrina Owen",
6
+ "private": true,
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/exercism/xecmascript"
10
+ },
11
+ "devDependencies": {
12
+ "babel-jest": "^19.0.0",
13
+ "babel-preset-env": "^1.3.3",
14
+ "eslint": "^3.19.0",
15
+ "jest": "^19.0.2"
16
+ },
17
+ "jest": {
18
+ "modulePathIgnorePatterns": [
19
+ "package.json"
20
+ ]
21
+ },
22
+ "babel": {
23
+ "presets": [
24
+ "env"
25
+ ]
26
+ },
27
+ "scripts": {
28
+ "test": "jest --no-cache ./*",
29
+ "watch": "jest --no-cache --watch ./*",
30
+ "lint": "eslint *.js; exit 0;",
31
+ "lint-test": "eslint *.js && jest --no-cache ./* "
32
+ },
33
+ "eslintConfig": {
34
+ "parserOptions": {
35
+ "ecmaVersion": 6,
36
+ "sourceType": "module"
37
+ },
38
+ "rules": {
39
+ "comma-dangle": [
40
+ 2,
41
+ "never"
42
+ ],
43
+ "no-cond-assign": [
44
+ 2,
45
+ "always"
46
+ ],
47
+ "no-console": 2,
48
+ "no-constant-condition": 2,
49
+ "no-control-regex": 2,
50
+ "no-debugger": 2,
51
+ "no-dupe-args": 2,
52
+ "no-dupe-keys": 2,
53
+ "no-duplicate-case": 2,
54
+ "no-empty-character-class": 2,
55
+ "no-empty": 2,
56
+ "no-ex-assign": 2,
57
+ "no-extra-boolean-cast": 2,
58
+ "no-extra-parens": 2,
59
+ "no-extra-semi": 2,
60
+ "no-func-assign": 2,
61
+ "no-inner-declarations": [
62
+ 2,
63
+ "both"
64
+ ],
65
+ "no-invalid-regexp": 2,
66
+ "no-irregular-whitespace": 2,
67
+ "no-negated-in-lhs": 2,
68
+ "no-obj-calls": 2,
69
+ "no-regex-spaces": 2,
70
+ "no-sparse-arrays": 2,
71
+ "no-unexpected-multiline": 2,
72
+ "no-unreachable": 2,
73
+ "use-isnan": 2,
74
+ "valid-jsdoc": 2,
75
+ "valid-typeof": 2
76
+ }
77
+ },
78
+ "licenses": [
79
+ "MIT"
80
+ ],
81
+ "dependencies": {}
82
+ }
@@ -1,5 +1,5 @@
1
1
  name: difference-of-squares
2
- version: 1.0.0.3
2
+ version: 1.1.0.4
3
3
 
4
4
  dependencies:
5
5
  - base
@@ -12,19 +12,18 @@ specs :: Spec
12
12
  specs = do
13
13
 
14
14
  describe "squareOfSums" $ do
15
+ it "square of sum 1" $ squareOfSums 1 `shouldBe` 1
15
16
  it "square of sum 5" $ squareOfSums 5 `shouldBe` 225
16
- it "square of sum 10" $ squareOfSums 10 `shouldBe` 3025
17
17
  it "square of sum 100" $ squareOfSums 100 `shouldBe` 25502500
18
18
 
19
19
  describe "sumOfSquares" $ do
20
+ it "sum of squares 1" $ sumOfSquares 1 `shouldBe` 1
20
21
  it "sum of squares 5" $ sumOfSquares 5 `shouldBe` 55
21
- it "sum of squares 10" $ sumOfSquares 10 `shouldBe` 385
22
22
  it "sum of squares 100" $ sumOfSquares 100 `shouldBe` 338350
23
23
 
24
24
  describe "differenceOfSquares" $ do
25
- it "difference of squares 0" $ difference 0 `shouldBe` 0
25
+ it "difference of squares 1" $ difference 1 `shouldBe` 0
26
26
  it "difference of squares 5" $ difference 5 `shouldBe` 170
27
- it "difference of squares 10" $ difference 10 `shouldBe` 2640
28
27
  it "difference of squares 100" $ difference 100 `shouldBe` 25164150
29
28
 
30
29
  -- Track-specific tests.
@@ -7,7 +7,7 @@ import java.util.Arrays;
7
7
 
8
8
  import static org.junit.Assert.assertArrayEquals;
9
9
 
10
- public final class BaseConverterTest {
10
+ public class BaseConverterTest {
11
11
 
12
12
  /*
13
13
  * See https://github.com/junit-team/junit4/wiki/Rules for information on JUnit Rules in general and
@@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals;
5
5
  import static org.junit.Assert.assertFalse;
6
6
  import static org.junit.Assert.assertTrue;
7
7
 
8
- public final class BracketCheckerTest {
8
+ public class BracketCheckerTest {
9
9
 
10
10
  @Test
11
11
  public void testPairedSquareBrackets() {
@@ -6,7 +6,7 @@ import org.junit.rules.ExpectedException;
6
6
 
7
7
  import static org.junit.Assert.assertEquals;
8
8
 
9
- public final class WordProblemSolverTest {
9
+ public class WordProblemSolverTest {
10
10
 
11
11
  /*
12
12
  * See https://github.com/junit-team/junit4/wiki/Rules for information on JUnit Rules in general and
@@ -3,34 +3,32 @@ language: lisp
3
3
 
4
4
  env:
5
5
  matrix:
6
- - LISP=sbcl
7
- - LISP=ccl
6
+ - LISP=sbcl-bin
7
+ - LISP=ccl-bin
8
8
  - LISP=ecl
9
9
  - LISP=clisp
10
- - LISP=abcl
11
- - LISP=ccl32
12
- - LISP=clisp32
13
- - LISP=sbcl32
14
- # - LISP=allegro
15
- # - LISP=cmucl
10
+ - LISP=abcl-bin
11
+ - LISP=allegro
12
+ # - LISP=clasp
13
+ # - LISP=cmu-bin
16
14
 
17
15
  matrix:
18
16
  fast_finish: true
19
17
  allow_failures:
20
- - env: LISP=abcl
21
- - env: LISP=ccl32
22
- - env: LISP=clisp32
23
- - env: LISP=sbcl32
18
+ - env: LISP=abcl-bin
19
+ - env: LISP=allegro
20
+ # - env: LISP=cmu-bin
21
+ # - env: LISP=clasp
24
22
 
25
23
  install:
26
- - bin/cl-travis-install.sh
24
+ - curl -L 'https://raw.githubusercontent.com/snmsts/roswell/release/scripts/install-for-ci.sh' | sh
27
25
 
28
26
  before_script:
29
27
  - bin/fetch-configlet
30
28
  - bin/configlet .
31
29
 
32
30
  script:
33
- - cl -f 'bin/xlisp-test.lisp' -e '(xlisp-test:travis-build)'
31
+ - ros run -l 'bin/xlisp-test.lisp' -e '(xlisp-test:travis-build)' -q
34
32
 
35
33
  # Cut and paste above to run all tests locally.
36
34
 
@@ -50,25 +50,18 @@ All changes will be built under several implementations via the
50
50
  to be able to run at least some of those same builds locally before
51
51
  submitting the changes.
52
52
 
53
- A contributor will need to install
54
- [CIM](https://github.com/KeenS/CIM),
55
- [QuickLisp](https://www.quicklisp.org/beta/), and a few Lisp
56
- implementations.
53
+ A contributor will need to install:
57
54
 
58
- ###### CIM
55
+ * [Roswell](https://github.com/roswell/roswell)
56
+ * [QuickLisp](https://www.quicklisp.org/beta/)
57
+ * and a few Lisp implementations.
59
58
 
60
- Instructions for installing CIM can be found in its
61
- [README](https://github.com/KeenS/CIM#install). The simplest form is:
62
59
 
63
- ```
64
- curl -L https://raw.github.com/KeenS/CIM/master/scripts/cim_installer | /bin/sh
65
- cim config sh >> ~/.bashrc
66
- ```
60
+ ###### Roswell
67
61
 
68
- Note: the xLisp team does not currently advise using CIM for
69
- installing implementations. While it works well as a
70
- multi-implementation runner, it is not currently sufficient as a
71
- multi-implementation installation and upgrade system.
62
+ Instructions for installing Roswell can be found in
63
+ its
64
+ [README](https://github.com/roswell/roswell#installation-dependency--usage).
72
65
 
73
66
  ###### Lisp Implementations
74
67
 
@@ -76,33 +69,13 @@ It is beyond the scope of this document to describe how to install
76
69
  different Lisp implementations. Please find those instructions on
77
70
  those implementations' websites.
78
71
 
79
- After installing Lisp implementations. Check that CIM can see them by
80
- running `cim list use`. This should list the implementation names
81
- suffixed with `-system` (designating that CIM did not install them).
82
- Then to ensure CIM can use them properly run:
83
-
84
- ```
85
- for i in `cim list use`; do cim use $i; done
86
- ```
72
+ After installing Lisp implementations. Check that Roswell can see them by
73
+ running `ros list installed`.
87
74
 
88
75
  ###### QuickLisp
89
76
 
90
- Instructions to install QuickLisp can be found on this
91
- [website](https://www.quicklisp.org/beta/#installation). Following
92
- these instructions will install the QuickLisp system into
93
- `~/.quicklisp`.
94
-
95
- To ensure CIM and all your implementations know and use QuickLisp you
96
- can run the following commands:
97
-
98
- ```
99
- ln ~/quicklisp ~/.cim/quicklisp
100
- cim for all do -l ~/.quicklisp/setup.lisp -e '(ql:add-to-init-file)'
101
- ```
102
-
103
- (the last command will, for each implementation, install QuickLisp
104
- setup code into that implementation's startup file. It will prompt the
105
- user for confirmation before doing so.
77
+ Although [QuickLisp](https://www.quicklisp.org/beta/) is
78
+ required, Roswell will install and configure it for you, by default.
106
79
 
107
80
  ##### Creating a new exercise.
108
81
 
@@ -120,16 +93,11 @@ Travis build. This build will run all exercises on many Common Lisp
120
93
  implementations. To run the build yourself on your implementation load
121
94
  `bin/xlisp-test.lisp` and then evaluate `(xlisp-test:full-build)`.
122
95
 
123
- If CIM is installed then running all the tests for one implementation
124
- can be done with (this will return with a non-zero error code if there
125
- are problems):
126
-
127
- cl -f bin/xlisp-test.lisp -e '(xlisp-test:travis-build)'
128
-
129
- To run all the tests for *all* the implementations use this command
130
- line:
96
+ If Roswell is installed then running all the tests for one
97
+ implementation can be done with (this will return with a non-zero
98
+ error code if there are problems):
131
99
 
132
- cim for all do -f bin/xlisp-test.lisp -e '(xlisp-test:travis-build)'
100
+ ros run -l 'bin/xlisp-test.lisp' -e '(xlisp-test:travis-build)' -q
133
101
 
134
102
  ##### Style Guidelines
135
103