trackler 2.0.0.9 → 2.0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/ecmascript/SETUP.md +1 -11
- data/tracks/ecmascript/exercises/accumulate/package.json +2 -1
- data/tracks/ecmascript/exercises/acronym/package.json +2 -1
- data/tracks/ecmascript/exercises/allergies/package.json +2 -1
- data/tracks/ecmascript/exercises/anagram/package.json +2 -1
- data/tracks/ecmascript/exercises/atbash-cipher/package.json +2 -1
- data/tracks/ecmascript/exercises/beer-song/package.json +2 -1
- data/tracks/ecmascript/exercises/binary/package.json +2 -1
- data/tracks/ecmascript/exercises/binary-search/package.json +2 -1
- data/tracks/ecmascript/exercises/binary-search-tree/package.json +2 -1
- data/tracks/ecmascript/exercises/bob/package.json +2 -1
- data/tracks/ecmascript/exercises/bracket-push/package.json +2 -1
- data/tracks/ecmascript/exercises/circular-buffer/package.json +2 -1
- data/tracks/ecmascript/exercises/clock/package.json +2 -1
- data/tracks/ecmascript/exercises/crypto-square/package.json +2 -1
- data/tracks/ecmascript/exercises/custom-set/package.json +2 -2
- data/tracks/ecmascript/exercises/diamond/package.json +2 -1
- data/tracks/ecmascript/exercises/difference-of-squares/package.json +2 -1
- data/tracks/ecmascript/exercises/etl/package.json +2 -1
- data/tracks/ecmascript/exercises/food-chain/package.json +2 -1
- data/tracks/ecmascript/exercises/gigasecond/package.json +2 -1
- data/tracks/ecmascript/exercises/grade-school/package.json +2 -1
- data/tracks/ecmascript/exercises/grains/package.json +2 -1
- data/tracks/ecmascript/exercises/hamming/package.json +2 -1
- data/tracks/ecmascript/exercises/hello-world/package.json +2 -1
- data/tracks/ecmascript/exercises/hexadecimal/package.json +2 -1
- data/tracks/ecmascript/exercises/isogram/package.json +2 -1
- data/tracks/ecmascript/exercises/kindergarten-garden/package.json +2 -1
- data/tracks/ecmascript/exercises/largest-series-product/package.json +2 -1
- data/tracks/ecmascript/exercises/leap/package.json +2 -1
- data/tracks/ecmascript/exercises/linked-list/package.json +2 -1
- data/tracks/ecmascript/exercises/luhn/package.json +2 -1
- data/tracks/ecmascript/exercises/matrix/package.json +2 -1
- data/tracks/ecmascript/exercises/meetup/package.json +2 -1
- data/tracks/ecmascript/exercises/nth-prime/package.json +2 -1
- data/tracks/ecmascript/exercises/ocr-numbers/package.json +2 -1
- data/tracks/ecmascript/exercises/octal/package.json +2 -1
- data/tracks/ecmascript/exercises/palindrome-products/package.json +2 -1
- data/tracks/ecmascript/exercises/pangram/package.json +2 -1
- data/tracks/ecmascript/exercises/pascals-triangle/package.json +2 -1
- data/tracks/ecmascript/exercises/phone-number/package.json +2 -1
- data/tracks/ecmascript/exercises/pig-latin/package.json +2 -1
- data/tracks/ecmascript/exercises/prime-factors/package.json +2 -1
- data/tracks/ecmascript/exercises/pythagorean-triplet/package.json +2 -1
- data/tracks/ecmascript/exercises/queen-attack/package.json +2 -1
- data/tracks/ecmascript/exercises/raindrops/package.json +2 -1
- data/tracks/ecmascript/exercises/rna-transcription/package.json +2 -1
- data/tracks/ecmascript/exercises/robot-name/package.json +2 -1
- data/tracks/ecmascript/exercises/robot-simulator/package.json +2 -1
- data/tracks/ecmascript/exercises/roman-numerals/package.json +2 -1
- data/tracks/ecmascript/exercises/saddle-points/package.json +2 -1
- data/tracks/ecmascript/exercises/say/package.json +2 -1
- data/tracks/ecmascript/exercises/scrabble-score/package.json +2 -1
- data/tracks/ecmascript/exercises/secret-handshake/package.json +2 -1
- data/tracks/ecmascript/exercises/series/package.json +2 -1
- data/tracks/ecmascript/exercises/sieve/package.json +2 -1
- data/tracks/ecmascript/exercises/simple-cipher/package.json +2 -1
- data/tracks/ecmascript/exercises/space-age/package.json +2 -1
- data/tracks/ecmascript/exercises/strain/package.json +2 -1
- data/tracks/ecmascript/exercises/sum-of-multiples/package.json +2 -1
- data/tracks/ecmascript/exercises/triangle/package.json +2 -1
- data/tracks/ecmascript/exercises/trinary/package.json +2 -1
- data/tracks/ecmascript/exercises/two-bucket/package.json +2 -1
- data/tracks/ecmascript/exercises/word-count/package.json +2 -1
- data/tracks/ecmascript/exercises/wordy/package.json +2 -1
- data/tracks/ecmascript/package.json +2 -1
- data/tracks/go/.travis.yml +1 -1
- data/tracks/go/docs/LEARNING.md +1 -0
- data/tracks/java/config.json +6 -0
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/java/exercises/sum-of-multiples/build.gradle +17 -0
- data/tracks/java/exercises/sum-of-multiples/src/example/java/SumOfMultiples.java +27 -0
- data/tracks/java/exercises/sum-of-multiples/src/main/java/SumOfMultiples.java +4 -0
- data/tracks/java/exercises/sum-of-multiples/src/test/SumOfMultiplesTest.java +187 -0
- data/tracks/ocaml/exercises/word-count/example.ml +14 -19
- data/tracks/ocaml/exercises/word-count/test.ml +33 -18
- data/tracks/ocaml/tools/test-generator/src/codegen.ml +13 -6
- data/tracks/ocaml/tools/test-generator/src/codegen.mli +4 -2
- data/tracks/ocaml/tools/test-generator/src/model.ml +1 -1
- data/tracks/ocaml/tools/test-generator/src/parser.ml +1 -1
- data/tracks/ocaml/tools/test-generator/src/special_cases.ml +19 -0
- data/tracks/ocaml/tools/test-generator/src/special_cases.mli +6 -0
- data/tracks/ocaml/tools/test-generator/src/test_generator.ml +2 -2
- data/tracks/ocaml/tools/test-generator/templates/anagram/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/bob/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/hamming/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/hello-world/template.ml +14 -0
- data/tracks/ocaml/tools/test-generator/templates/leap/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/raindrops/template.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/word-count/template.ml +3 -2
- data/tracks/ocaml/tools/test-generator/test/codegen_test.ml +6 -3
- data/tracks/ocaml/tools/test-generator/{src → test}/leap.json +0 -0
- data/tracks/ocaml/tools/test-generator/test/parser_test.ml +10 -9
- data/tracks/ocaml/tools/test-generator/test/special_cases_test.ml +25 -5
- data/tracks/perl5/.travis.yml +13 -3
- data/tracks/perl5/README.md +7 -2
- data/tracks/perl5/cpanfile +4 -0
- data/tracks/perl5/{accumulate → exercises/accumulate}/Example.pm +0 -0
- data/tracks/perl5/{accumulate → exercises/accumulate}/accumulate.t +6 -1
- data/tracks/perl5/{allergies → exercises/allergies}/Example.pm +0 -0
- data/tracks/perl5/{allergies → exercises/allergies}/allergies.t +7 -2
- data/tracks/perl5/{allergies → exercises/allergies}/cases.json +0 -0
- data/tracks/perl5/{anagram → exercises/anagram}/Example.pm +0 -0
- data/tracks/perl5/{anagram → exercises/anagram}/anagram.t +7 -2
- data/tracks/perl5/{anagram → exercises/anagram}/cases.json +0 -0
- data/tracks/perl5/{atbash-cipher → exercises/atbash-cipher}/Example.pm +0 -0
- data/tracks/perl5/{atbash-cipher → exercises/atbash-cipher}/cases.json +0 -0
- data/tracks/perl5/{atbash-cipher → exercises/atbash-cipher}/cipher.t +7 -2
- data/tracks/perl5/{beer-song → exercises/beer-song}/Example.pm +0 -0
- data/tracks/perl5/{beer-song → exercises/beer-song}/beer.t +7 -2
- data/tracks/perl5/{beer-song → exercises/beer-song}/cases.json +0 -0
- data/tracks/perl5/{binary → exercises/binary}/Example.pm +0 -0
- data/tracks/perl5/{binary → exercises/binary}/binary.t +6 -1
- data/tracks/perl5/{binary-search → exercises/binary-search}/Example.pm +0 -0
- data/tracks/perl5/{binary-search → exercises/binary-search}/binary-search.t +6 -3
- data/tracks/perl5/{binary-search-tree → exercises/binary-search-tree}/Example.pm +0 -0
- data/tracks/perl5/{binary-search-tree → exercises/binary-search-tree}/binary_search_tree.t +5 -0
- data/tracks/perl5/{bob → exercises/bob}/Bob.pm +0 -0
- data/tracks/perl5/{bob → exercises/bob}/Example.pm +0 -0
- data/tracks/perl5/{bob → exercises/bob}/bob.t +6 -1
- data/tracks/perl5/{clock → exercises/clock}/Example.pm +0 -0
- data/tracks/perl5/{clock → exercises/clock}/clock.t +6 -1
- data/tracks/perl5/{crypto-square → exercises/crypto-square}/Example.pm +0 -0
- data/tracks/perl5/{crypto-square → exercises/crypto-square}/crypto.t +6 -1
- data/tracks/perl5/{custom-set → exercises/custom-set}/Example.pm +0 -0
- data/tracks/perl5/{custom-set → exercises/custom-set}/custom-set.t +5 -0
- data/tracks/perl5/{difference-of-squares → exercises/difference-of-squares}/Example.pm +0 -0
- data/tracks/perl5/{difference-of-squares → exercises/difference-of-squares}/difference_of_squares.t +6 -1
- data/tracks/perl5/{etl → exercises/etl}/Example.pm +0 -0
- data/tracks/perl5/{etl → exercises/etl}/etl.t +6 -1
- data/tracks/perl5/{food-chain → exercises/food-chain}/Example.pm +0 -0
- data/tracks/perl5/{food-chain → exercises/food-chain}/food_chain.t +7 -2
- data/tracks/perl5/{gigasecond → exercises/gigasecond}/Example.pm +0 -0
- data/tracks/perl5/{gigasecond → exercises/gigasecond}/gigasecond.t +5 -0
- data/tracks/perl5/{grade-school → exercises/grade-school}/Example.pm +0 -0
- data/tracks/perl5/{grade-school → exercises/grade-school}/grade_school.t +5 -0
- data/tracks/perl5/{grains → exercises/grains}/Example.pm +0 -0
- data/tracks/perl5/{grains → exercises/grains}/cases.json +0 -0
- data/tracks/perl5/{grains → exercises/grains}/grains.t +7 -2
- data/tracks/perl5/{hamming → exercises/hamming}/Example.pm +0 -0
- data/tracks/perl5/{hamming → exercises/hamming}/hamming.t +6 -1
- data/tracks/perl5/{hexadecimal → exercises/hexadecimal}/Example.pm +0 -0
- data/tracks/perl5/{hexadecimal → exercises/hexadecimal}/hexadecimal.t +6 -1
- data/tracks/perl5/{house → exercises/house}/Example.pm +0 -0
- data/tracks/perl5/{house → exercises/house}/house.t +6 -1
- data/tracks/perl5/{kindergarten-garden → exercises/kindergarten-garden}/Example.pm +0 -0
- data/tracks/perl5/{kindergarten-garden → exercises/kindergarten-garden}/kindergarten.t +6 -1
- data/tracks/perl5/{largest-series-product → exercises/largest-series-product}/Example.pm +0 -0
- data/tracks/perl5/{largest-series-product → exercises/largest-series-product}/series_product.t +6 -1
- data/tracks/perl5/{leap → exercises/leap}/Example.pm +0 -0
- data/tracks/perl5/{leap → exercises/leap}/leap.t +6 -0
- data/tracks/perl5/{linked-list → exercises/linked-list}/Example.pm +0 -0
- data/tracks/perl5/{linked-list → exercises/linked-list}/cases.json +0 -0
- data/tracks/perl5/{linked-list → exercises/linked-list}/deque.t +9 -4
- data/tracks/perl5/{list-ops → exercises/list-ops}/Example.pm +0 -0
- data/tracks/perl5/{list-ops → exercises/list-ops}/list-ops.t +6 -3
- data/tracks/perl5/{luhn → exercises/luhn}/Example.pm +0 -0
- data/tracks/perl5/{luhn → exercises/luhn}/luhn.t +7 -2
- data/tracks/perl5/{matrix → exercises/matrix}/Example.pm +0 -0
- data/tracks/perl5/{matrix → exercises/matrix}/matrix.t +6 -1
- data/tracks/perl5/{meetup → exercises/meetup}/Example.pm +0 -0
- data/tracks/perl5/{meetup → exercises/meetup}/meetup.t +7 -1
- data/tracks/perl5/{minesweeper → exercises/minesweeper}/Example.pm +0 -0
- data/tracks/perl5/{minesweeper → exercises/minesweeper}/minesweeper.t +5 -0
- data/tracks/perl5/{nucleotide-count → exercises/nucleotide-count}/Example.pm +0 -0
- data/tracks/perl5/{nucleotide-count → exercises/nucleotide-count}/nucleotide_count.t +5 -0
- data/tracks/perl5/{ocr-numbers → exercises/ocr-numbers}/Example.pm +0 -0
- data/tracks/perl5/{ocr-numbers → exercises/ocr-numbers}/ocr.t +7 -2
- data/tracks/perl5/{palindrome-products → exercises/palindrome-products}/Example.pm +0 -0
- data/tracks/perl5/{palindrome-products → exercises/palindrome-products}/palindrome.t +6 -1
- data/tracks/perl5/{pascals-triangle → exercises/pascals-triangle}/Example.pm +0 -0
- data/tracks/perl5/{pascals-triangle → exercises/pascals-triangle}/cases.json +0 -0
- data/tracks/perl5/{pascals-triangle → exercises/pascals-triangle}/triangle.t +7 -2
- data/tracks/perl5/{phone-number → exercises/phone-number}/Example.pm +0 -0
- data/tracks/perl5/{phone-number → exercises/phone-number}/cases.json +0 -0
- data/tracks/perl5/{phone-number → exercises/phone-number}/phone.t +7 -2
- data/tracks/perl5/{pig-latin → exercises/pig-latin}/Example.pm +0 -0
- data/tracks/perl5/{pig-latin → exercises/pig-latin}/piglatin.t +6 -1
- data/tracks/perl5/{point-mutations → exercises/point-mutations}/Example.pm +0 -0
- data/tracks/perl5/{point-mutations → exercises/point-mutations}/cases.json +0 -0
- data/tracks/perl5/{point-mutations → exercises/point-mutations}/dna.t +7 -2
- data/tracks/perl5/{prime-factors → exercises/prime-factors}/Example.pm +0 -0
- data/tracks/perl5/{prime-factors → exercises/prime-factors}/cases.json +0 -0
- data/tracks/perl5/{prime-factors → exercises/prime-factors}/prime.t +7 -2
- data/tracks/perl5/{proverb → exercises/proverb}/Example.pm +0 -0
- data/tracks/perl5/{proverb → exercises/proverb}/cases.json +0 -0
- data/tracks/perl5/{proverb → exercises/proverb}/proverb.t +8 -2
- data/tracks/perl5/{pythagorean-triplet → exercises/pythagorean-triplet}/Example.pm +0 -0
- data/tracks/perl5/{pythagorean-triplet → exercises/pythagorean-triplet}/triplet.t +7 -2
- data/tracks/perl5/{queen-attack → exercises/queen-attack}/Example.pm +0 -0
- data/tracks/perl5/{queen-attack → exercises/queen-attack}/cases.json +0 -0
- data/tracks/perl5/{queen-attack → exercises/queen-attack}/queen.t +9 -4
- data/tracks/perl5/{raindrops → exercises/raindrops}/Example.pm +0 -0
- data/tracks/perl5/{raindrops → exercises/raindrops}/cases.json +0 -0
- data/tracks/perl5/{raindrops → exercises/raindrops}/raindrops.t +9 -4
- data/tracks/perl5/{rna-transcription → exercises/rna-transcription}/Example.pm +0 -0
- data/tracks/perl5/{rna-transcription → exercises/rna-transcription}/rna.t +8 -3
- data/tracks/perl5/{robot-name → exercises/robot-name}/Example.pm +0 -0
- data/tracks/perl5/{robot-name → exercises/robot-name}/robot_name.t +7 -1
- data/tracks/perl5/{robot-simulator → exercises/robot-simulator}/Example.pm +0 -0
- data/tracks/perl5/{robot-simulator → exercises/robot-simulator}/robot_simulator.t +6 -1
- data/tracks/perl5/{roman-numerals → exercises/roman-numerals}/Example.pm +0 -0
- data/tracks/perl5/{roman-numerals → exercises/roman-numerals}/roman.t +6 -1
- data/tracks/perl5/{saddle-points → exercises/saddle-points}/Example.pm +0 -0
- data/tracks/perl5/{saddle-points → exercises/saddle-points}/saddle_points.t +6 -1
- data/tracks/perl5/{say → exercises/say}/Example.pm +0 -0
- data/tracks/perl5/{say → exercises/say}/say.t +6 -1
- data/tracks/perl5/{scrabble-score → exercises/scrabble-score}/Example.pm +0 -0
- data/tracks/perl5/{scrabble-score → exercises/scrabble-score}/scrabble.t +6 -2
- data/tracks/perl5/{secret-handshake → exercises/secret-handshake}/Example.pm +0 -0
- data/tracks/perl5/{secret-handshake → exercises/secret-handshake}/handshake.t +6 -1
- data/tracks/perl5/{series → exercises/series}/Example.pm +0 -0
- data/tracks/perl5/{series → exercises/series}/series.t +5 -0
- data/tracks/perl5/{sieve → exercises/sieve}/Example.pm +0 -0
- data/tracks/perl5/{sieve → exercises/sieve}/sieve.t +6 -1
- data/tracks/perl5/{simple-cipher → exercises/simple-cipher}/Example.pm +0 -0
- data/tracks/perl5/{simple-cipher → exercises/simple-cipher}/cipher.t +6 -1
- data/tracks/perl5/{simple-linked-list → exercises/simple-linked-list}/Example.pm +0 -0
- data/tracks/perl5/{simple-linked-list → exercises/simple-linked-list}/simple_linked_list.t +5 -0
- data/tracks/perl5/{space-age → exercises/space-age}/Example.pm +0 -0
- data/tracks/perl5/{space-age → exercises/space-age}/space.t +6 -1
- data/tracks/perl5/{strain → exercises/strain}/Example.pm +0 -0
- data/tracks/perl5/{strain → exercises/strain}/strain.t +6 -1
- data/tracks/perl5/{sublist → exercises/sublist}/Example.pm +0 -0
- data/tracks/perl5/{sublist → exercises/sublist}/sublist.t +5 -0
- data/tracks/perl5/{sum-of-multiples → exercises/sum-of-multiples}/Example.pm +0 -0
- data/tracks/perl5/{sum-of-multiples → exercises/sum-of-multiples}/sum_of_multiples.t +6 -1
- data/tracks/perl5/{triangle → exercises/triangle}/Example.pm +0 -0
- data/tracks/perl5/{triangle → exercises/triangle}/cases.json +0 -0
- data/tracks/perl5/{triangle → exercises/triangle}/triangle.t +9 -4
- data/tracks/perl5/{trinary → exercises/trinary}/Example.pm +0 -0
- data/tracks/perl5/{trinary → exercises/trinary}/trinary.t +6 -1
- data/tracks/perl5/{twelve-days → exercises/twelve-days}/Example.pm +0 -0
- data/tracks/perl5/{twelve-days → exercises/twelve-days}/song.t +7 -2
- data/tracks/perl5/{word-count → exercises/word-count}/Example.pm +0 -0
- data/tracks/perl5/{word-count → exercises/word-count}/word_count.t +8 -3
- data/tracks/perl5/{wordy → exercises/wordy}/Example.pm +0 -0
- data/tracks/perl5/{wordy → exercises/wordy}/cases.json +0 -0
- data/tracks/perl5/{wordy → exercises/wordy}/wordy.t +9 -4
- data/tracks/perl6/.travis.yml +10 -3
- data/tracks/perl6/SETUP.md +7 -0
- data/tracks/perl6/docs/LEARNING.md +1 -1
- data/tracks/perl6/docs/RESOURCES.md +1 -2
- data/tracks/perl6/docs/{TOOLS.md → TESTS.md} +0 -0
- data/tracks/perl6/{accumulate → exercises/accumulate}/Example.pm +0 -0
- data/tracks/perl6/{accumulate → exercises/accumulate}/accumulate.t +1 -0
- data/tracks/perl6/{anagram → exercises/anagram}/Example.pm +0 -0
- data/tracks/perl6/{anagram → exercises/anagram}/anagram.t +1 -0
- data/tracks/perl6/{binary → exercises/binary}/Example.pm +0 -0
- data/tracks/perl6/{binary → exercises/binary}/binary.t +1 -0
- data/tracks/perl6/{bob → exercises/bob}/Example.pm +0 -0
- data/tracks/perl6/{bob → exercises/bob}/bob.t +1 -0
- data/tracks/perl6/{grains → exercises/grains}/Example.pm +0 -0
- data/tracks/perl6/{grains → exercises/grains}/grains.t +1 -0
- data/tracks/perl6/{leap → exercises/leap}/Example.pm +0 -0
- data/tracks/perl6/{leap → exercises/leap}/leap.t +1 -0
- data/tracks/perl6/{raindrops → exercises/raindrops}/Example.pm +0 -0
- data/tracks/perl6/{raindrops → exercises/raindrops}/raindrops.t +1 -0
- data/tracks/perl6/{rna-transcription → exercises/rna-transcription}/Example.pm +0 -0
- data/tracks/perl6/{rna-transcription → exercises/rna-transcription}/rna_transcription.t +5 -4
- data/tracks/perl6/{robot-name → exercises/robot-name}/Example.pm +0 -0
- data/tracks/perl6/{robot-name → exercises/robot-name}/robot.t +1 -0
- data/tracks/perl6/{scrabble-score → exercises/scrabble-score}/Example.pm +0 -0
- data/tracks/perl6/{scrabble-score → exercises/scrabble-score}/scrabble_score.t +1 -0
- data/tracks/perl6/{word-count → exercises/word-count}/Example.pm +0 -0
- data/tracks/perl6/{word-count → exercises/word-count}/word_count.t +1 -0
- data/tracks/ruby/exercises/accumulate/accumulate_test.rb +21 -0
- data/tracks/ruby/exercises/accumulate/example.rb +4 -0
- data/tracks/ruby/exercises/bob/bob_test.rb +1 -1
- data/tracks/ruby/exercises/bob/example.rb +3 -1
- data/tracks/ruby/exercises/bowling/example.rb +4 -4
- metadata +174 -169
- data/tracks/perl5/testall.pl +0 -18
data/tracks/go/.travis.yml
CHANGED
@@ -26,7 +26,7 @@ go:
|
|
26
26
|
- tip
|
27
27
|
|
28
28
|
# Travis runs in a 64 bit environment but beginning with Go 1.5, building a
|
29
|
-
# 32 bit target is as easy as specifying GOARCH. We test both to
|
29
|
+
# 32 bit target is as easy as specifying GOARCH. We test both to accommodate
|
30
30
|
# users that might be running 32 bit environments and make sure our code
|
31
31
|
# works for them.
|
32
32
|
#
|
data/tracks/go/docs/LEARNING.md
CHANGED
@@ -7,3 +7,4 @@ Exercism provides exercises and feedback but can be difficult to jump into for t
|
|
7
7
|
* [Go Standard Library](http://golang.org/pkg/)
|
8
8
|
* [Go Resources](http://golang.org/help)
|
9
9
|
* [StackOverflow](http://stackoverflow.com/questions/tagged/go)
|
10
|
+
* [Awesome Go](https://github.com/avelino/awesome-go): [E-Books](https://github.com/avelino/awesome-go#e-books) and [Tutorials](https://github.com/avelino/awesome-go#tutorials)
|
data/tracks/java/config.json
CHANGED
@@ -39,6 +39,7 @@
|
|
39
39
|
"luhn",
|
40
40
|
"pig-latin",
|
41
41
|
"simple-linked-list",
|
42
|
+
"sum-of-multiples",
|
42
43
|
"linked-list",
|
43
44
|
"nth-prime",
|
44
45
|
"pascals-triangle",
|
@@ -225,6 +226,11 @@
|
|
225
226
|
"difficulty": 1,
|
226
227
|
"topics": []
|
227
228
|
},
|
229
|
+
{
|
230
|
+
"slug": "sum-of-multiples",
|
231
|
+
"difficulty": 1,
|
232
|
+
"topics": []
|
233
|
+
},
|
228
234
|
{
|
229
235
|
"slug": "linked-list",
|
230
236
|
"difficulty": 1,
|
@@ -0,0 +1,17 @@
|
|
1
|
+
apply plugin: "java"
|
2
|
+
apply plugin: "eclipse"
|
3
|
+
apply plugin: "idea"
|
4
|
+
|
5
|
+
repositories {
|
6
|
+
mavenCentral()
|
7
|
+
}
|
8
|
+
|
9
|
+
dependencies {
|
10
|
+
testCompile "junit:junit:4.12"
|
11
|
+
}
|
12
|
+
test {
|
13
|
+
testLogging {
|
14
|
+
exceptionFormat = 'full'
|
15
|
+
events = ["passed", "failed", "skipped"]
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import java.util.Arrays;
|
2
|
+
public class SumOfMultiples {
|
3
|
+
|
4
|
+
|
5
|
+
public int Sum(int number, int[] set) {
|
6
|
+
|
7
|
+
int sum = 0;
|
8
|
+
int count = 0;
|
9
|
+
|
10
|
+
for (int i = 1; i < number; i++) {
|
11
|
+
|
12
|
+
for (int j = 0; j < set.length; j++) {
|
13
|
+
if (i % set[j] == 0) {
|
14
|
+
count++;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
if (count > 0) {
|
19
|
+
sum = sum + i;
|
20
|
+
count = 0;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
return sum;
|
25
|
+
}
|
26
|
+
|
27
|
+
}
|
@@ -0,0 +1,187 @@
|
|
1
|
+
import static org.junit.Assert.*;
|
2
|
+
|
3
|
+
import org.junit.Ignore;
|
4
|
+
import org.junit.Test;
|
5
|
+
|
6
|
+
public class SumOfMultiplesTest {
|
7
|
+
|
8
|
+
|
9
|
+
@Test
|
10
|
+
public void testSumOfMultiplesOf3and4UpToOne() {
|
11
|
+
|
12
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
13
|
+
int[] set = {
|
14
|
+
3,
|
15
|
+
5
|
16
|
+
};
|
17
|
+
int output = mySum.Sum(1, set);
|
18
|
+
assertEquals(0, output);
|
19
|
+
|
20
|
+
}
|
21
|
+
|
22
|
+
|
23
|
+
@Test
|
24
|
+
@Ignore
|
25
|
+
public void testSumOfMultiplesOf3and5UpToFour() {
|
26
|
+
|
27
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
28
|
+
int[] set = {
|
29
|
+
3,
|
30
|
+
5
|
31
|
+
};
|
32
|
+
int output = mySum.Sum(4, set);
|
33
|
+
assertEquals(3, output);
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
@Test
|
39
|
+
@Ignore
|
40
|
+
public void testSumOfMultiplesOf3and5UpToTen() {
|
41
|
+
|
42
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
43
|
+
int[] set = {
|
44
|
+
3,
|
45
|
+
5
|
46
|
+
};
|
47
|
+
int output = mySum.Sum(10, set);
|
48
|
+
assertEquals(23, output);
|
49
|
+
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
@Test
|
54
|
+
@Ignore
|
55
|
+
public void testSumOfMultiplesOf3and5UpToOneHundred() {
|
56
|
+
|
57
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
58
|
+
int[] set = {
|
59
|
+
3,
|
60
|
+
5
|
61
|
+
};
|
62
|
+
int output = mySum.Sum(100, set);
|
63
|
+
assertEquals(2318, output);
|
64
|
+
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
@Test
|
69
|
+
@Ignore
|
70
|
+
public void testSumOfMultiplesOf3and5UpToOneThousand() {
|
71
|
+
|
72
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
73
|
+
int[] set = {
|
74
|
+
3,
|
75
|
+
5
|
76
|
+
};
|
77
|
+
int output = mySum.Sum(1000, set);
|
78
|
+
assertEquals(233168, output);
|
79
|
+
|
80
|
+
}
|
81
|
+
|
82
|
+
|
83
|
+
@Test
|
84
|
+
@Ignore
|
85
|
+
public void testSumOfMultiplesOf7and13and17UpToTwenty() {
|
86
|
+
|
87
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
88
|
+
int[] set = {
|
89
|
+
7,
|
90
|
+
13,
|
91
|
+
17
|
92
|
+
};
|
93
|
+
int output = mySum.Sum(20, set);
|
94
|
+
assertEquals(51, output);
|
95
|
+
|
96
|
+
}
|
97
|
+
|
98
|
+
|
99
|
+
@Test
|
100
|
+
@Ignore
|
101
|
+
public void testSumOfMultiplesOf4and6UpToFifteen() {
|
102
|
+
|
103
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
104
|
+
int[] set = {
|
105
|
+
4,
|
106
|
+
6
|
107
|
+
};
|
108
|
+
int output = mySum.Sum(15, set);
|
109
|
+
assertEquals(30, output);
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
|
114
|
+
@Test
|
115
|
+
@Ignore
|
116
|
+
public void testSumOfMultiplesOf5and6and8UpToOneHundredFifty() {
|
117
|
+
|
118
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
119
|
+
int[] set = {
|
120
|
+
5,
|
121
|
+
6,
|
122
|
+
8
|
123
|
+
};
|
124
|
+
int output = mySum.Sum(150, set);
|
125
|
+
assertEquals(4419, output);
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
|
130
|
+
@Test
|
131
|
+
@Ignore
|
132
|
+
public void testSumOfMultiplesOf5and25UpToTwoHundredSeventyFive() {
|
133
|
+
|
134
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
135
|
+
int[] set = {
|
136
|
+
5,
|
137
|
+
25
|
138
|
+
};
|
139
|
+
int output = mySum.Sum(51, set);
|
140
|
+
assertEquals(275, output);
|
141
|
+
|
142
|
+
}
|
143
|
+
|
144
|
+
|
145
|
+
@Test
|
146
|
+
@Ignore
|
147
|
+
public void testSumOfMultiplesOf43and47UpToTenThousand() {
|
148
|
+
|
149
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
150
|
+
int[] set = {
|
151
|
+
43,
|
152
|
+
47
|
153
|
+
};
|
154
|
+
int output = mySum.Sum(10000, set);
|
155
|
+
assertEquals(2203160, output);
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
|
160
|
+
@Test
|
161
|
+
@Ignore
|
162
|
+
public void testSumOfMultiplesOfOneUpToOneHundred() {
|
163
|
+
|
164
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
165
|
+
int[] set = {
|
166
|
+
1
|
167
|
+
};
|
168
|
+
int output = mySum.Sum(100, set);
|
169
|
+
assertEquals(4950, output);
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
@Test
|
175
|
+
@Ignore
|
176
|
+
public void testSumOfMultiplesOfNoneUpToTenThousand() {
|
177
|
+
|
178
|
+
SumOfMultiples mySum = new SumOfMultiples();
|
179
|
+
int[] set = {};
|
180
|
+
int output = mySum.Sum(10000, set);
|
181
|
+
assertEquals(0, output);
|
182
|
+
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
}
|
@@ -1,22 +1,17 @@
|
|
1
1
|
open Core.Std
|
2
2
|
|
3
|
-
|
4
|
-
*
|
5
|
-
* The list is in reverse order (more efficient to construct).
|
6
|
-
*
|
7
|
-
* This uses manual string slicing to avoid depending on any regex package
|
8
|
-
* and because regexes are best avoided for simple tasks.
|
9
|
-
*)
|
10
|
-
let words (s: string): string list =
|
11
|
-
let f i ((osi, l) as acc) c = match (osi, c) with
|
12
|
-
| (None, c) when Char.is_alphanum c -> (Some i, l)
|
13
|
-
| (Some si, c) when not (Char.is_alphanum c) -> (None, String.slice s si i :: l)
|
14
|
-
| _ -> acc
|
15
|
-
in
|
16
|
-
match String.foldi ~init:(None, []) ~f s with
|
17
|
-
| (None, l) -> l
|
18
|
-
| (Some si, l) -> String.drop_prefix s si :: l
|
3
|
+
module SMap = String.Map
|
19
4
|
|
20
|
-
let
|
21
|
-
|
22
|
-
|
5
|
+
let add_to_map wcs w =
|
6
|
+
SMap.update wcs w ~f:(fun k -> Option.value_map k ~default:1 ~f:((+) 1))
|
7
|
+
|
8
|
+
let normalize = function
|
9
|
+
| ch when Char.is_alphanum ch || ch = '\'' -> Char.lowercase ch
|
10
|
+
| _ -> ' '
|
11
|
+
|
12
|
+
let word_count s =
|
13
|
+
let s = String.substr_replace_all s ~pattern:" \'" ~with_:" " in
|
14
|
+
let s = String.substr_replace_all s ~pattern:"\' " ~with_:" " in
|
15
|
+
let s = String.map s ~f:normalize in
|
16
|
+
let split = List.filter (String.split s ~on:' ') ~f:(Fn.non String.is_empty) in
|
17
|
+
List.fold ~init:SMap.empty ~f:add_to_map split
|
@@ -8,23 +8,38 @@ let ae exp got _test_ctxt =
|
|
8
8
|
let printer m = SMap.sexp_of_t Int.sexp_of_t m |> Sexp.to_string_hum ~indent:1 in
|
9
9
|
assert_equal (SMap.of_alist_exn exp) got ~cmp:(SMap.equal (=)) ~printer
|
10
10
|
|
11
|
-
let tests =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
11
|
+
let tests = [
|
12
|
+
"count one word" >::
|
13
|
+
ae [("word", 1)]
|
14
|
+
(word_count "word");
|
15
|
+
"count one of each word" >::
|
16
|
+
ae [("one", 1); ("of", 1); ("each", 1)]
|
17
|
+
(word_count "one of each");
|
18
|
+
"multiple occurrences of a word" >::
|
19
|
+
ae [("one", 1); ("fish", 4); ("two", 1); ("red", 1); ("blue", 1)]
|
20
|
+
(word_count "one fish two fish red fish blue fish");
|
21
|
+
"handles cramped lists" >::
|
22
|
+
ae [("one", 1); ("two", 1); ("three", 1)]
|
23
|
+
(word_count "one,two,three");
|
24
|
+
"handles expanded lists" >::
|
25
|
+
ae [("one", 1); ("two", 1); ("three", 1)]
|
26
|
+
(word_count "one,\ntwo,\nthree");
|
27
|
+
"ignore punctuation" >::
|
28
|
+
ae [("car", 1); ("carpet", 1); ("as", 1); ("java", 1); ("javascript", 1)]
|
29
|
+
(word_count "car: carpet as java: javascript!!&@$%^&");
|
30
|
+
"include numbers" >::
|
31
|
+
ae [("testing", 2); ("1", 1); ("2", 1)]
|
32
|
+
(word_count "testing, 1, 2 testing");
|
33
|
+
"normalize case" >::
|
34
|
+
ae [("go", 3); ("stop", 2)]
|
35
|
+
(word_count "go Go GO Stop stop");
|
36
|
+
"with apostrophes" >::
|
37
|
+
ae [("first", 1); ("don't", 2); ("laugh", 1); ("then", 1); ("cry", 1)]
|
38
|
+
(word_count "First: don't laugh. Then: don't cry.");
|
39
|
+
"with_quotations" >::
|
40
|
+
ae [("joe", 1); ("can't", 1); ("tell", 1); ("between", 1); ("large", 2); ("and", 1)]
|
41
|
+
(word_count "Joe can't tell between 'large' and large.");
|
42
|
+
]
|
28
43
|
|
29
44
|
let () =
|
30
|
-
run_test_tt_main ("word_count tests" >::: tests)
|
45
|
+
run_test_tt_main ("word_count tests" >::: tests)
|
@@ -2,16 +2,23 @@ open Core.Std
|
|
2
2
|
|
3
3
|
open Model
|
4
4
|
|
5
|
-
type
|
5
|
+
type fixup_parameter_function = key: string -> value: parameter -> string
|
6
|
+
|
7
|
+
type edit_parameters_function = (string * string) list -> (string * string) list
|
8
|
+
|
9
|
+
let parameters_to_string pp: string =
|
10
|
+
List.map ~f:(fun (k,v) -> "(" ^ k ^ "," ^ v ^ ")") pp
|
11
|
+
|> String.concat ~sep:";"
|
6
12
|
|
7
13
|
let replace_key (key: string) (value: string) (target: string): string =
|
8
14
|
String.substr_replace_all target ~pattern:("$" ^ key) ~with_:value
|
9
15
|
|
10
|
-
let rec replace_keys (f:
|
11
|
-
let s = replace_key "
|
16
|
+
let rec replace_keys (f: fixup_parameter_function) (ed: edit_parameters_function) (s: string) (c: case): string =
|
17
|
+
let s = replace_key "description" c.description s in
|
12
18
|
let expected = f ~key:"expected" ~value:c.expected in
|
13
19
|
let s = replace_key "expected" expected s in
|
14
|
-
List.
|
20
|
+
let parameter_strings = ed @@ List.map ~f:(fun (k,p) -> (k,parameter_to_string p)) c.parameters in
|
21
|
+
List.fold parameter_strings ~init:s ~f:(fun s (k,v) -> replace_key k v s)
|
15
22
|
|
16
|
-
let generate_code (f:
|
17
|
-
Ok (List.map cases ~f:(replace_keys f template))
|
23
|
+
let generate_code (f: fixup_parameter_function) (ed: edit_parameters_function) template cases =
|
24
|
+
Ok (List.map cases ~f:(replace_keys f ed template))
|
@@ -2,6 +2,8 @@ open Core.Std
|
|
2
2
|
|
3
3
|
open Model
|
4
4
|
|
5
|
-
type
|
5
|
+
type fixup_parameter_function = key: string -> value: parameter -> string
|
6
6
|
|
7
|
-
|
7
|
+
type edit_parameters_function = (string * string) list -> (string * string) list
|
8
|
+
|
9
|
+
val generate_code : fixup_parameter_function -> edit_parameters_function -> string -> case list -> (string list, string) Result.t
|
@@ -34,7 +34,7 @@ let parse_case_assoc (parameters: (string * json) list): (case, error) Result.t
|
|
34
34
|
to_string_note BadDescription >>= fun description ->
|
35
35
|
find "expected" BadExpected >>= fun expectedJson ->
|
36
36
|
to_parameter expectedJson |> Result.of_option ~error:BadExpected >>= fun expected ->
|
37
|
-
Ok {
|
37
|
+
Ok {description = description; parameters = parse_parameters test_parameters; expected = expected}
|
38
38
|
|
39
39
|
let parse_case (s: json): (case, error) Result.t = match s with
|
40
40
|
| `Assoc assoc -> parse_case_assoc assoc
|
@@ -7,6 +7,25 @@ let optional_int ~(none: int) = function
|
|
7
7
|
| Int n -> "(Some " ^ Int.to_string n ^ ")"
|
8
8
|
| _ -> failwith "can't handle non-int parameter"
|
9
9
|
|
10
|
+
let default_value ~(key: string) ~(value: string) (parameters: (string * string) list): (string * string) list =
|
11
|
+
if List.exists ~f:(fun (k, _) -> k = key) parameters
|
12
|
+
then parameters
|
13
|
+
else (key, value) :: parameters
|
14
|
+
|
15
|
+
let optional_string ~(f: string -> bool) (parameters: (string * string) list): (string * string) list =
|
16
|
+
let replace parameter =
|
17
|
+
let (k, v) = parameter in
|
18
|
+
if f k
|
19
|
+
then (k, "(Some \"" ^ v ^ "\")")
|
20
|
+
else parameter in
|
21
|
+
List.map ~f:replace parameters
|
22
|
+
|
10
23
|
let fixup ~(stringify: parameter -> string) ~(slug: string) ~(key: string) ~(value: parameter) = match (slug, key) with
|
11
24
|
| ("hamming", "expected") -> optional_int (-1) value
|
12
25
|
| _ -> stringify value
|
26
|
+
|
27
|
+
let edit ~(slug: string) (parameters: (string * string) list) = match (slug, parameters) with
|
28
|
+
| ("hello-world", ps) -> default_value ~key:"name" ~value:"None"
|
29
|
+
@@ optional_string ~f:(fun _x -> true)
|
30
|
+
@@ parameters
|
31
|
+
| (_, ps) -> ps
|
@@ -2,6 +2,12 @@ open Core.Std
|
|
2
2
|
|
3
3
|
open Model
|
4
4
|
|
5
|
+
val default_value : key: string -> value: string -> (string * string) list -> (string * string) list
|
6
|
+
|
5
7
|
val optional_int : none: int -> parameter -> string
|
6
8
|
|
9
|
+
val optional_string : f: (string -> bool) -> (string * string) list -> (string * string) list
|
10
|
+
|
7
11
|
val fixup : stringify:(parameter -> string) -> slug:string -> key:string -> value:parameter -> string
|
12
|
+
|
13
|
+
val edit : slug: string -> (string * string) list -> (string * string) list
|
@@ -45,13 +45,13 @@ let generate_code ~slug ~template_file ~canonical_data_file =
|
|
45
45
|
let open Result.Monad_infix in
|
46
46
|
template >>= fun (s,e,template) ->
|
47
47
|
cases >>= fun cs ->
|
48
|
-
let
|
48
|
+
let substs = Result.ok_or_failwith @@ generate_code (fixup ~stringify:parameter_to_string ~slug) (edit ~slug) template cs in
|
49
49
|
Result.return (splice_in_filled_in_code s e ~template:template_file substs)
|
50
50
|
|
51
51
|
let output_tests (files: (string * content * content) list) (output_folder: string): unit =
|
52
52
|
let output_filepath name = output_folder ^ "/" ^ name ^ "/test.ml" in
|
53
53
|
let output1 (slug,t,c) =
|
54
|
-
let
|
54
|
+
let code = Result.ok_or_failwith @@ generate_code slug t c in
|
55
55
|
Out_channel.write_all (output_filepath slug) code in
|
56
56
|
List.iter files ~f:output1
|
57
57
|
|