trackler 2.0.8.41 → 2.0.8.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/common/exercises/triangle/description.md +1 -1
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/.github/stale.yml +1 -0
- data/tracks/csharp/exercises/accumulate/HINTS.md +2 -2
- data/tracks/csharp/exercises/allergies/HINTS.md +1 -1
- data/tracks/csharp/exercises/sum-of-multiples/HINTS.md +3 -0
- data/tracks/csharp/exercises/zebra-puzzle/HINTS.md +3 -0
- data/tracks/go/exercises/change/change_test.go +1 -1
- data/tracks/groovy/LICENSE +21 -0
- data/tracks/java/exercises/nth-prime/src/example/java/{Prime.java → PrimeCalculator.java} +3 -3
- data/tracks/java/exercises/nth-prime/src/test/java/{PrimeTest.java → PrimeCalculatorTest.java} +16 -9
- data/tracks/lisp/.github/stale.yml +0 -0
- data/tracks/lua/.github/stale.yml +22 -0
- data/tracks/perl6/.github/stale.yml +0 -0
- data/tracks/purescript/config.json +7 -0
- data/tracks/purescript/exercises/all-your-base/bower.json +16 -0
- data/tracks/purescript/exercises/all-your-base/examples/src/AllYourBase.purs +28 -0
- data/tracks/purescript/exercises/all-your-base/src/AllYourBase.purs +3 -0
- data/tracks/purescript/exercises/all-your-base/test/Main.purs +97 -0
- data/tracks/python/.github/stale.yml +17 -0
- data/tracks/r/.github/stale.yml +1 -0
- data/tracks/r/LICENSE +21 -0
- data/tracks/r/README.md +111 -2
- data/tracks/rust/exercises/triangle/tests/triangle.rs +5 -8
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad0c8c481adab8fc6597c91e49a145230f5a0e3d
|
4
|
+
data.tar.gz: bf9269a54e783bf01145d450c8712d57eb0d8204
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc3576e5ff9be012b404eafa0776795a2aaf6bd09903bf9cf4f42554b9da8cddb6974c92714b867c232cd8476da1fc504de6e90510d59ccca087bf9ab5329a94
|
7
|
+
data.tar.gz: 25537ab8bb99975a7bb6507c4e9153f722912f6d970c2b64481e75fcc9dd61e1456e7517be2b85226242c1b66cb220f3332b8f298626f4188c7728b82b81dcc1
|
@@ -1,5 +1,5 @@
|
|
1
1
|
An _equilateral_ triangle has all three sides the same length.<br/>
|
2
|
-
An
|
2
|
+
An _isosceles_ triangle has at least two sides the same length. (It is sometimes
|
3
3
|
specified as having exactly two sides the same length, but for the purposes of
|
4
4
|
this exercise we'll say at least two.)<br/>
|
5
5
|
A _scalene_ triangle has all sides of different lengths.
|
data/lib/trackler/version.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -1,2 +1,2 @@
|
|
1
|
-
## Hints
|
2
|
-
This exercise requires you to write an extension method. For more information, see [this page](https://msdn.microsoft.com/en-us//library/bb383977.aspx).
|
1
|
+
## Hints
|
2
|
+
This exercise requires you to write an extension method. For more information, see [this page](https://msdn.microsoft.com/en-us//library/bb383977.aspx).
|
@@ -1,2 +1,2 @@
|
|
1
1
|
## Hints
|
2
|
-
This exercise requires you to use bitwise operations. For more information, see [this page](https://msdn.microsoft.com/en-us/library/6a71f45d.aspx).
|
2
|
+
This exercise requires you to use bitwise operations. For more information, see [this page](https://msdn.microsoft.com/en-us/library/6a71f45d.aspx).
|
@@ -19,7 +19,7 @@ func TestChange(t *testing.T) {
|
|
19
19
|
if tc.valid {
|
20
20
|
if err != nil {
|
21
21
|
t.Fatalf("%s : Change(%v, %d): expected %v, got error %s",
|
22
|
-
tc.description, tc.coins, tc.target, tc.expectedChange, err)
|
22
|
+
tc.description, tc.coins, tc.target, tc.expectedChange, err.Error())
|
23
23
|
} else {
|
24
24
|
if !reflect.DeepEqual(actual, tc.expectedChange) {
|
25
25
|
t.Fatalf("%s : Change(%v, %d): expected %v, actual %v",
|
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Katrina Owen, _@kytrinyx.com
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import java.util.stream.IntStream;
|
2
2
|
|
3
|
-
public final class
|
4
|
-
public
|
3
|
+
public final class PrimeCalculator {
|
4
|
+
public int nth(int nth) {
|
5
5
|
if (nth < 1) {
|
6
6
|
throw new IllegalArgumentException();
|
7
7
|
}
|
@@ -20,7 +20,7 @@ public final class Prime {
|
|
20
20
|
return possiblePrime;
|
21
21
|
}
|
22
22
|
|
23
|
-
private
|
23
|
+
private boolean isPrime(int n) {
|
24
24
|
if (n == 1) {
|
25
25
|
return false;
|
26
26
|
}
|
data/tracks/java/exercises/nth-prime/src/test/java/{PrimeTest.java → PrimeCalculatorTest.java}
RENAMED
@@ -1,44 +1,51 @@
|
|
1
|
-
import org.junit.
|
1
|
+
import org.junit.Before;
|
2
2
|
import org.junit.Ignore;
|
3
3
|
import org.junit.Rule;
|
4
|
+
import org.junit.Test;
|
4
5
|
import org.junit.rules.ExpectedException;
|
5
6
|
|
6
7
|
import static org.hamcrest.CoreMatchers.*;
|
7
8
|
import static org.junit.Assert.*;
|
8
9
|
|
9
|
-
public class
|
10
|
+
public class PrimeCalculatorTest {
|
11
|
+
private PrimeCalculator primeCalculator;
|
12
|
+
|
13
|
+
@Before
|
14
|
+
public void setup() {
|
15
|
+
primeCalculator = new PrimeCalculator();
|
16
|
+
}
|
10
17
|
|
11
18
|
@Rule
|
12
19
|
public ExpectedException thrown = ExpectedException.none();
|
13
|
-
|
20
|
+
|
14
21
|
@Test
|
15
22
|
public void testFirstPrime() {
|
16
|
-
assertThat(
|
23
|
+
assertThat(primeCalculator.nth(1), is(2));
|
17
24
|
}
|
18
25
|
|
19
26
|
@Ignore
|
20
27
|
@Test
|
21
28
|
public void testSecondPrime() {
|
22
|
-
assertThat(
|
29
|
+
assertThat(primeCalculator.nth(2), is(3));
|
23
30
|
}
|
24
31
|
|
25
32
|
@Ignore
|
26
33
|
@Test
|
27
34
|
public void testSixthPrime() {
|
28
|
-
assertThat(
|
35
|
+
assertThat(primeCalculator.nth(6), is(13));
|
29
36
|
}
|
30
37
|
|
31
38
|
@Ignore
|
32
39
|
@Test
|
33
40
|
public void testBigPrime() {
|
34
|
-
assertThat(
|
41
|
+
assertThat(primeCalculator.nth(10001), is(104743));
|
35
42
|
}
|
36
43
|
|
37
44
|
@Ignore
|
38
45
|
@Test
|
39
46
|
public void testUndefinedPrime() {
|
40
47
|
thrown.expect(IllegalArgumentException.class);
|
41
|
-
|
48
|
+
primeCalculator.nth(0);
|
42
49
|
}
|
43
|
-
|
50
|
+
|
44
51
|
}
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Configuration for probot-stale - https://github.com/probot/stale
|
2
|
+
|
3
|
+
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
4
|
+
daysUntilStale: 60
|
5
|
+
# Number of days of inactivity before a stale Issue or Pull Request is closed
|
6
|
+
daysUntilClose: 7
|
7
|
+
# Issues or Pull Requests with these labels will never be considered stale
|
8
|
+
exemptLabels:
|
9
|
+
- pinned
|
10
|
+
- security
|
11
|
+
- good first patch
|
12
|
+
# Label to use when marking as stale
|
13
|
+
staleLabel: wontfix
|
14
|
+
# Comment to post when marking as stale. Set to `false` to disable
|
15
|
+
markComment: >
|
16
|
+
This issue has been automatically marked as stale because it has not had
|
17
|
+
recent activity. It will be closed if no further activity occurs. Thank you
|
18
|
+
for your contributions.
|
19
|
+
# Comment to post when closing a stale Issue or Pull Request. Set to `false` to disable
|
20
|
+
closeComment: false
|
21
|
+
# Limit to only `issues` or `pulls`
|
22
|
+
# only: issues
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"name": "all-your-base",
|
3
|
+
"ignore": [
|
4
|
+
"**/.*",
|
5
|
+
"node_modules",
|
6
|
+
"bower_components",
|
7
|
+
"output"
|
8
|
+
],
|
9
|
+
"dependencies": {
|
10
|
+
"purescript-prelude": "^2.5.0"
|
11
|
+
},
|
12
|
+
"devDependencies": {
|
13
|
+
"purescript-psci-support": "^2.0.0",
|
14
|
+
"purescript-test-unit": "^10.1.0"
|
15
|
+
}
|
16
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module AllYourBase
|
2
|
+
( rebase
|
3
|
+
) where
|
4
|
+
|
5
|
+
import Prelude
|
6
|
+
import Data.Array (all, any, head, length, range, reverse, zipWith)
|
7
|
+
import Data.Foldable (sum)
|
8
|
+
import Data.Int (pow)
|
9
|
+
import Data.Maybe (Maybe(Just, Nothing))
|
10
|
+
import Data.Tuple (Tuple(..))
|
11
|
+
import Data.Unfoldable (unfoldr)
|
12
|
+
|
13
|
+
rebase' :: Int -> Int -> Array Int -> Array Int
|
14
|
+
rebase' inb oub ind =
|
15
|
+
zipWith (*) ind pows
|
16
|
+
# sum
|
17
|
+
# unfoldr fromDec
|
18
|
+
# reverse
|
19
|
+
where pows = map (pow inb) (range (length ind - 1) 0)
|
20
|
+
fromDec 0 = Nothing
|
21
|
+
fromDec n = Just $ Tuple (n `mod` oub) (n / oub)
|
22
|
+
|
23
|
+
rebase :: Int -> Int -> Array Int -> Maybe (Array Int)
|
24
|
+
rebase inb oub ind
|
25
|
+
| all (_ == 0) (head ind) = Nothing
|
26
|
+
| any ((_ < 0) || (inb <= _)) ind = Nothing
|
27
|
+
| inb < 2 || oub < 2 = Nothing
|
28
|
+
| otherwise = Just $ rebase' inb oub ind
|
@@ -0,0 +1,97 @@
|
|
1
|
+
module Test.Main where
|
2
|
+
|
3
|
+
import Prelude
|
4
|
+
import Control.Monad.Eff (Eff)
|
5
|
+
import Data.Maybe (Maybe(..))
|
6
|
+
import Test.Unit.Assert as Assert
|
7
|
+
import Test.Unit (suite, test)
|
8
|
+
import Test.Unit.Main (runTest)
|
9
|
+
import AllYourBase (rebase)
|
10
|
+
|
11
|
+
main :: Eff _ Unit
|
12
|
+
main = runTest do
|
13
|
+
suite "AllYourBase.rebase" do
|
14
|
+
|
15
|
+
test "single bit one to decimal" $
|
16
|
+
Assert.equal (Just [1])
|
17
|
+
(rebase 2 10 [1])
|
18
|
+
|
19
|
+
test "binary to single decimal" $
|
20
|
+
Assert.equal (Just [5])
|
21
|
+
(rebase 2 10 [1,0,1])
|
22
|
+
|
23
|
+
test "single decimal to binary" $
|
24
|
+
Assert.equal (Just [1,0,1])
|
25
|
+
(rebase 10 2 [5])
|
26
|
+
|
27
|
+
test "binary to multiple decimal" $
|
28
|
+
Assert.equal (Just [4,2])
|
29
|
+
(rebase 2 10 [1,0,1,0,1,0])
|
30
|
+
|
31
|
+
test "decimal to binary" $
|
32
|
+
Assert.equal (Just [1,0,1,0,1,0])
|
33
|
+
(rebase 10 2 [4,2])
|
34
|
+
|
35
|
+
test "trinary to hexadecimal" $
|
36
|
+
Assert.equal (Just [2,10])
|
37
|
+
(rebase 3 16 [1,1,2,0])
|
38
|
+
|
39
|
+
test "hexadecimal to trinary" $
|
40
|
+
Assert.equal (Just [1,1,2,0])
|
41
|
+
(rebase 16 3 [2,10])
|
42
|
+
|
43
|
+
test "15-bit integer" $
|
44
|
+
Assert.equal (Just [6,10,45])
|
45
|
+
(rebase 97 73 [3,46,60])
|
46
|
+
|
47
|
+
test "empty list" $
|
48
|
+
Assert.equal Nothing
|
49
|
+
(rebase 2 10 [])
|
50
|
+
|
51
|
+
test "single zero" $
|
52
|
+
Assert.equal Nothing
|
53
|
+
(rebase 10 2 [0])
|
54
|
+
|
55
|
+
test "multiple zeros" $
|
56
|
+
Assert.equal Nothing
|
57
|
+
(rebase 10 2 [0,0,0])
|
58
|
+
|
59
|
+
test "leading zeros" $
|
60
|
+
Assert.equal Nothing
|
61
|
+
(rebase 7 10 [0,6,0])
|
62
|
+
|
63
|
+
test "negative digit" $
|
64
|
+
Assert.equal Nothing
|
65
|
+
(rebase 2 10 [1,-1,1,0,1,0])
|
66
|
+
|
67
|
+
test "invalid positive digit" $
|
68
|
+
Assert.equal Nothing
|
69
|
+
(rebase 2 10 [1,2,1,0,1,0])
|
70
|
+
|
71
|
+
test "first base is one" $
|
72
|
+
Assert.equal Nothing
|
73
|
+
(rebase 1 10 [])
|
74
|
+
|
75
|
+
test "second base is one" $
|
76
|
+
Assert.equal Nothing
|
77
|
+
(rebase 2 1 [1,0,1,0,1,0])
|
78
|
+
|
79
|
+
test "first base is zero" $
|
80
|
+
Assert.equal Nothing
|
81
|
+
(rebase 0 10 [])
|
82
|
+
|
83
|
+
test "second base is zero" $
|
84
|
+
Assert.equal Nothing
|
85
|
+
(rebase 10 0 [7])
|
86
|
+
|
87
|
+
test "first base is negative" $
|
88
|
+
Assert.equal Nothing
|
89
|
+
(rebase (-2) 10 [1])
|
90
|
+
|
91
|
+
test "second base is negative" $
|
92
|
+
Assert.equal Nothing
|
93
|
+
(rebase 2 (-7) [1])
|
94
|
+
|
95
|
+
test "both bases are negative" $
|
96
|
+
Assert.equal Nothing
|
97
|
+
(rebase (-2) (-7) [1])
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Number of days of inactivity before an issue becomes stale
|
2
|
+
daysUntilStale: 21
|
3
|
+
# Number of days of inactivity before a stale issue is closed
|
4
|
+
daysUntilClose: 7
|
5
|
+
# Issues with these labels will never be considered stale
|
6
|
+
exemptLabels:
|
7
|
+
- pinned
|
8
|
+
- security
|
9
|
+
# Label to use when marking an issue as stale
|
10
|
+
staleLabel: on hiatus
|
11
|
+
# Comment to post when marking an issue as stale. Set to `false` to disable
|
12
|
+
markComment: >
|
13
|
+
This issue has been automatically marked as `on hiatus because it has not had
|
14
|
+
recent activity. It will be closed if no further activity occurs. Thank you
|
15
|
+
for your contributions.
|
16
|
+
# Comment to post when closing a stale issue. Set to `false` to disable
|
17
|
+
closeComment: false
|
@@ -0,0 +1 @@
|
|
1
|
+
|
data/tracks/r/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Katrina Owen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/tracks/r/README.md
CHANGED
@@ -4,7 +4,116 @@ Exercism problems in R
|
|
4
4
|
|
5
5
|
## Contributing Guide
|
6
6
|
|
7
|
-
|
7
|
+
- [Asking for help](#asking-for-help)
|
8
|
+
- [How to contribute](#how-to-contribute)
|
9
|
+
* [Reporting or fixing bugs](#reporting-or-fixing-bugs)
|
10
|
+
* [Reviewing issues and pull requests](#reviewing-issues-and-pull-requests)
|
11
|
+
* [Porting exercises](#porting-exercises)
|
12
|
+
* [Updating an exercise test suite](#updating-an-exercise-test-suite)
|
13
|
+
- [Repository structure and conventions](#repository-structure-and-conventions)
|
14
|
+
* [Directory structure](#directory-structure)
|
15
|
+
* [Exercise structure](#exercise-structure)
|
16
|
+
- [Writing an issue](#writing-an-issue)
|
17
|
+
- [Writing a pull request](#writing-a-pull-request)
|
18
|
+
- [Development Dependencies](#development-dependencies)
|
19
|
+
- [Example Solution](#example-solution)
|
20
|
+
- [Test Suite](#test-suite)
|
21
|
+
- [Running Tests](#running-tests)
|
22
|
+
- [R Style Guide](#style-guide)
|
23
|
+
|
24
|
+
### Asking for help
|
25
|
+
If stuck or in doubt just ask! We try our best to be friendly and helpful, so don't be shy!
|
26
|
+
- [gitter support](https://gitter.im/exercism/support): general questions about exercism, setup, track content etc.
|
27
|
+
- [gitter dev](https://gitter.im/exercism/dev): technical questions.
|
28
|
+
|
29
|
+
### How to contribute
|
30
|
+
As a first step we recommend you read the [contributing guide](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md).
|
31
|
+
|
32
|
+
#### Reporting or fixing bugs
|
33
|
+
Typical examples for a bug: A typo, a missing test case, an unclear or ambiguous problem description.
|
34
|
+
- If you are unsure whether you have really found a bug [just ask](#asking-for-help).
|
35
|
+
- To report a bug you can [write an issue](#writing-an-issue).
|
36
|
+
- If you have a fix you can [write a pull request](#writing-a-pull-request).
|
37
|
+
|
38
|
+
#### Reviewing issues and pull requests
|
39
|
+
If you have a dedicated opinion you are welcome to [write a comment](https://help.github.com/articles/commenting-on-a-pull-request/) for an [issue](https://github.com/exercism/xr/issues) or a [pull request](https://github.com/exercism/xr/pulls).
|
40
|
+
Please be detailed and include motivations or relevant links to support your opinion.
|
41
|
+
|
42
|
+
#### Porting exercises
|
43
|
+
Here is the [list of missing exercises](http://exercism.io/languages/r/todo). See here for more information about [porting an exercise](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md#porting-an-exercise-to-another-language-track).
|
44
|
+
Of course you can also add a totally new exercise, but it might be a good idea to first discuss it in one of [our forums](#asking-for-help).
|
45
|
+
|
46
|
+
#### Updating an exercise test suite
|
47
|
+
Updating the test suite of an existing exercise is a special case because it usually affects all languages. Read more about it [here](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md#updating-an-exercise-test-suite).
|
48
|
+
Note that the test suite must run within a couple of seconds.
|
49
|
+
|
50
|
+
### Repository structure and conventions
|
51
|
+
A general description of all the files and directories can be found [here](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md#track-anatomy).
|
52
|
+
|
53
|
+
#### Directory structure
|
54
|
+
```bash
|
55
|
+
├── bin
|
56
|
+
│ └── fetch‐configlet
|
57
|
+
├── docs
|
58
|
+
│ ├── ABOUT.md
|
59
|
+
│ ├── INSTALLATION.md
|
60
|
+
│ ├── LEARNING.md
|
61
|
+
│ ├── RESOURCES.md
|
62
|
+
│ └── TESTS.md
|
63
|
+
└── exercises
|
64
|
+
├── TRACK_HINTS.md
|
65
|
+
└── <exercise-name>
|
66
|
+
│ ├── <exercise-name>.R
|
67
|
+
│ └── example.R
|
68
|
+
│ └── test_<exercise-name>.R
|
69
|
+
└── <exercise-name>
|
70
|
+
│ ├── <exercise-name>.R
|
71
|
+
│ └── example.R
|
72
|
+
│ └── test_<exercise-name>.R
|
73
|
+
└── ...
|
74
|
+
└── img
|
75
|
+
└── icon.png
|
76
|
+
├── .gitignore
|
77
|
+
├── .travis.yml
|
78
|
+
├── LICENSE
|
79
|
+
├── README.md
|
80
|
+
└── config.json
|
81
|
+
```
|
82
|
+
- `config.json`: Note that every exercise has to be registered here, with a unique name and a difficulty. The sequence order in this file determines the default order in which the exercises are fetched.
|
83
|
+
|
84
|
+
#### Exercise structure
|
85
|
+
Each exercise has the following structure:
|
86
|
+
- `HINTS.md` is an optional file containing instructions and/or hints. It is used together with the respective `description.md` for the exercise from [x-common](https://github.com/exercism/x-common) to build the `README.md` file.
|
87
|
+
- `<exercise-name>.R` usually contains an empty function declaration, as a starting point for the required solution.
|
88
|
+
- `example.R` is the source code of the sample solution.
|
89
|
+
- `test_<exercise-name>.R` is the [test suite](#test-suite).
|
90
|
+
|
91
|
+
### Writing an issue
|
92
|
+
To report a bug you should [create an issue](https://help.github.com/articles/creating-an-issue/) [here](https://github.com/exercism/xr/issues).
|
93
|
+
|
94
|
+
### Writing a pull request
|
95
|
+
To fix a bug you should [create a pull request from a fork](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) [here](https://github.com/exercism/xr/pulls). See also [here](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md#git-basics) for more information.
|
96
|
+
|
97
|
+
### Development dependencies
|
98
|
+
You'll need to have a recent version of [R](https://cran.r-project.org/) installed on your system, as well as the `testthat` package (run `install.packages('testthat')` from the R console to install) in order to run tests.
|
99
|
+
|
100
|
+
### Example solution
|
101
|
+
The example solution doesn't have to be perfect, but should pass all of the tests and ideally also strive for a healthy balance of human readability and computational efficiency.
|
102
|
+
|
103
|
+
### Test suite
|
104
|
+
The test suite should be derived from the respective `x-common/exercises/<exercise-name>/canonical-data.json` and comply to some formatting and coding standards (to get an idea you can look at some of the existing tests).
|
105
|
+
|
106
|
+
### Running tests
|
107
|
+
To run the tests for an exercise, simply run `source('test_<exercise-name>.R')` from within the exercise's directory. Note that when testing locally you'll need to (temporarily) replace the first line of `test_<exercise-name>.R` (which sources `<exercise-name>.R`) with `source('example.R')`.
|
108
|
+
|
109
|
+
The example solutions must pass the tests without failures. Additionally the tests should not run longer than a few seconds.
|
110
|
+
|
111
|
+
In order to be accepted by Travis-CI, every exercise must be registered in `config.json`.
|
112
|
+
|
113
|
+
### Style guide
|
114
|
+
Given that there are a variety of R style guides in circulation, at this stage we don't enforce a particular style guide, but our preference is to have R code in this repository follow Hadley Wickham's [R style guide](http://adv-r.had.co.nz/Style.html).
|
115
|
+
|
116
|
+
You are thus encouraged to run [`lintr`](https://github.com/jimhester/lintr) on your R scripts before opening a [pull request](#writing-a-pull-request) in order to check that your code adheres to this style guide before submitting it for review.
|
8
117
|
|
9
118
|
## License
|
10
119
|
|
@@ -13,4 +122,4 @@ The MIT License (MIT)
|
|
13
122
|
Copyright (c) 2014 Katrina Owen, _@kytrinyx.com
|
14
123
|
|
15
124
|
## R icon
|
16
|
-
The R logo was created by Hadley Wickham and others at RStudio. The original file is licensed under version [4.0 of the Creative Commons Attribution-Share Alike license](https://creativecommons.org/licenses/by-sa/4.0/). We have adapted it, changing the colour scheme, for use on Exercism.
|
125
|
+
The R logo was created by [Hadley Wickham](https://github.com/hadley) and others at [RStudio](https://www.rstudio.com/). The original file is licensed under version [4.0 of the Creative Commons Attribution-Share Alike license](https://creativecommons.org/licenses/by-sa/4.0/). We have adapted it, changing the colour scheme, for use on Exercism.
|
@@ -23,7 +23,6 @@ fn equilateral_triangles_have_equal_sides() {
|
|
23
23
|
let sides = [2, 2, 2];
|
24
24
|
let triangle = Triangle::build(sides).unwrap();
|
25
25
|
assert!(triangle.is_equilateral());
|
26
|
-
assert!(!triangle.is_isosceles());
|
27
26
|
assert!(!triangle.is_scalene());
|
28
27
|
}
|
29
28
|
|
@@ -33,13 +32,12 @@ fn larger_equilateral_triangles_have_equal_sides() {
|
|
33
32
|
let sides = [10, 10, 10];
|
34
33
|
let triangle = Triangle::build(sides).unwrap();
|
35
34
|
assert!(triangle.is_equilateral());
|
36
|
-
assert!(!triangle.is_isosceles());
|
37
35
|
assert!(!triangle.is_scalene());
|
38
36
|
}
|
39
37
|
|
40
38
|
#[test]
|
41
39
|
#[ignore]
|
42
|
-
fn
|
40
|
+
fn isosceles_triangles_have_two_equal_sides_one() {
|
43
41
|
let sides = [3, 4, 4];
|
44
42
|
let triangle = Triangle::build(sides).unwrap();
|
45
43
|
assert!(!triangle.is_equilateral());
|
@@ -49,7 +47,7 @@ fn isocseles_triangles_have_two_equal_sides_one() {
|
|
49
47
|
|
50
48
|
#[test]
|
51
49
|
#[ignore]
|
52
|
-
fn
|
50
|
+
fn isosceles_triangles_have_two_equal_sides_two() {
|
53
51
|
let sides = [4, 4, 3];
|
54
52
|
let triangle = Triangle::build(sides).unwrap();
|
55
53
|
assert!(!triangle.is_equilateral());
|
@@ -59,7 +57,7 @@ fn isocseles_triangles_have_two_equal_sides_two() {
|
|
59
57
|
|
60
58
|
#[test]
|
61
59
|
#[ignore]
|
62
|
-
fn
|
60
|
+
fn isosceles_triangles_have_two_equal_sides_three() {
|
63
61
|
let sides = [4, 3, 4];
|
64
62
|
let triangle = Triangle::build(sides).unwrap();
|
65
63
|
assert!(!triangle.is_equilateral());
|
@@ -69,7 +67,7 @@ fn isocseles_triangles_have_two_equal_sides_three() {
|
|
69
67
|
|
70
68
|
#[test]
|
71
69
|
#[ignore]
|
72
|
-
fn
|
70
|
+
fn isosceles_triangles_have_two_equal_sides_four() {
|
73
71
|
let sides = [4, 7, 4];
|
74
72
|
let triangle = Triangle::build(sides).unwrap();
|
75
73
|
assert!(!triangle.is_equilateral());
|
@@ -156,12 +154,11 @@ fn sum_of_two_sides_must_equal_or_exceed_the_remaining_side_two() {
|
|
156
154
|
// let sides = [0.2, 0.2, 0.2];
|
157
155
|
// let triangle = Triangle::build(sides).unwrap();
|
158
156
|
// assert!(triangle.is_equilateral());
|
159
|
-
// assert!(!triangle.is_isosceles());
|
160
157
|
// assert!(!triangle.is_scalene());
|
161
158
|
// }
|
162
159
|
//
|
163
160
|
// #[test]
|
164
|
-
// fn
|
161
|
+
// fn isosceles_triangle_with_floating_point_sides() {
|
165
162
|
// let sides = [0.3, 0.4, 0.4];
|
166
163
|
// let triangle = Triangle::build(sides).unwrap();
|
167
164
|
// assert!(!triangle.is_equilateral());
|
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.8.
|
4
|
+
version: 2.0.8.42
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -557,6 +557,7 @@ files:
|
|
557
557
|
- tracks/bash/exercises/rna-transcription/rna_transcription_test.sh
|
558
558
|
- tracks/bash/img/icon.png
|
559
559
|
- tracks/c/.git
|
560
|
+
- tracks/c/.github/stale.yml
|
560
561
|
- tracks/c/.gitignore
|
561
562
|
- tracks/c/.travis.yml
|
562
563
|
- tracks/c/README.md
|
@@ -1805,6 +1806,7 @@ files:
|
|
1805
1806
|
- tracks/csharp/exercises/sublist/Sublist.csproj
|
1806
1807
|
- tracks/csharp/exercises/sublist/SublistTest.cs
|
1807
1808
|
- tracks/csharp/exercises/sum-of-multiples/Example.cs
|
1809
|
+
- tracks/csharp/exercises/sum-of-multiples/HINTS.md
|
1808
1810
|
- tracks/csharp/exercises/sum-of-multiples/SumOfMultiples.cs
|
1809
1811
|
- tracks/csharp/exercises/sum-of-multiples/SumOfMultiples.csproj
|
1810
1812
|
- tracks/csharp/exercises/sum-of-multiples/SumOfMultiplesTest.cs
|
@@ -1853,6 +1855,7 @@ files:
|
|
1853
1855
|
- tracks/csharp/exercises/wordy/Wordy.csproj
|
1854
1856
|
- tracks/csharp/exercises/wordy/WordyTest.cs
|
1855
1857
|
- tracks/csharp/exercises/zebra-puzzle/Example.cs
|
1858
|
+
- tracks/csharp/exercises/zebra-puzzle/HINTS.md
|
1856
1859
|
- tracks/csharp/exercises/zebra-puzzle/ZebraPuzzle.cs
|
1857
1860
|
- tracks/csharp/exercises/zebra-puzzle/ZebraPuzzle.csproj
|
1858
1861
|
- tracks/csharp/exercises/zebra-puzzle/ZebraPuzzleTest.cs
|
@@ -3603,6 +3606,7 @@ files:
|
|
3603
3606
|
- tracks/groovy/.git
|
3604
3607
|
- tracks/groovy/.gitignore
|
3605
3608
|
- tracks/groovy/.travis.yml
|
3609
|
+
- tracks/groovy/LICENSE
|
3606
3610
|
- tracks/groovy/README.md
|
3607
3611
|
- tracks/groovy/SETUP.md
|
3608
3612
|
- tracks/groovy/bin/fetch-configlet
|
@@ -4405,9 +4409,9 @@ files:
|
|
4405
4409
|
- tracks/java/exercises/minesweeper/src/main/java/MinesweeperBoard.java
|
4406
4410
|
- tracks/java/exercises/minesweeper/src/test/java/MinesweeperBoardTest.java
|
4407
4411
|
- tracks/java/exercises/nth-prime/build.gradle
|
4408
|
-
- tracks/java/exercises/nth-prime/src/example/java/
|
4412
|
+
- tracks/java/exercises/nth-prime/src/example/java/PrimeCalculator.java
|
4409
4413
|
- tracks/java/exercises/nth-prime/src/main/java/.keep
|
4410
|
-
- tracks/java/exercises/nth-prime/src/test/java/
|
4414
|
+
- tracks/java/exercises/nth-prime/src/test/java/PrimeCalculatorTest.java
|
4411
4415
|
- tracks/java/exercises/nucleotide-count/build.gradle
|
4412
4416
|
- tracks/java/exercises/nucleotide-count/src/example/java/DNA.java
|
4413
4417
|
- tracks/java/exercises/nucleotide-count/src/main/java/DNA.java
|
@@ -5275,6 +5279,7 @@ files:
|
|
5275
5279
|
- tracks/lfe/rebar.config
|
5276
5280
|
- tracks/lfe/rebar.lock
|
5277
5281
|
- tracks/lisp/.git
|
5282
|
+
- tracks/lisp/.github/stale.yml
|
5278
5283
|
- tracks/lisp/.gitignore
|
5279
5284
|
- tracks/lisp/.travis.yml
|
5280
5285
|
- tracks/lisp/ABOUT.org
|
@@ -5379,6 +5384,7 @@ files:
|
|
5379
5384
|
- tracks/lisp/good.out
|
5380
5385
|
- tracks/lisp/img/icon.png
|
5381
5386
|
- tracks/lua/.git
|
5387
|
+
- tracks/lua/.github/stale.yml
|
5382
5388
|
- tracks/lua/.gitignore
|
5383
5389
|
- tracks/lua/.travis.yml
|
5384
5390
|
- tracks/lua/LICENSE
|
@@ -6193,6 +6199,7 @@ files:
|
|
6193
6199
|
- tracks/perl5/exercises/wordy/wordy.t
|
6194
6200
|
- tracks/perl5/img/icon.png
|
6195
6201
|
- tracks/perl6/.git
|
6202
|
+
- tracks/perl6/.github/stale.yml
|
6196
6203
|
- tracks/perl6/.gitignore
|
6197
6204
|
- tracks/perl6/.travis.yml
|
6198
6205
|
- tracks/perl6/LICENSE
|
@@ -6549,6 +6556,10 @@ files:
|
|
6549
6556
|
- tracks/purescript/exercises/acronym/examples/src/Acronym.purs
|
6550
6557
|
- tracks/purescript/exercises/acronym/src/Acronym.purs
|
6551
6558
|
- tracks/purescript/exercises/acronym/test/Main.purs
|
6559
|
+
- tracks/purescript/exercises/all-your-base/bower.json
|
6560
|
+
- tracks/purescript/exercises/all-your-base/examples/src/AllYourBase.purs
|
6561
|
+
- tracks/purescript/exercises/all-your-base/src/AllYourBase.purs
|
6562
|
+
- tracks/purescript/exercises/all-your-base/test/Main.purs
|
6552
6563
|
- tracks/purescript/exercises/allergies/bower.json
|
6553
6564
|
- tracks/purescript/exercises/allergies/examples/src/Allergies.purs
|
6554
6565
|
- tracks/purescript/exercises/allergies/src/Allergies.purs
|
@@ -6599,6 +6610,7 @@ files:
|
|
6599
6610
|
- tracks/purescript/exercises/word-count/test/Main.purs
|
6600
6611
|
- tracks/purescript/img/icon.png
|
6601
6612
|
- tracks/python/.git
|
6613
|
+
- tracks/python/.github/stale.yml
|
6602
6614
|
- tracks/python/.gitignore
|
6603
6615
|
- tracks/python/.travis.yml
|
6604
6616
|
- tracks/python/LICENSE
|
@@ -6855,8 +6867,10 @@ files:
|
|
6855
6867
|
- tracks/python/requirements-travis.txt
|
6856
6868
|
- tracks/python/test/check-exercises.py
|
6857
6869
|
- tracks/r/.git
|
6870
|
+
- tracks/r/.github/stale.yml
|
6858
6871
|
- tracks/r/.gitignore
|
6859
6872
|
- tracks/r/.travis.yml
|
6873
|
+
- tracks/r/LICENSE
|
6860
6874
|
- tracks/r/README.md
|
6861
6875
|
- tracks/r/bin/fetch-configlet
|
6862
6876
|
- tracks/r/config.json
|