trackler 2.0.6.41 → 2.0.6.42
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/CONTRIBUTING.md +15 -3
- data/common/README.md +7 -2
- data/common/exercises/binary/.deprecated +3 -0
- data/common/exercises/counter/.deprecated +2 -0
- data/common/exercises/hexadecimal/.deprecated +3 -0
- data/common/exercises/luhn/description.md +9 -31
- data/common/exercises/octal/.deprecated +3 -0
- data/common/exercises/point-mutations/.deprecated +2 -0
- data/common/exercises/trinary/.deprecated +3 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/exercises/rna-transcription/test/test_rna_transcription.c +2 -3
- data/tracks/ceylon/config.json +8 -0
- data/tracks/ceylon/docs/ABOUT.md +15 -0
- data/tracks/ceylon/docs/INSTALLATION.md +9 -0
- data/tracks/ceylon/docs/LEARNING.md +7 -0
- data/tracks/ceylon/docs/TESTS.md +11 -0
- data/tracks/ceylon/exercises/TRACK_HINTS.md +11 -0
- data/tracks/ceylon/exercises/hamming/example/Hamming.ceylon +8 -0
- data/tracks/ceylon/exercises/hamming/source/hamming/Hamming.ceylon +5 -0
- data/tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon +30 -0
- data/tracks/ceylon/exercises/hamming/source/hamming/module.ceylon +3 -0
- data/tracks/erlang/_test/check-exercises.escript +2 -2
- data/tracks/erlang/exercises/{circular-buffer/rebar.conf → accumulate/rebar.config} +1 -1
- data/tracks/erlang/exercises/allergies/{rebar.conf → rebar.config} +1 -1
- data/tracks/erlang/exercises/{accumulate/rebar.conf → anagram/rebar.config} +3 -1
- data/tracks/erlang/exercises/{bob/rebar.conf → atbash-cipher/rebar.config} +1 -1
- data/tracks/erlang/exercises/{binary/rebar.conf → bank-account/rebar.config} +1 -1
- data/tracks/erlang/exercises/beer-song/rebar.conf +1 -1
- data/tracks/erlang/exercises/binary/rebar.config +30 -0
- data/tracks/erlang/exercises/bob/rebar.config +30 -0
- data/tracks/erlang/exercises/circular-buffer/rebar.config +30 -0
- data/tracks/erlang/exercises/clock/rebar.config +30 -0
- data/tracks/erlang/exercises/difference-of-squares/rebar.config +30 -0
- data/tracks/erlang/exercises/etl/rebar.config +30 -0
- data/tracks/erlang/exercises/gigasecond/rebar.config +30 -0
- data/tracks/erlang/exercises/grade-school/rebar.config +30 -0
- data/tracks/erlang/exercises/grains/rebar.config +30 -0
- data/tracks/erlang/exercises/hamming/rebar.config +30 -0
- data/tracks/erlang/exercises/hello-world/rebar.config +30 -0
- data/tracks/erlang/exercises/largest-series-product/rebar.config +30 -0
- data/tracks/erlang/exercises/leap/rebar.config +30 -0
- data/tracks/erlang/exercises/luhn/rebar.config +30 -0
- data/tracks/erlang/exercises/meetup/rebar.config +30 -0
- data/tracks/erlang/exercises/nucleotide-count/rebar.config +30 -0
- data/tracks/erlang/exercises/parallel-letter-frequency/rebar.config +30 -0
- data/tracks/erlang/exercises/phone-number/rebar.config +30 -0
- data/tracks/erlang/exercises/rna-transcription/rebar.config +30 -0
- data/tracks/erlang/exercises/robot-simulator/HINTS.md +9 -0
- data/tracks/erlang/exercises/robot-simulator/rebar.config +30 -0
- data/tracks/erlang/exercises/roman-numerals/rebar.config +30 -0
- data/tracks/erlang/exercises/scrabble-score/rebar.config +30 -0
- data/tracks/erlang/exercises/series/rebar.config +30 -0
- data/tracks/erlang/exercises/space-age/rebar.config +30 -0
- data/tracks/erlang/exercises/strain/rebar.config +30 -0
- data/tracks/erlang/exercises/sum-of-multiples/rebar.config +30 -0
- data/tracks/erlang/exercises/triangle/rebar.config +30 -0
- data/tracks/erlang/exercises/trinary/rebar.config +30 -0
- data/tracks/erlang/exercises/word-count/rebar.config +30 -0
- data/tracks/erlang/exercises/zipper/rebar.config +30 -0
- data/tracks/go/README.md +2 -1
- data/tracks/go/exercises/diamond/diamond_test.go +8 -8
- data/tracks/go/exercises/difference-of-squares/difference_of_squares_test.go +8 -0
- data/tracks/go/exercises/difference-of-squares/example.go +2 -0
- data/tracks/go/exercises/diffie-hellman/diffie_hellman_test.go +8 -0
- data/tracks/go/exercises/diffie-hellman/example.go +2 -0
- data/tracks/go/exercises/error-handling/error_handling_test.go +8 -8
- data/tracks/go/exercises/etl/etl_test.go +8 -0
- data/tracks/go/exercises/etl/example.go +2 -0
- data/tracks/go/exercises/food-chain/food_chain_test.go +6 -6
- data/tracks/go/exercises/hello-world/hello_world.go +2 -2
- data/tracks/go/exercises/hexadecimal/hexadecimal_test.go +6 -6
- data/tracks/go/exercises/house/house_test.go +6 -6
- data/tracks/go/exercises/isogram/isogram_test.go +8 -8
- data/tracks/go/exercises/kindergarten-garden/kindergarten_garden_test.go +6 -6
- data/tracks/go/exercises/leap/leap_test.go +4 -1
- data/tracks/go/exercises/ledger/ledger_test.go +4 -1
- data/tracks/go/exercises/matrix/matrix_test.go +6 -6
- data/tracks/go/exercises/meetup/meetup_test.go +4 -1
- data/tracks/go/exercises/nth-prime/example.go +2 -0
- data/tracks/go/exercises/nth-prime/nth_prime_test.go +8 -0
- data/tracks/go/exercises/nucleotide-count/nucleotide_count_test.go +8 -8
- data/tracks/idris/.gitignore +2 -0
- data/tracks/idris/_src/Makefile.template +23 -0
- data/tracks/idris/config.json +9 -2
- data/tracks/idris/exercises/hello-world/HelloWorld.ipkg +5 -0
- data/tracks/idris/exercises/hello-world/Makefile +23 -0
- data/tracks/idris/exercises/hello-world/src/Test/HelloWorld.idr +25 -0
- data/tracks/idris/exercises/hello-world/src/example.idr +5 -0
- data/tracks/java/.travis.yml +5 -0
- data/tracks/java/bin/build-jq.sh +11 -0
- data/tracks/java/exercises/allergies/src/test/java/AllergiesTest.java +14 -13
- data/tracks/java/exercises/hamming/src/test/java/HammingTest.java +2 -2
- data/tracks/java/exercises/nth-prime/src/test/java/PrimeTest.java +8 -1
- data/tracks/java/exercises/nucleotide-count/src/test/java/NucleotideTest.java +12 -6
- data/tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java +8 -2
- data/tracks/java/exercises/series/src/test/java/SeriesTest.java +10 -4
- data/tracks/java/exercises/simple-linked-list/src/test/java/SimpleLinkedListTest.java +7 -2
- data/tracks/java/exercises/triangle/src/test/java/TriangleTest.java +29 -20
- data/tracks/kotlin/config.json +5 -0
- data/tracks/kotlin/exercises/build.gradle +17 -0
- data/tracks/kotlin/exercises/perfect-numbers/build.gradle +28 -0
- data/tracks/kotlin/exercises/perfect-numbers/src/example/kotlin/NaturalNumber.kt +17 -0
- data/tracks/kotlin/exercises/perfect-numbers/src/main/kotlin/NaturalNumber.kt +8 -0
- data/tracks/kotlin/exercises/perfect-numbers/src/test/kotlin/PerfectNumbersTest.kt +67 -0
- data/tracks/kotlin/exercises/settings.gradle +1 -0
- data/tracks/lua/exercises/hamming/example.lua +1 -0
- data/tracks/lua/exercises/hamming/hamming_spec.lua +19 -11
- data/tracks/ocaml/config.json +5 -0
- data/tracks/ocaml/exercises/beer-song/beer_song.mli +1 -1
- data/tracks/ocaml/exercises/beer-song/example.ml +3 -3
- data/tracks/ocaml/exercises/beer-song/test.ml +45 -22
- data/tracks/ocaml/exercises/run-length-encoding/.merlin +5 -0
- data/tracks/ocaml/exercises/run-length-encoding/Makefile +11 -0
- data/tracks/ocaml/exercises/run-length-encoding/example.ml +37 -0
- data/tracks/ocaml/exercises/run-length-encoding/run_length_encoding.mli +3 -0
- data/tracks/ocaml/exercises/run-length-encoding/test.ml +38 -0
- data/tracks/ocaml/tools/test-generator/src/template.ml +0 -2
- data/tracks/ocaml/tools/test-generator/templates/beer-song/template.ml +19 -0
- data/tracks/ocaml/tools/test-generator/templates/run-length-encoding/template.ml +19 -0
- data/tracks/php/config.json +17 -0
- data/tracks/php/exercises/queen-attack/example.php +86 -0
- data/tracks/php/exercises/queen-attack/queen-attack_test.php +125 -0
- data/tracks/php/exercises/scrabble-score/example.php +27 -0
- data/tracks/php/exercises/scrabble-score/scrabble-score_test.php +120 -0
- data/tracks/r/exercises/luhn/example.R +20 -32
- data/tracks/r/exercises/luhn/luhn.R +1 -22
- data/tracks/r/exercises/luhn/test_luhn.R +43 -55
- metadata +67 -37
- data/tracks/erlang/exercises/anagram/rebar.conf +0 -32
- data/tracks/erlang/exercises/atbash-cipher/rebar.conf +0 -30
- data/tracks/erlang/exercises/bank-account/rebar.conf +0 -30
- data/tracks/erlang/exercises/clock/rebar.conf +0 -30
- data/tracks/erlang/exercises/difference-of-squares/rebar.conf +0 -30
- data/tracks/erlang/exercises/etl/rebar.conf +0 -30
- data/tracks/erlang/exercises/gigasecond/rebar.conf +0 -30
- data/tracks/erlang/exercises/grade-school/rebar.conf +0 -30
- data/tracks/erlang/exercises/grains/rebar.conf +0 -30
- data/tracks/erlang/exercises/hamming/rebar.conf +0 -30
- data/tracks/erlang/exercises/hello-world/rebar.conf +0 -30
- data/tracks/erlang/exercises/largest-series-product/rebar.conf +0 -30
- data/tracks/erlang/exercises/leap/rebar.conf +0 -30
- data/tracks/erlang/exercises/luhn/rebar.conf +0 -30
- data/tracks/erlang/exercises/meetup/rebar.conf +0 -30
- data/tracks/erlang/exercises/nucleotide-count/rebar.conf +0 -30
- data/tracks/erlang/exercises/parallel-letter-frequency/rebar.conf +0 -30
- data/tracks/erlang/exercises/phone-number/rebar.conf +0 -30
- data/tracks/erlang/exercises/rna-transcription/rebar.conf +0 -30
- data/tracks/erlang/exercises/robot-simulator/rebar.conf +0 -30
- data/tracks/erlang/exercises/roman-numerals/rebar.conf +0 -30
- data/tracks/erlang/exercises/scrabble-score/rebar.conf +0 -30
- data/tracks/erlang/exercises/series/rebar.conf +0 -30
- data/tracks/erlang/exercises/space-age/rebar.conf +0 -30
- data/tracks/erlang/exercises/strain/rebar.conf +0 -30
- data/tracks/erlang/exercises/sum-of-multiples/rebar.conf +0 -30
- data/tracks/erlang/exercises/triangle/rebar.conf +0 -30
- data/tracks/erlang/exercises/trinary/rebar.conf +0 -30
- data/tracks/erlang/exercises/word-count/rebar.conf +0 -30
- data/tracks/erlang/exercises/zipper/rebar.conf +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 916131843c14575716760142ef6a9c34ee3c9229
|
4
|
+
data.tar.gz: b089c28e26aaef73d1c9b3acfe246fbc848922a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af9588537b3e457dcc734647725966973ffb0ccab0f2f47bcc70dbb1fba5acd552a6b31f815886bb5875366718d6275392b0b3639ecb3ef1843a3e8158ebfcb6
|
7
|
+
data.tar.gz: 7a395dd3b5ce1115b073cad41b7c307b2381b475854a1bec2ff077cc6e739212148b5c89c459ec352043d0470be3fe5285b400cfc354e7e44634ce0b7da28b8c
|
data/common/CONTRIBUTING.md
CHANGED
@@ -38,6 +38,7 @@ themselves. There are other guides about contributing to other parts of the Exer
|
|
38
38
|
* [Beta-Testing a Language Track](#beta-testing-a-language-track)
|
39
39
|
* [Maintaining a Track](#maintaining-a-track)
|
40
40
|
* [Useful Tidbits](#useful-tidbits)
|
41
|
+
* [Pull Request Guidelines](#pull-request-guidelines)
|
41
42
|
* [Exercise Versioning](#exercise-versioning)
|
42
43
|
* [Anatomy of an Exercise](#anatomy-of-an-exercise)
|
43
44
|
* [config.json](#config-json)
|
@@ -591,6 +592,9 @@ scenarios in this guide.
|
|
591
592
|
|
592
593
|
1. Put the name of the exercise in the subject line of the commit.
|
593
594
|
E.g. `hamming: Add test case for strands of unequal length`
|
595
|
+
1. The subject line should be a one-sentence summary, and should not include
|
596
|
+
the word *and* (explicitly or implied).
|
597
|
+
1. Any extra detail should be provided in the body of the PR.
|
594
598
|
1. Don't submit unrelated changes in the same pull request.
|
595
599
|
1. If you had a bit of churn in the process of getting the change right,
|
596
600
|
squash your commits.
|
@@ -598,6 +602,12 @@ scenarios in this guide.
|
|
598
602
|
see two commits: First the refactoring, then the added behavior. It's
|
599
603
|
fine to put this in the same pull request, unless the refactoring is
|
600
604
|
huge and would make it hard to review both at the same time.
|
605
|
+
1. If you are referencing another issue or pull-request, for instance
|
606
|
+
*closes #XXX* or *see #XXX*, please include the reference in the body of the PR,
|
607
|
+
rather than the subject line. This is simply because the subject line doesn't
|
608
|
+
support markdown, and so these don't get turned into clickable links. It makes
|
609
|
+
it harder to follow and to go look at the related issue or PR.
|
610
|
+
1. Please also refer to the guidelines for [commit messages](#commit-messages).
|
601
611
|
|
602
612
|
Once you've submitted a pull request, one or more of the track maintainers
|
603
613
|
will review it. Some tracks are less active and might not have someone
|
@@ -748,9 +758,11 @@ Messages
|
|
748
758
|
Suck?](https://www.youtube.com/watch?v=8YjSty6bfog).
|
749
759
|
It's funny and enlightening, and you should watch it.
|
750
760
|
|
751
|
-
|
752
|
-
excellent commit messages
|
753
|
-
|
761
|
+
Two articles that have very clear guidelines about how to write
|
762
|
+
excellent commit messages are Tim Pope's
|
763
|
+
[A Note About Git Commit Messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
764
|
+
and Chris Beams' [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/).
|
765
|
+
Please read them.
|
754
766
|
|
755
767
|
##### Examples
|
756
768
|
|
data/common/README.md
CHANGED
@@ -47,9 +47,14 @@ variations.
|
|
47
47
|
|
48
48
|
Each test case has the the following keys:
|
49
49
|
- description: which will be used to name each generated test
|
50
|
+
- The description should not simply explain **what** each case is (that is redundant information)
|
51
|
+
- The description should explain **why** each case is there. For example, what kinds of implementation mistakes might this case help us find?
|
50
52
|
- 'variable names': one or more variable names with values which will be passed to the solution method
|
51
|
-
- expected: the expected result
|
52
|
-
-
|
53
|
+
- expected: the expected result
|
54
|
+
- if the input is valid but there is no result for the input, the value at `"expected"` should be `null`.
|
55
|
+
- if an error is expected (because the input is invalid, or any other reason), the value at `"expected"` should be an object containing exactly one property, `"error"`, whose value is a string.
|
56
|
+
- The string should explain why the error would occur.
|
57
|
+
- A particular track's implementation of the exercise **need not** necessarily check that the error includes that exact string as the cause, depending on what is idiomatic in the language (it may not be idiomatic to check strings for error messages).
|
53
58
|
|
54
59
|
## Automated Tests
|
55
60
|
|
@@ -7,62 +7,40 @@ The task is to check if a given string is valid.
|
|
7
7
|
|
8
8
|
Validating a Number
|
9
9
|
------
|
10
|
+
|
10
11
|
Strings of length 1 or less are not valid. Spaces are allowed in the input,
|
11
12
|
but they should be stripped before checking. All other non-digit characters
|
12
13
|
are disallowed.
|
13
14
|
|
14
|
-
|
15
|
-
Number.
|
15
|
+
## Example 1: valid credit card number
|
16
16
|
|
17
17
|
```
|
18
|
-
|
18
|
+
4539 1488 0343 6467
|
19
19
|
```
|
20
20
|
|
21
21
|
The first step of the Luhn algorithm is to double every second digit,
|
22
22
|
starting from the right. We will be doubling
|
23
23
|
|
24
24
|
```
|
25
|
-
|
25
|
+
4_3_ 1_8_ 0_4_ 6_6_
|
26
26
|
```
|
27
27
|
|
28
28
|
If doubling the number results in a number greater than 9 then subtract 9
|
29
29
|
from the product. The results of our doubling:
|
30
30
|
|
31
31
|
```
|
32
|
-
|
32
|
+
8569 2478 0383 3437
|
33
33
|
```
|
34
34
|
|
35
|
-
Then sum all of the digits
|
35
|
+
Then sum all of the digits:
|
36
36
|
|
37
37
|
```
|
38
|
-
|
38
|
+
8+5+6+9+2+4+7+8+0+3+8+3+3+4+3+7 = 80
|
39
39
|
```
|
40
40
|
|
41
41
|
If the sum is evenly divisible by 10, then the number is valid. This number is valid!
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
```
|
46
|
-
046 454 287
|
47
|
-
```
|
48
|
-
|
49
|
-
Double the second digits, starting from the right
|
50
|
-
|
51
|
-
```
|
52
|
-
086 858 277
|
53
|
-
```
|
54
|
-
|
55
|
-
Sum the digits
|
56
|
-
|
57
|
-
```
|
58
|
-
0+8+6+8+5+8+2+7+7 = 51
|
59
|
-
```
|
60
|
-
|
61
|
-
51 is not evenly divisible by 10, so this number is not valid.
|
62
|
-
|
63
|
-
----
|
64
|
-
|
65
|
-
An example of an invalid credit card account
|
43
|
+
## Example 2: invalid credit card number
|
66
44
|
|
67
45
|
```
|
68
46
|
8273 1232 7352 0569
|
@@ -77,7 +55,7 @@ Double the second digits, starting from the right
|
|
77
55
|
Sum the digits
|
78
56
|
|
79
57
|
```
|
80
|
-
7+2+5+3+2+2+
|
58
|
+
7+2+5+3+2+2+6+2+5+3+1+2+0+5+3+9 = 57
|
81
59
|
```
|
82
60
|
|
83
61
|
57 is not evenly divisible by 10, so this number is not valid.
|
data/lib/trackler/version.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
#include "vendor/unity.h"
|
2
2
|
#include "../src/rna_transcription.h"
|
3
3
|
#include <stdlib.h>
|
4
|
-
#include <string.h>
|
5
4
|
|
6
5
|
void test_transcription(const char *dna, const char *expected)
|
7
6
|
{
|
8
7
|
char *rna = to_rna(dna);
|
9
|
-
|
8
|
+
TEST_ASSERT_EQUAL_STRING(expected, rna);
|
10
9
|
free(rna);
|
11
10
|
}
|
12
11
|
|
13
12
|
void test_failure(const char *dna)
|
14
13
|
{
|
15
|
-
|
14
|
+
TEST_ASSERT_NULL(to_rna(dna));
|
16
15
|
}
|
17
16
|
|
18
17
|
void test_transcribes_G_to_C(void)
|
data/tracks/ceylon/config.json
CHANGED
data/tracks/ceylon/docs/ABOUT.md
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
Ceylon is a general-purpose programming language featuring a syntax similar to Java and C#.
|
2
|
+
It is imperative, statically-typed, block-structured, object-oriented, and higher-order.
|
3
|
+
By _statically-typed_, we mean that the compiler performs extensive type checking, with
|
4
|
+
the help of type annotations that appear in the code. By _object-oriented_, we mean that
|
5
|
+
the language supports user-defined types and features a nominative type system where a type
|
6
|
+
is a set of named attributes and operations, and that it supports inheritance and subtype
|
7
|
+
polymorphism. By _higher-order_, we mean that every referenceable program element
|
8
|
+
(every attribute, every operation, and every type) is also a value. By _block-structured_,
|
9
|
+
we mean to say that the language features lexical scoping and an extremely regular recursive
|
10
|
+
syntax for declarations and statements.
|
11
|
+
|
12
|
+
Ceylon improves upon the Java language and type system to reduce verbosity and increase
|
13
|
+
typesafety compared to Java and C#. Ceylon encourages a more functional, somewhat less
|
14
|
+
imperative style of programming, resulting in code which is easier to reason about, and
|
15
|
+
easier to refactor.
|
@@ -0,0 +1,9 @@
|
|
1
|
+
The easiest way to install Ceylon is simply to **not** install it.
|
2
|
+
You should be able to solve most of the exercises using our [web IDE](http://try.ceylon-lang.org/).
|
3
|
+
|
4
|
+
However if you prefer, you can install the command line distribution; the easiest way to do that is via [SDKMAN](http://sdkman.io/),
|
5
|
+
so you need to install that first if you don't have it yet, then just type `sdk install ceylon` at your terminal.
|
6
|
+
|
7
|
+
OSX users can also install via the [Homebrew package manager](http://mxcl.github.com/homebrew/).
|
8
|
+
|
9
|
+
Installation instructions for other platforms, as well as for the Ceylon IDE, a plugin for Eclipse, are available at [the official site](http://ceylon-lang.org/download/).
|
@@ -0,0 +1,7 @@
|
|
1
|
+
The best way to get started with Ceylon right now is to read the [quick introduction](http://ceylon-lang.org/documentation/1.3/introduction/),
|
2
|
+
then [take the tour](http://ceylon-lang.org/documentation/1.3/tour/) and/or [the walkthrough](http://ceylon-lang.org/documentation/1.3/walkthrough/).
|
3
|
+
|
4
|
+
You can write and run your first programs in our [web IDE](http://try.ceylon-lang.org/)
|
5
|
+
so you don't even have to install anything to get started.
|
6
|
+
|
7
|
+
And of course you can contact the team and other users at our [Gitter page](https://gitter.im/ceylon/user).
|
data/tracks/ceylon/docs/TESTS.md
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
## Running Ceylon Tests
|
2
|
+
|
3
|
+
We run tests with the [ceylon test](https://ceylon-lang.org/documentation/reference/tool/ceylon/subcommands/ceylon-test.html) command.
|
4
|
+
|
5
|
+
`ceylon test` expects a module name to run the tests on.
|
6
|
+
In the Ceylon track, each exercise has just a single module.
|
7
|
+
Therefore, you can run the tests with:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
ceylon test $(basename source/*)
|
11
|
+
```
|
@@ -0,0 +1,11 @@
|
|
1
|
+
## Running Ceylon Tests
|
2
|
+
|
3
|
+
We run tests with the [ceylon test](https://ceylon-lang.org/documentation/reference/tool/ceylon/subcommands/ceylon-test.html) command.
|
4
|
+
|
5
|
+
`ceylon test` expects a module name to run the tests on.
|
6
|
+
In the Ceylon track, each exercise has just a single module.
|
7
|
+
Therefore, you can run the tests with:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
ceylon test $(basename source/*)
|
11
|
+
```
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import ceylon.test { ... }
|
2
|
+
|
3
|
+
{[String, String, Integer?]*} cases => {
|
4
|
+
["A", "A", 0],
|
5
|
+
["GGACTGA", "GGACTGA", 0],
|
6
|
+
["A", "G", 1],
|
7
|
+
["AG", "CT", 2],
|
8
|
+
["AT", "CT", 1],
|
9
|
+
["GGACG", "GGTCG", 1],
|
10
|
+
["ACCAGGG", "ACTATGG", 2],
|
11
|
+
["AGA", "AGG", 1],
|
12
|
+
["AGG", "AGA", 1],
|
13
|
+
["TAG", "GAT", 2],
|
14
|
+
["GATACA", "GCATAA", 4],
|
15
|
+
["GGACGGATTCTG", "AGGACGGATTCT", 9],
|
16
|
+
["", "", 0],
|
17
|
+
["AATG", "AAA", null],
|
18
|
+
["ATA", "AGTG", null]
|
19
|
+
};
|
20
|
+
|
21
|
+
test
|
22
|
+
parameters(`value cases`)
|
23
|
+
void testHamming(String s1, String s2, Integer? expected) {
|
24
|
+
value result = distance(s1, s2);
|
25
|
+
if (exists expected) {
|
26
|
+
assertEquals(result, expected);
|
27
|
+
} else if (!is Error result) {
|
28
|
+
fail("should have errored, but got ``result``");
|
29
|
+
}
|
30
|
+
}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
main([])->
|
4
4
|
main(["all"]);
|
5
5
|
main(["all"]) ->
|
6
|
-
Examples = filelib:wildcard("exercises/*/rebar.
|
6
|
+
Examples = filelib:wildcard("exercises/*/rebar.config"),
|
7
7
|
ExampleBasePaths = [extract_base_pathes(X) || X <- Examples],
|
8
8
|
Exercises = [X -- "exercises/" || X <- ExampleBasePaths],
|
9
9
|
run_exercises(Exercises);
|
@@ -15,7 +15,7 @@ main(["list"|Exercises]) ->
|
|
15
15
|
|
16
16
|
extract_base_pathes(ConfPath) ->
|
17
17
|
ConfPath1 = lists:reverse(ConfPath),
|
18
|
-
ConfPath2 = ConfPath1 -- "rebar.
|
18
|
+
ConfPath2 = ConfPath1 -- "rebar.config/",
|
19
19
|
lists:reverse(ConfPath2).
|
20
20
|
|
21
21
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
%% -*- mode: erlang -*-
|
2
|
+
|
1
3
|
%% Erlang compiler options
|
2
4
|
{erl_opts, [debug_info]}.
|
3
5
|
|
@@ -16,7 +18,7 @@
|
|
16
18
|
]}.
|
17
19
|
|
18
20
|
%% eunit:test(Tests)
|
19
|
-
{eunit_tests, [
|
21
|
+
{eunit_tests, []}.
|
20
22
|
%% Options for eunit:test(Tests, Opts)
|
21
23
|
{eunit_opts, [verbose]}.
|
22
24
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
%% Erlang compiler options
|
2
|
+
{erl_opts, [debug_info]}.
|
3
|
+
|
4
|
+
{deps, []}.
|
5
|
+
|
6
|
+
{dialyzer, [
|
7
|
+
{warnings, [underspecs, no_return]},
|
8
|
+
{get_warnings, true},
|
9
|
+
{plt_apps, top_level_deps}, % top_level_deps | all_deps
|
10
|
+
{plt_extra_apps, []},
|
11
|
+
{plt_location, local}, % local | "/my/file/name"
|
12
|
+
{plt_prefix, "rebar3"},
|
13
|
+
{base_plt_apps, [stdlib, kernel, crypto]},
|
14
|
+
{base_plt_location, global}, % global | "/my/file/name"
|
15
|
+
{base_plt_prefix, "rebar3"}
|
16
|
+
]}.
|
17
|
+
|
18
|
+
%% eunit:test(Tests)
|
19
|
+
{eunit_tests, []}.
|
20
|
+
%% Options for eunit:test(Tests, Opts)
|
21
|
+
{eunit_opts, [verbose]}.
|
22
|
+
|
23
|
+
%% == xref ==
|
24
|
+
|
25
|
+
{xref_warnings, true}.
|
26
|
+
|
27
|
+
%% xref checks to run
|
28
|
+
{xref_checks, [undefined_function_calls, undefined_functions,
|
29
|
+
locals_not_used, exports_not_used,
|
30
|
+
deprecated_function_calls, deprecated_functions]}.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
%% Erlang compiler options
|
2
|
+
{erl_opts, [debug_info]}.
|
3
|
+
|
4
|
+
{deps, []}.
|
5
|
+
|
6
|
+
{dialyzer, [
|
7
|
+
{warnings, [underspecs, no_return]},
|
8
|
+
{get_warnings, true},
|
9
|
+
{plt_apps, top_level_deps}, % top_level_deps | all_deps
|
10
|
+
{plt_extra_apps, []},
|
11
|
+
{plt_location, local}, % local | "/my/file/name"
|
12
|
+
{plt_prefix, "rebar3"},
|
13
|
+
{base_plt_apps, [stdlib, kernel, crypto]},
|
14
|
+
{base_plt_location, global}, % global | "/my/file/name"
|
15
|
+
{base_plt_prefix, "rebar3"}
|
16
|
+
]}.
|
17
|
+
|
18
|
+
%% eunit:test(Tests)
|
19
|
+
{eunit_tests, []}.
|
20
|
+
%% Options for eunit:test(Tests, Opts)
|
21
|
+
{eunit_opts, [verbose]}.
|
22
|
+
|
23
|
+
%% == xref ==
|
24
|
+
|
25
|
+
{xref_warnings, true}.
|
26
|
+
|
27
|
+
%% xref checks to run
|
28
|
+
{xref_checks, [undefined_function_calls, undefined_functions,
|
29
|
+
locals_not_used, exports_not_used,
|
30
|
+
deprecated_function_calls, deprecated_functions]}.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
%% Erlang compiler options
|
2
|
+
{erl_opts, [debug_info]}.
|
3
|
+
|
4
|
+
{deps, []}.
|
5
|
+
|
6
|
+
{dialyzer, [
|
7
|
+
{warnings, [underspecs, no_return]},
|
8
|
+
{get_warnings, true},
|
9
|
+
{plt_apps, top_level_deps}, % top_level_deps | all_deps
|
10
|
+
{plt_extra_apps, []},
|
11
|
+
{plt_location, local}, % local | "/my/file/name"
|
12
|
+
{plt_prefix, "rebar3"},
|
13
|
+
{base_plt_apps, [stdlib, kernel, crypto]},
|
14
|
+
{base_plt_location, global}, % global | "/my/file/name"
|
15
|
+
{base_plt_prefix, "rebar3"}
|
16
|
+
]}.
|
17
|
+
|
18
|
+
%% eunit:test(Tests)
|
19
|
+
{eunit_tests, []}.
|
20
|
+
%% Options for eunit:test(Tests, Opts)
|
21
|
+
{eunit_opts, [verbose]}.
|
22
|
+
|
23
|
+
%% == xref ==
|
24
|
+
|
25
|
+
{xref_warnings, true}.
|
26
|
+
|
27
|
+
%% xref checks to run
|
28
|
+
{xref_checks, [undefined_function_calls, undefined_functions,
|
29
|
+
locals_not_used, exports_not_used,
|
30
|
+
deprecated_function_calls, deprecated_functions]}.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
%% Erlang compiler options
|
2
|
+
{erl_opts, [debug_info]}.
|
3
|
+
|
4
|
+
{deps, []}.
|
5
|
+
|
6
|
+
{dialyzer, [
|
7
|
+
{warnings, [underspecs, no_return]},
|
8
|
+
{get_warnings, true},
|
9
|
+
{plt_apps, top_level_deps}, % top_level_deps | all_deps
|
10
|
+
{plt_extra_apps, []},
|
11
|
+
{plt_location, local}, % local | "/my/file/name"
|
12
|
+
{plt_prefix, "rebar3"},
|
13
|
+
{base_plt_apps, [stdlib, kernel, crypto]},
|
14
|
+
{base_plt_location, global}, % global | "/my/file/name"
|
15
|
+
{base_plt_prefix, "rebar3"}
|
16
|
+
]}.
|
17
|
+
|
18
|
+
%% eunit:test(Tests)
|
19
|
+
{eunit_tests, []}.
|
20
|
+
%% Options for eunit:test(Tests, Opts)
|
21
|
+
{eunit_opts, [verbose]}.
|
22
|
+
|
23
|
+
%% == xref ==
|
24
|
+
|
25
|
+
{xref_warnings, true}.
|
26
|
+
|
27
|
+
%% xref checks to run
|
28
|
+
{xref_checks, [undefined_function_calls, undefined_functions,
|
29
|
+
locals_not_used, exports_not_used,
|
30
|
+
deprecated_function_calls, deprecated_functions]}.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
%% Erlang compiler options
|
2
|
+
{erl_opts, [debug_info]}.
|
3
|
+
|
4
|
+
{deps, []}.
|
5
|
+
|
6
|
+
{dialyzer, [
|
7
|
+
{warnings, [underspecs, no_return]},
|
8
|
+
{get_warnings, true},
|
9
|
+
{plt_apps, top_level_deps}, % top_level_deps | all_deps
|
10
|
+
{plt_extra_apps, []},
|
11
|
+
{plt_location, local}, % local | "/my/file/name"
|
12
|
+
{plt_prefix, "rebar3"},
|
13
|
+
{base_plt_apps, [stdlib, kernel, crypto]},
|
14
|
+
{base_plt_location, global}, % global | "/my/file/name"
|
15
|
+
{base_plt_prefix, "rebar3"}
|
16
|
+
]}.
|
17
|
+
|
18
|
+
%% eunit:test(Tests)
|
19
|
+
{eunit_tests, []}.
|
20
|
+
%% Options for eunit:test(Tests, Opts)
|
21
|
+
{eunit_opts, [verbose]}.
|
22
|
+
|
23
|
+
%% == xref ==
|
24
|
+
|
25
|
+
{xref_warnings, true}.
|
26
|
+
|
27
|
+
%% xref checks to run
|
28
|
+
{xref_checks, [undefined_function_calls, undefined_functions,
|
29
|
+
locals_not_used, exports_not_used,
|
30
|
+
deprecated_function_calls, deprecated_functions]}.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
%% Erlang compiler options
|
2
|
+
{erl_opts, [debug_info]}.
|
3
|
+
|
4
|
+
{deps, []}.
|
5
|
+
|
6
|
+
{dialyzer, [
|
7
|
+
{warnings, [underspecs, no_return]},
|
8
|
+
{get_warnings, true},
|
9
|
+
{plt_apps, top_level_deps}, % top_level_deps | all_deps
|
10
|
+
{plt_extra_apps, []},
|
11
|
+
{plt_location, local}, % local | "/my/file/name"
|
12
|
+
{plt_prefix, "rebar3"},
|
13
|
+
{base_plt_apps, [stdlib, kernel, crypto]},
|
14
|
+
{base_plt_location, global}, % global | "/my/file/name"
|
15
|
+
{base_plt_prefix, "rebar3"}
|
16
|
+
]}.
|
17
|
+
|
18
|
+
%% eunit:test(Tests)
|
19
|
+
{eunit_tests, []}.
|
20
|
+
%% Options for eunit:test(Tests, Opts)
|
21
|
+
{eunit_opts, [verbose]}.
|
22
|
+
|
23
|
+
%% == xref ==
|
24
|
+
|
25
|
+
{xref_warnings, true}.
|
26
|
+
|
27
|
+
%% xref checks to run
|
28
|
+
{xref_checks, [undefined_function_calls, undefined_functions,
|
29
|
+
locals_not_used, exports_not_used,
|
30
|
+
deprecated_function_calls, deprecated_functions]}.
|
@@ -0,0 +1,30 @@
|
|
1
|
+
%% Erlang compiler options
|
2
|
+
{erl_opts, [debug_info]}.
|
3
|
+
|
4
|
+
{deps, []}.
|
5
|
+
|
6
|
+
{dialyzer, [
|
7
|
+
{warnings, [underspecs, no_return]},
|
8
|
+
{get_warnings, true},
|
9
|
+
{plt_apps, top_level_deps}, % top_level_deps | all_deps
|
10
|
+
{plt_extra_apps, []},
|
11
|
+
{plt_location, local}, % local | "/my/file/name"
|
12
|
+
{plt_prefix, "rebar3"},
|
13
|
+
{base_plt_apps, [stdlib, kernel, crypto]},
|
14
|
+
{base_plt_location, global}, % global | "/my/file/name"
|
15
|
+
{base_plt_prefix, "rebar3"}
|
16
|
+
]}.
|
17
|
+
|
18
|
+
%% eunit:test(Tests)
|
19
|
+
{eunit_tests, []}.
|
20
|
+
%% Options for eunit:test(Tests, Opts)
|
21
|
+
{eunit_opts, [verbose]}.
|
22
|
+
|
23
|
+
%% == xref ==
|
24
|
+
|
25
|
+
{xref_warnings, true}.
|
26
|
+
|
27
|
+
%% xref checks to run
|
28
|
+
{xref_checks, [undefined_function_calls, undefined_functions,
|
29
|
+
locals_not_used, exports_not_used,
|
30
|
+
deprecated_function_calls, deprecated_functions]}.
|