trackler 2.2.1.14 → 2.2.1.15
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/lib/trackler/version.rb +1 -1
- data/tracks/c/docs/INSTALLATION.md +1 -1
- data/tracks/csharp/exercises/binary-search/BinarySearchTest.cs +2 -2
- data/tracks/csharp/exercises/poker/Example.cs +69 -20
- data/tracks/csharp/exercises/poker/PokerTest.cs +152 -82
- data/tracks/csharp/exercises/raindrops/RaindropsTest.cs +4 -4
- data/tracks/csharp/exercises/roman-numerals/RomanNumeralsTest.cs +4 -4
- data/tracks/csharp/exercises/word-count/Example.cs +2 -2
- data/tracks/csharp/exercises/word-count/WordCount.cs +2 -2
- data/tracks/csharp/exercises/word-count/WordCountTest.cs +85 -87
- data/tracks/csharp/generators/Exercises/Pangram.cs +0 -1
- data/tracks/csharp/generators/Exercises/Poker.cs +19 -0
- data/tracks/csharp/generators/Exercises/RomanNumerals.cs +0 -1
- data/tracks/csharp/generators/Exercises/WordCount.cs +27 -0
- data/tracks/csharp/generators/Output/NameExtensions.cs +6 -4
- data/tracks/delphi/{docs → exercises/hello-world}/GETTING_STARTED_GUIDE.md +0 -0
- data/tracks/go/config.json +629 -618
- data/tracks/go/config/maintainers.json +33 -33
- data/tracks/go/exercises/accumulate/README.md +0 -3
- data/tracks/go/exercises/hello-world/example.go +0 -2
- data/tracks/go/exercises/hello-world/hello_test.go +0 -20
- data/tracks/go/exercises/hello-world/hello_world.go +1 -36
- data/tracks/go/exercises/leap/leap.go +0 -1
- data/tracks/go/exercises/leap/leap_test.go +7 -3
- data/tracks/go/exercises/two-fer/README.md +66 -0
- data/tracks/go/exercises/two-fer/example.go +9 -0
- data/tracks/go/exercises/{hello-world/example_helloworld_test.go → two-fer/example_two_fer_test.go} +9 -9
- data/tracks/go/exercises/two-fer/two_fer.go +15 -0
- data/tracks/go/exercises/two-fer/two_fer_test.go +20 -0
- data/tracks/go/gen/gen.go +11 -10
- data/tracks/python/exercises/change/change_test.py +7 -2
- data/tracks/rust/config.json +1 -0
- data/tracks/rust/docs/ABOUT.md +1 -1
- data/tracks/scala/exercises/nth-prime/example.scala +2 -2
- data/tracks/scala/exercises/nth-prime/src/test/scala/NthPrimeTest.scala +29 -0
- data/tracks/scala/testgen/src/main/scala/NthPrimeTestGenerator.scala +34 -0
- metadata +12 -7
- data/tracks/fsharp/appveyor.yml +0 -4
- data/tracks/fsharp/circle.yml +0 -16
- data/tracks/scala/exercises/nth-prime/src/test/scala/PrimeTest.scala +0 -37
@@ -1,78 +1,78 @@
|
|
1
1
|
{
|
2
|
+
"docs_url": "https://github.com/exercism/docs/blob/master/maintaining-a-track/maintainer-configuration.md",
|
2
3
|
"maintainers": [
|
3
4
|
{
|
4
|
-
"github_username": "bmatsuo",
|
5
|
-
"show_on_website": false,
|
6
5
|
"alumnus": false,
|
7
|
-
"
|
6
|
+
"avatar_url": null,
|
8
7
|
"bio": null,
|
8
|
+
"github_username": "bmatsuo",
|
9
9
|
"link_text": null,
|
10
10
|
"link_url": null,
|
11
|
-
"
|
11
|
+
"name": null,
|
12
|
+
"show_on_website": false
|
12
13
|
},
|
13
14
|
{
|
14
|
-
"github_username": "kytrinyx",
|
15
15
|
"alumnus": true,
|
16
|
-
"
|
17
|
-
"
|
16
|
+
"bio": "I love Go for its simplicity and consistency. I also appreciate how hard the Go project is working to make the ecosystem welcoming to newcomers. I no longer maintain the Go track, but still maintain the Go tooling on Exercism.",
|
17
|
+
"github_username": "kytrinyx",
|
18
|
+
"name": "Katrina Owen"
|
18
19
|
},
|
19
20
|
{
|
20
|
-
"github_username": "petertseng",
|
21
|
-
"show_on_website": false,
|
22
21
|
"alumnus": false,
|
23
|
-
"
|
22
|
+
"avatar_url": null,
|
24
23
|
"bio": null,
|
24
|
+
"github_username": "petertseng",
|
25
25
|
"link_text": null,
|
26
26
|
"link_url": null,
|
27
|
-
"
|
27
|
+
"name": null,
|
28
|
+
"show_on_website": false
|
28
29
|
},
|
29
30
|
{
|
30
|
-
"github_username": "ferhatelmas",
|
31
|
-
"show_on_website": false,
|
32
31
|
"alumnus": false,
|
33
|
-
"
|
32
|
+
"avatar_url": null,
|
34
33
|
"bio": null,
|
34
|
+
"github_username": "ferhatelmas",
|
35
35
|
"link_text": null,
|
36
36
|
"link_url": null,
|
37
|
-
"
|
37
|
+
"name": null,
|
38
|
+
"show_on_website": false
|
38
39
|
},
|
39
40
|
{
|
40
41
|
"github_username": "tleen",
|
41
|
-
"show_on_website": true,
|
42
|
-
"name": "Tom Leen",
|
43
42
|
"link_text": "thomasleen.com",
|
44
|
-
"link_url": "http://www.thomasleen.com"
|
43
|
+
"link_url": "http://www.thomasleen.com",
|
44
|
+
"name": "Tom Leen",
|
45
|
+
"show_on_website": true
|
45
46
|
},
|
46
47
|
{
|
47
|
-
"github_username": "soniakeys",
|
48
|
-
"show_on_website": false,
|
49
48
|
"alumnus": false,
|
50
|
-
"
|
49
|
+
"avatar_url": null,
|
51
50
|
"bio": null,
|
51
|
+
"github_username": "soniakeys",
|
52
52
|
"link_text": null,
|
53
53
|
"link_url": null,
|
54
|
-
"
|
54
|
+
"name": null,
|
55
|
+
"show_on_website": false
|
55
56
|
},
|
56
57
|
{
|
57
|
-
"github_username": "robphoenix",
|
58
|
-
"show_on_website": true,
|
59
58
|
"alumnus": false,
|
60
|
-
"
|
59
|
+
"avatar_url": null,
|
61
60
|
"bio": "I used to be an artist, and am now a software engineer, using Go to build tools for network engineers. Maintaining Exercism's Go track has opened up the world of open source to me.",
|
61
|
+
"github_username": "robphoenix",
|
62
62
|
"link_text": "robphoenix.com",
|
63
63
|
"link_url": "https://blog.robphoenix.com/",
|
64
|
-
"
|
64
|
+
"name": "Rob Phoenix",
|
65
|
+
"show_on_website": true
|
65
66
|
},
|
66
67
|
{
|
67
|
-
"github_username": "leenipper",
|
68
|
-
"show_on_website": true,
|
69
68
|
"alumnus": false,
|
70
|
-
"
|
69
|
+
"avatar_url": null,
|
71
70
|
"bio": "Firmware Engineer by day. I like Go a lot, and I'm optimistic about its adoption. Helping on Exercism track allows me to learn more. My focus is adding exercise solutions and test case generators.",
|
71
|
+
"github_username": "leenipper",
|
72
72
|
"link_text": null,
|
73
73
|
"link_url": null,
|
74
|
-
"
|
74
|
+
"name": "Lee Nipper",
|
75
|
+
"show_on_website": true
|
75
76
|
}
|
76
|
-
]
|
77
|
-
|
78
|
-
}
|
77
|
+
]
|
78
|
+
}
|
@@ -25,9 +25,6 @@ Keep your hands off that collect/map/fmap/whatchamacallit functionality
|
|
25
25
|
provided by your standard library!
|
26
26
|
Solve this one yourself using other basic tools instead.
|
27
27
|
|
28
|
-
Lisp specific: it's perfectly fine to use `MAPCAR` or the equivalent,
|
29
|
-
as this is idiomatic Lisp, not a library function.
|
30
|
-
|
31
28
|
## Running the tests
|
32
29
|
|
33
30
|
To run the tests run the command `go test` from within the exercise directory.
|
@@ -6,26 +6,6 @@ import "testing"
|
|
6
6
|
// and returns a string.
|
7
7
|
// In other words, define a function with the following signature:
|
8
8
|
// HelloWorld() string
|
9
|
-
//
|
10
|
-
// In any exercise solution using the following tests you must also define a
|
11
|
-
// "testVersion" constant with a value that matches the targetTestVersion
|
12
|
-
// here. See how it is done in the the ./hello_world.go file provided.
|
13
|
-
// This is a common convention for ensuring test consistency throughout the
|
14
|
-
// Exercism Go language track.
|
15
|
-
//
|
16
|
-
// See TestTestVersion function below for how this and the testVersion
|
17
|
-
// constants are used.
|
18
|
-
const targetTestVersion = 4
|
19
|
-
|
20
|
-
// TestTestVersion is used to ensure the exercise solution is considered
|
21
|
-
// compatible with the rest of the tests. It should be the initial testing
|
22
|
-
// function in any test suite. If there is an incompatibility the tests can
|
23
|
-
// be considered unreliable therefore this function will abort the testing.
|
24
|
-
func TestTestVersion(t *testing.T) {
|
25
|
-
if testVersion != targetTestVersion {
|
26
|
-
t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
|
27
|
-
}
|
28
|
-
}
|
29
9
|
|
30
10
|
func TestHelloWorld(t *testing.T) {
|
31
11
|
expected := "Hello, World!"
|
@@ -1,42 +1,7 @@
|
|
1
|
-
// This is a "stub" file. It's a little start on your solution.
|
2
|
-
// It's not a complete solution though; you have to write some code.
|
3
|
-
|
4
|
-
// Package greeting should have a package comment that summarizes what it's about.
|
5
|
-
// https://golang.org/doc/effective_go.html#commentary
|
6
|
-
// While documentation is taken very seriously in Go, and tools like golint will
|
7
|
-
// complain if you don't include it, these comments are not required to make
|
8
|
-
// the test suite pass. It is up to you whether to include them in your submitted
|
9
|
-
// exercises.
|
10
|
-
// You can read more about the importance of documentation in Go here:
|
11
|
-
// https://blog.golang.org/godoc-documenting-go-code
|
12
1
|
package greeting
|
13
2
|
|
14
|
-
// testVersion identifies the version of the test program that you are
|
15
|
-
// writing your code to. If the test program changes in the future --
|
16
|
-
// after you have posted this code to the Exercism site -- reviewers
|
17
|
-
// will see that your code can't necessarily be expected to pass the
|
18
|
-
// current test suite because it was written to an earlier test version.
|
19
|
-
//
|
20
|
-
// This is a convention done for Exercism exercises in the Go language track,
|
21
|
-
// it is not a requirement of the Go programming language.
|
22
|
-
//
|
23
|
-
// This test versioning setup will be common to all the exercises in the
|
24
|
-
// Go language track. When crafting your own solution file from scratch you
|
25
|
-
// will be expected to add this constant or the initial test will fail.
|
26
|
-
// The version number you should use will be found in the constant
|
27
|
-
// "targetTestVersion" in the test file, see ./hello_test.go for more
|
28
|
-
// information.
|
29
|
-
const testVersion = 4
|
30
|
-
|
31
|
-
// HelloWorld should have a comment documenting it, beginning with the name of
|
32
|
-
// the function. It is recommended good practice, but, as we mention above, it's
|
33
|
-
// not necessary for making your solutions pass.
|
34
|
-
// https://github.com/golang/go/wiki/CodeReviewComments#comment-sentences
|
35
3
|
func HelloWorld() string {
|
36
4
|
// Write some code here to pass the test suite.
|
37
|
-
|
38
|
-
// When you have a working solution, REMOVE ALL THE STOCK COMMENTS.
|
39
|
-
// They're here to help you get started but they only clutter a finished solution.
|
40
|
-
// If you leave them in, reviewers will protest!
|
5
|
+
// Then delete this comment stub.
|
41
6
|
return ""
|
42
7
|
}
|
@@ -2,11 +2,15 @@ package leap
|
|
2
2
|
|
3
3
|
import "testing"
|
4
4
|
|
5
|
-
//
|
6
|
-
//
|
7
|
-
|
5
|
+
// targetTestVersion is used to ensure that a solution is only evaluated
|
6
|
+
// against the correct version of the test suite.
|
8
7
|
const targetTestVersion = 3
|
9
8
|
|
9
|
+
// TestTestVersion compares the targetTestVersion defined above with
|
10
|
+
// a testVersion value.
|
11
|
+
// This is a common convention throughout the Go Exercism track.
|
12
|
+
// To make a test like this test pass, define 'testVersion' in your solution.
|
13
|
+
// We've done this for you in the ./leap.go file provided.
|
10
14
|
func TestTestVersion(t *testing.T) {
|
11
15
|
if testVersion != targetTestVersion {
|
12
16
|
t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# Two Fer
|
2
|
+
|
3
|
+
`Two-fer` or `2-fer` is short for two for one. One for you and one for me.
|
4
|
+
|
5
|
+
```
|
6
|
+
"One for X, one for me."
|
7
|
+
```
|
8
|
+
|
9
|
+
When X is a name or "you".
|
10
|
+
|
11
|
+
If the given name is "Alice", the result should be "One for Alice, one for me."
|
12
|
+
If no name is given, the result should be "One for you, one for me."
|
13
|
+
|
14
|
+
|
15
|
+
## Test-Driven Development
|
16
|
+
|
17
|
+
As programmers mature, they eventually want to test their code.
|
18
|
+
|
19
|
+
Here at Exercism we simulate [Test-Driven
|
20
|
+
Development](http://en.wikipedia.org/wiki/Test-driven_development) (TDD), where
|
21
|
+
you write your tests before writing any functionality. The simulation comes in
|
22
|
+
the form of a pre-written test suite, which will signal that you have solved
|
23
|
+
the problem.
|
24
|
+
|
25
|
+
It will also provide you with a safety net to explore other solutions without
|
26
|
+
breaking the functionality.
|
27
|
+
|
28
|
+
### A typical TDD workflow on Exercism:
|
29
|
+
|
30
|
+
1. Run the test file and pick one test that's failing.
|
31
|
+
2. Write some code to fix the test you picked.
|
32
|
+
3. Re-run the tests to confirm the test is now passing.
|
33
|
+
4. Repeat from step 1.
|
34
|
+
5. Submit your solution (`exercism submit /path/to/file`)
|
35
|
+
|
36
|
+
## Instructions
|
37
|
+
|
38
|
+
Submissions are encouraged to be general, within reason. Having said that, it's
|
39
|
+
also important not to over-engineer a solution.
|
40
|
+
|
41
|
+
It's important to remember that the goal is to make code as expressive and
|
42
|
+
readable as we can.
|
43
|
+
|
44
|
+
## Running the tests
|
45
|
+
|
46
|
+
To run the tests run the command `go test` from within the exercise directory.
|
47
|
+
|
48
|
+
If the test suite contains benchmarks, you can run these with the `-bench`
|
49
|
+
flag:
|
50
|
+
|
51
|
+
go test -bench .
|
52
|
+
|
53
|
+
Keep in mind that each reviewer will run benchmarks on a different machine, with
|
54
|
+
different specs, so the results from these benchmark tests may vary.
|
55
|
+
|
56
|
+
## Further information
|
57
|
+
|
58
|
+
For more detailed information about the Go track, including how to get help if
|
59
|
+
you're having trouble, please visit the exercism.io [Go language page](http://exercism.io/languages/go/about).
|
60
|
+
|
61
|
+
## Source
|
62
|
+
|
63
|
+
This is an exercise to introduce users to basic programming constructs, just after hello World. [https://en.wikipedia.org/wiki/Two-fer](https://en.wikipedia.org/wiki/Two-fer)
|
64
|
+
|
65
|
+
## Submitting Incomplete Solutions
|
66
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
data/tracks/go/exercises/{hello-world/example_helloworld_test.go → two-fer/example_two_fer_test.go}
RENAMED
@@ -1,20 +1,20 @@
|
|
1
|
-
package
|
1
|
+
package twofer
|
2
2
|
|
3
3
|
import "fmt"
|
4
4
|
|
5
|
-
//
|
6
|
-
// Go code that are used for documenting
|
5
|
+
// ExampleShareWith() is an Example function. Examples are testable snippets of
|
6
|
+
// Go code that are used for documenting and verifying the package API.
|
7
7
|
// They may be present in some exercises to demonstrate the expected use of the
|
8
|
-
// exercise API and can be run as part of a package's test suite
|
8
|
+
// exercise API and can be run as part of a package's test suite.
|
9
9
|
//
|
10
10
|
// When an Example test is run the data that is written to standard output is
|
11
11
|
// compared to the data that comes after the "Output: " comment.
|
12
12
|
//
|
13
|
-
//
|
14
|
-
// using fmt.Println, and this is compared against the expected output
|
13
|
+
// Below the result of ShareWith() is passed to standard output
|
14
|
+
// using fmt.Println, and this is compared against the expected output.
|
15
15
|
// If they are equal, the test passes.
|
16
|
-
func
|
17
|
-
h :=
|
16
|
+
func ExampleShareWith() {
|
17
|
+
h := ShareWith("")
|
18
18
|
fmt.Println(h)
|
19
|
-
// Output:
|
19
|
+
// Output: One for you, one for me.
|
20
20
|
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a "stub" file. It's a little start on your solution.
|
2
|
+
// It's not a complete solution though; you have to write some code.
|
3
|
+
|
4
|
+
// Package twofer should have a package comment that summarizes what it's about.
|
5
|
+
// https://golang.org/doc/effective_go.html#commentary
|
6
|
+
package twofer
|
7
|
+
|
8
|
+
// ShareWith needs a comment documenting it.
|
9
|
+
func ShareWith(string) string {
|
10
|
+
// Write some code here to pass the test suite.
|
11
|
+
// Then remove all the stock comments.
|
12
|
+
// They're here to help you get started but they only clutter a finished solution.
|
13
|
+
// If you leave them in, reviewers will protest!
|
14
|
+
return ""
|
15
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
package twofer
|
2
|
+
|
3
|
+
import "testing"
|
4
|
+
|
5
|
+
// Define a function ShareWith(string) string.
|
6
|
+
|
7
|
+
func TestShareWith(t *testing.T) {
|
8
|
+
tests := []struct {
|
9
|
+
name, expected string
|
10
|
+
}{
|
11
|
+
{"", "One for you, one for me."},
|
12
|
+
{"Alice", "One for Alice, one for me."},
|
13
|
+
{"Bob", "One for Bob, one for me."},
|
14
|
+
}
|
15
|
+
for _, test := range tests {
|
16
|
+
if observed := ShareWith(test.name); observed != test.expected {
|
17
|
+
t.Fatalf("ShareWith(%s) = %v, want %v", test.name, observed, test.expected)
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
data/tracks/go/gen/gen.go
CHANGED
@@ -17,15 +17,16 @@ import (
|
|
17
17
|
"time"
|
18
18
|
)
|
19
19
|
|
20
|
-
// dirMetadata is the location of the
|
21
|
-
// We're making the assumption that the
|
20
|
+
// dirMetadata is the location of the problem-specifications repository on the filesystem.
|
21
|
+
// We're making the assumption that the problem-specifications repository has been cloned to
|
22
22
|
// the same parent directory as the Exercism Go track repository.
|
23
23
|
// E.g.
|
24
24
|
//
|
25
25
|
// $ tree -L 1 .
|
26
26
|
// .
|
27
|
-
// ├──
|
27
|
+
// ├── problem-specifications
|
28
28
|
// └── go
|
29
|
+
//
|
29
30
|
var dirMetadata string
|
30
31
|
|
31
32
|
// dirExercise is the location that the test cases should be generated to.
|
@@ -40,10 +41,10 @@ var genClient = &http.Client{Timeout: 10 * time.Second}
|
|
40
41
|
const (
|
41
42
|
// canonicalDataURL is the URL for the raw canonical-data.json data,
|
42
43
|
// requires exercise name.
|
43
|
-
canonicalDataURL = "https://raw.githubusercontent.com/exercism/
|
44
|
+
canonicalDataURL = "https://raw.githubusercontent.com/exercism/problem-specifications/master/exercises/%s/canonical-data.json"
|
44
45
|
// commitsURL is the GitHub api endpoint for the canonical-data.json
|
45
46
|
// file commit history, requires exercise name.
|
46
|
-
commitsURL = "https://api.github.com/repos/exercism/
|
47
|
+
commitsURL = "https://api.github.com/repos/exercism/problem-specifications/commits?path=exercises/%s/canonical-data.json"
|
47
48
|
)
|
48
49
|
|
49
50
|
// Header tells how the test data was generated, for display in the header of
|
@@ -60,14 +61,14 @@ func (h Header) String() string {
|
|
60
61
|
s += fmt.Sprintf("// Commit: %s\n", h.Commit)
|
61
62
|
}
|
62
63
|
if h.Version != "" {
|
63
|
-
s += fmt.Sprintf("//
|
64
|
+
s += fmt.Sprintf("// Problem Specifications Version: %s\n", h.Version)
|
64
65
|
}
|
65
66
|
return s
|
66
67
|
}
|
67
68
|
|
68
69
|
func init() {
|
69
70
|
if _, path, _, ok := runtime.Caller(0); ok {
|
70
|
-
dirMetadata = filepath.Join(path, "..", "..", "..", "
|
71
|
+
dirMetadata = filepath.Join(path, "..", "..", "..", "problem-specifications")
|
71
72
|
}
|
72
73
|
if _, path, _, ok := runtime.Caller(2); ok {
|
73
74
|
dirExercise = filepath.Join(path, "..", "..")
|
@@ -171,7 +172,7 @@ func Gen(exercise string, j interface{}, t *template.Template) error {
|
|
171
172
|
}
|
172
173
|
|
173
174
|
func getLocal(jFile string) (jPath, jOrigin, jCommit string) {
|
174
|
-
// Ideally draw from a .json which is pulled from the official
|
175
|
+
// Ideally draw from a .json which is pulled from the official problem-specifications
|
175
176
|
// repository. For development however, accept a file in current directory
|
176
177
|
// if there is no .json in source control. Also allow an override in any
|
177
178
|
// case by environment variable.
|
@@ -188,7 +189,7 @@ func getLocal(jFile string) (jPath, jOrigin, jCommit string) {
|
|
188
189
|
return "", "local file", "" // not in source control
|
189
190
|
}
|
190
191
|
// good. return source control dir and commit.
|
191
|
-
return c.Dir, "exercism/
|
192
|
+
return c.Dir, "exercism/problem-specifications", string(bytes.TrimSpace(origin))
|
192
193
|
}
|
193
194
|
|
194
195
|
func getRemote(exercise string) (body []byte, jOrigin string, jCommit string, err error) {
|
@@ -212,7 +213,7 @@ func getRemote(exercise string) (body []byte, jOrigin string, jCommit string, er
|
|
212
213
|
return []byte{}, "", "", err
|
213
214
|
}
|
214
215
|
log.Printf("[REMOTE] source: %s\n", url)
|
215
|
-
return body, "exercism/
|
216
|
+
return body, "exercism/problem-specifications", c, nil
|
216
217
|
}
|
217
218
|
|
218
219
|
func getRemoteCommit(exercise string) (string, error) {
|