trackler 2.1.0.4 → 2.1.0.5
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/.travis.yml +1 -0
- data/tracks/ecmascript/Makefile +13 -18
- data/tracks/ecmascript/README.md +4 -8
- data/tracks/ecmascript/docs/INSTALLATION.md +1 -17
- data/tracks/ecmascript/docs/TESTS.md +10 -3
- data/tracks/ecmascript/exercises/accumulate/package.json +62 -13
- data/tracks/ecmascript/exercises/acronym/package.json +62 -13
- data/tracks/ecmascript/exercises/all-your-base/package.json +62 -13
- data/tracks/ecmascript/exercises/allergies/package.json +62 -13
- data/tracks/ecmascript/exercises/anagram/package.json +62 -13
- data/tracks/ecmascript/exercises/atbash-cipher/package.json +62 -13
- data/tracks/ecmascript/exercises/beer-song/package.json +62 -13
- data/tracks/ecmascript/exercises/binary-search-tree/package.json +62 -13
- data/tracks/ecmascript/exercises/binary-search/package.json +62 -13
- data/tracks/ecmascript/exercises/binary/package.json +62 -13
- data/tracks/ecmascript/exercises/bob/package.json +62 -13
- data/tracks/ecmascript/exercises/bracket-push/package.json +62 -13
- data/tracks/ecmascript/exercises/circular-buffer/package.json +62 -13
- data/tracks/ecmascript/exercises/clock/package.json +62 -13
- data/tracks/ecmascript/exercises/crypto-square/package.json +62 -13
- data/tracks/ecmascript/exercises/custom-set/package.json +62 -13
- data/tracks/ecmascript/exercises/diamond/package.json +62 -13
- data/tracks/ecmascript/exercises/difference-of-squares/package.json +62 -13
- data/tracks/ecmascript/exercises/etl/package.json +62 -13
- data/tracks/ecmascript/exercises/food-chain/package.json +62 -13
- data/tracks/ecmascript/exercises/gigasecond/package.json +62 -13
- data/tracks/ecmascript/exercises/grade-school/package.json +62 -13
- data/tracks/ecmascript/exercises/grains/package.json +62 -13
- data/tracks/ecmascript/exercises/hamming/package.json +62 -13
- data/tracks/ecmascript/exercises/hello-world/example.js +5 -4
- data/tracks/ecmascript/exercises/hello-world/hello-world.js +7 -5
- data/tracks/ecmascript/exercises/hello-world/hello-world.spec.js +4 -2
- data/tracks/ecmascript/exercises/hello-world/package.json +62 -13
- data/tracks/ecmascript/exercises/hexadecimal/package.json +62 -13
- data/tracks/ecmascript/exercises/isogram/package.json +62 -13
- data/tracks/ecmascript/exercises/kindergarten-garden/package.json +62 -13
- data/tracks/ecmascript/exercises/largest-series-product/package.json +62 -13
- data/tracks/ecmascript/exercises/leap/example.js +10 -1
- data/tracks/ecmascript/exercises/leap/leap.spec.js +13 -30
- data/tracks/ecmascript/exercises/leap/package.json +62 -13
- data/tracks/ecmascript/exercises/linked-list/package.json +62 -13
- data/tracks/ecmascript/exercises/luhn/package.json +62 -13
- data/tracks/ecmascript/exercises/matrix/package.json +62 -13
- data/tracks/ecmascript/exercises/meetup/package.json +62 -13
- data/tracks/ecmascript/exercises/nth-prime/package.json +62 -13
- data/tracks/ecmascript/exercises/ocr-numbers/package.json +62 -13
- data/tracks/ecmascript/exercises/octal/package.json +62 -13
- data/tracks/ecmascript/exercises/package.json +62 -9
- data/tracks/ecmascript/exercises/palindrome-products/package.json +62 -13
- data/tracks/ecmascript/exercises/palindrome-products/palindrome-products.spec.js +28 -1
- data/tracks/ecmascript/exercises/pangram/package.json +62 -13
- data/tracks/ecmascript/exercises/pascals-triangle/package.json +62 -13
- data/tracks/ecmascript/exercises/perfect-numbers/example.js +1 -1
- data/tracks/ecmascript/exercises/perfect-numbers/package.json +62 -13
- data/tracks/ecmascript/exercises/perfect-numbers/perfect-numbers.spec.js +16 -14
- data/tracks/ecmascript/exercises/phone-number/package.json +62 -13
- data/tracks/ecmascript/exercises/pig-latin/package.json +62 -13
- data/tracks/ecmascript/exercises/prime-factors/package.json +62 -13
- data/tracks/ecmascript/exercises/pythagorean-triplet/package.json +62 -13
- data/tracks/ecmascript/exercises/queen-attack/package.json +62 -13
- data/tracks/ecmascript/exercises/raindrops/package.json +62 -13
- data/tracks/ecmascript/exercises/rna-transcription/package.json +62 -13
- data/tracks/ecmascript/exercises/robot-name/package.json +62 -13
- data/tracks/ecmascript/exercises/robot-simulator/package.json +62 -13
- data/tracks/ecmascript/exercises/roman-numerals/package.json +62 -13
- data/tracks/ecmascript/exercises/saddle-points/package.json +62 -13
- data/tracks/ecmascript/exercises/say/package.json +62 -13
- data/tracks/ecmascript/exercises/scrabble-score/package.json +62 -13
- data/tracks/ecmascript/exercises/secret-handshake/package.json +62 -13
- data/tracks/ecmascript/exercises/series/package.json +62 -13
- data/tracks/ecmascript/exercises/sieve/package.json +62 -13
- data/tracks/ecmascript/exercises/simple-cipher/package.json +62 -13
- data/tracks/ecmascript/exercises/space-age/package.json +62 -13
- data/tracks/ecmascript/exercises/strain/package.json +62 -13
- data/tracks/ecmascript/exercises/sum-of-multiples/package.json +62 -13
- data/tracks/ecmascript/exercises/triangle/package.json +62 -13
- data/tracks/ecmascript/exercises/trinary/package.json +62 -13
- data/tracks/ecmascript/exercises/two-bucket/package.json +62 -13
- data/tracks/ecmascript/exercises/word-count/package.json +62 -13
- data/tracks/ecmascript/exercises/wordy/package.json +62 -13
- data/tracks/ecmascript/package.json +62 -13
- data/tracks/erlang/.github/stale.yml +3 -0
- data/tracks/go/exercises/series/asktoomuch_test.go +1 -1
- data/tracks/go/exercises/series/example.go +2 -2
- data/tracks/go/exercises/series/first_example.go +1 -1
- data/tracks/go/exercises/series/first_test.go +1 -1
- data/tracks/go/exercises/series/series_test.go +2 -2
- data/tracks/ocaml/exercises/bracket-push/test.ml +2 -0
- data/tracks/ocaml/exercises/phone-number/example.ml +7 -2
- data/tracks/ocaml/exercises/phone-number/test.ml +11 -5
- data/tracks/ocaml/tools/test-generator/templates/phone-number/template.ml +1 -1
- data/tracks/pony/.github/stale.yml +16 -0
- data/tracks/purescript/config.json +7 -0
- data/tracks/purescript/exercises/pascals-triangle/bower.json +16 -0
- data/tracks/purescript/exercises/pascals-triangle/examples/src/PascalsTriangle.purs +24 -0
- data/tracks/purescript/exercises/pascals-triangle/src/PascalsTriangle.purs +1 -0
- data/tracks/purescript/exercises/pascals-triangle/test/Main.purs +74 -0
- data/tracks/ruby/.github/ISSUE_TEMPLATE.md +2 -2
- data/tracks/ruby/.github/PULL_REQUEST_TEMPLATE.md +14 -10
- data/tracks/ruby/.github/stale.yml +21 -0
- data/tracks/ruby/README.md +80 -74
- data/tracks/ruby/{lib → exercises/acronym/.meta/generator}/acronym_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/all-your-base/.meta/generator}/all_your_base_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/alphametics/.meta/generator}/alphametics_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/anagram/.meta/generator}/anagram_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/beer-song/.meta/generator}/beer_song_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/binary/.meta/generator}/binary_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/bowling/.meta/generator}/bowling_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/bracket-push/.meta/generator}/bracket_push_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/clock/.meta/generator}/clock_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/connect/.meta/generator}/connect_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/custom-set/.meta/generator}/custom_set_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/difference-of-squares/.meta/generator}/difference_of_squares_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/dominoes/.meta/generator}/dominoes_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/etl/.meta/generator}/etl_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/gigasecond/.meta/generator}/gigasecond_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/grains/.meta/generator}/grains_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/hamming/.meta/generator}/hamming_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/hello-world/.meta/generator}/hello_world_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/isogram/.meta/generator}/isogram_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/largest-series-product/.meta/generator}/largest_series_product_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/leap/.meta/generator}/leap_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/luhn/.meta/generator}/luhn_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/nth-prime/.meta/generator}/nth_prime_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/ocr-numbers/.meta/generator}/ocr_numbers_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/pangram/.meta/generator}/pangram_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/pig-latin/.meta/generator}/pig_latin_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/queen-attack/.meta/generator}/queen_attack_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/raindrops/.meta/generator}/raindrops_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/rna-transcription/.meta/generator}/rna_transcription_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/roman-numerals/.meta/generator}/roman_numerals_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/run-length-encoding/.meta/generator}/run_length_encoding_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/say/.meta/generator}/say_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/sieve/.meta/generator}/sieve_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/tournament/.meta/generator}/tournament_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/transpose/.meta/generator}/transpose_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/triangle/.meta/generator}/triangle_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/two-bucket/.meta/generator}/two_bucket_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/word-count/.meta/generator}/word_count_cases.rb +0 -0
- data/tracks/ruby/{lib → exercises/wordy/.meta/generator}/wordy_cases.rb +0 -0
- data/tracks/ruby/lib/generator/files.rb +5 -1
- data/tracks/ruby/lib/generator/files/generator_cases.rb +18 -4
- data/tracks/ruby/lib/generator/files/metadata_files.rb +3 -0
- data/tracks/ruby/lib/generator/files/track_files.rb +24 -6
- data/tracks/ruby/test/fixtures/xruby/exercises/alpha/.meta/generator/test_template.erb +23 -0
- data/tracks/ruby/test/fixtures/xruby/exercises/beta/.meta/.version +1 -0
- data/tracks/ruby/test/fixtures/xruby/{lib → exercises/beta/.meta/generator}/beta_cases.rb +0 -0
- data/tracks/ruby/test/fixtures/xruby/exercises/beta/example.rb +5 -0
- data/tracks/ruby/test/fixtures/xruby/exercises/{alpha → beta}/example.tt +10 -7
- data/tracks/ruby/test/generator/files/generate_cases_test.rb +25 -1
- data/tracks/ruby/test/generator/files/metadata_files_test.rb +21 -0
- data/tracks/ruby/test/generator/files/track_files_test.rb +20 -3
- data/tracks/ruby/test/generator/files_test.rb +18 -0
- data/tracks/ruby/test/wordy_cases_test.rb +1 -0
- data/tracks/typescript/README.md +1 -1
- data/tracks/typescript/config.json +6 -0
- data/tracks/typescript/exercises/difference-of-squares/difference-of-squares.example.ts +39 -0
- data/tracks/typescript/exercises/difference-of-squares/difference-of-squares.test.ts +56 -0
- data/tracks/typescript/exercises/difference-of-squares/package.json +36 -0
- data/tracks/typescript/exercises/difference-of-squares/tsconfig.json +21 -0
- data/tracks/typescript/exercises/difference-of-squares/tslint.json +127 -0
- data/tracks/typescript/exercises/difference-of-squares/yarn.lock +2739 -0
- data/tracks/typescript/exercises/wordy/wordy.example.ts +1 -1
- metadata +56 -114
- data/tracks/csharp/.github/stale.yml +0 -0
- data/tracks/ecmascript/exercises/accumulate/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/acronym/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/all-your-base/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/allergies/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/anagram/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/atbash-cipher/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/beer-song/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/binary-search-tree/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/binary-search/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/binary/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/bob/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/bracket-push/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/circular-buffer/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/clock/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/crypto-square/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/custom-set/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/diamond/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/difference-of-squares/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/etl/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/food-chain/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/gigasecond/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/grade-school/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/grains/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/gulpfile.js +0 -89
- data/tracks/ecmascript/exercises/hamming/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/hello-world/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/hexadecimal/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/isogram/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/kindergarten-garden/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/largest-series-product/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/leap/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/linked-list/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/luhn/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/matrix/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/meetup/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/nth-prime/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/ocr-numbers/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/octal/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/palindrome-products/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/palindrome-products/palindrome-products.js +0 -18
- data/tracks/ecmascript/exercises/pangram/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/pascals-triangle/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/perfect-numbers/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/phone-number/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/pig-latin/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/prime-factors/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/pythagorean-triplet/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/queen-attack/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/raindrops/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/rna-transcription/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/robot-name/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/robot-simulator/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/roman-numerals/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/saddle-points/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/say/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/scrabble-score/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/secret-handshake/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/series/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/sieve/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/simple-cipher/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/space-age/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/strain/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/sum-of-multiples/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/triangle/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/trinary/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/two-bucket/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/word-count/gulpfile.js +0 -92
- data/tracks/ecmascript/exercises/wordy/gulpfile.js +0 -92
- data/tracks/ecmascript/gulpfile.js +0 -92
- data/tracks/fsharp/.github/stale.yml +0 -0
@@ -6,7 +6,7 @@ module Generator
|
|
6
6
|
include Exercise
|
7
7
|
|
8
8
|
def tests_version
|
9
|
-
TestsVersionFile.new(filename: File.join(
|
9
|
+
TestsVersionFile.new(filename: File.join(meta_path, '.version'))
|
10
10
|
end
|
11
11
|
|
12
12
|
def example_solution
|
@@ -18,7 +18,7 @@ module Generator
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def tests_template
|
21
|
-
TestsTemplateFile.new(filename:
|
21
|
+
TestsTemplateFile.new(filename: tests_template_absolute_filename)
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
@@ -27,16 +27,34 @@ module Generator
|
|
27
27
|
File.join(paths.track, 'exercises', exercise_name)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
def meta_path
|
31
|
+
File.join(exercise_path, '.meta')
|
32
|
+
end
|
33
|
+
|
34
|
+
def tests_template_absolute_filename
|
35
|
+
case
|
36
|
+
when File.exist?(track_tests_template_filename) then track_tests_template_filename
|
37
|
+
when File.exist?(legacy_tests_template_filename) then legacy_tests_template_filename
|
38
|
+
else default_tests_template_filename
|
39
|
+
end
|
34
40
|
end
|
35
41
|
|
36
42
|
def track_tests_template_filename
|
43
|
+
File.join(meta_path, 'generator', tests_template_filename)
|
44
|
+
end
|
45
|
+
|
46
|
+
def default_tests_template_filename
|
47
|
+
File.join(paths.track, 'lib', 'generator', tests_template_filename)
|
48
|
+
end
|
49
|
+
|
50
|
+
def legacy_tests_template_filename
|
37
51
|
File.join(exercise_path, 'example.tt')
|
38
52
|
end
|
39
53
|
|
54
|
+
def tests_template_filename
|
55
|
+
'test_template.erb'
|
56
|
+
end
|
57
|
+
|
40
58
|
def minitest_tests_filename
|
41
59
|
"#{exercise_name.gsub(/[ -]/, '_')}_test.rb"
|
42
60
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
gem 'minitest', '>= 5.0.0'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require_relative '<%= exercise_name %>'
|
5
|
+
|
6
|
+
# Hi. I am a custom comment
|
7
|
+
|
8
|
+
# Common test data version: <%= abbreviated_commit_hash %>
|
9
|
+
class <%= exercise_name_camel %>Test < Minitest::Test
|
10
|
+
<% test_cases.each do |test_case| %>
|
11
|
+
def <%= test_case.name %>
|
12
|
+
<%= test_case.skipped %>
|
13
|
+
<%= test_case.workload %>
|
14
|
+
end
|
15
|
+
|
16
|
+
<% end %>
|
17
|
+
<%= IO.read(XRUBY_LIB + '/bookkeeping.md') %>
|
18
|
+
|
19
|
+
def test_bookkeeping
|
20
|
+
skip
|
21
|
+
assert_equal <%= version %>, BookKeeping::VERSION
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
1
|
File without changes
|
@@ -1,18 +1,21 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
2
|
+
gem 'minitest', '>= 5.0.0'
|
4
3
|
require 'minitest/autorun'
|
5
|
-
require_relative '
|
4
|
+
require_relative '<%= exercise_name %>'
|
5
|
+
|
6
|
+
# Hi. I am a custom comment
|
6
7
|
|
7
8
|
# Common test data version: <%= abbreviated_commit_hash %>
|
8
|
-
class
|
9
|
+
class <%= exercise_name_camel %>Test < Minitest::Test
|
10
|
+
<% test_cases.each do |test_case| %>
|
9
11
|
def <%= test_case.name %>
|
10
|
-
<%= test_case.
|
11
|
-
|
12
|
-
<%= test_case.assertion %> Alpha.something?(string)
|
12
|
+
<%= test_case.skipped %>
|
13
|
+
<%= test_case.workload %>
|
13
14
|
end
|
15
|
+
|
14
16
|
<% end %>
|
15
17
|
<%= IO.read(XRUBY_LIB + '/bookkeeping.md') %>
|
18
|
+
|
16
19
|
def test_bookkeeping
|
17
20
|
skip
|
18
21
|
assert_equal <%= version %>, BookKeeping::VERSION
|
@@ -15,7 +15,7 @@ module Generator
|
|
15
15
|
|
16
16
|
def test_available_returns_exercise_names
|
17
17
|
track_path = 'test/fixtures/xruby'
|
18
|
-
Dir.stub :
|
18
|
+
Dir.stub :glob, %w(/alpha_cases.rb hy_phen_ated_cases.rb) do
|
19
19
|
assert_equal %w(alpha hy-phen-ated), GeneratorCases.available(track_path)
|
20
20
|
end
|
21
21
|
end
|
@@ -28,6 +28,30 @@ module Generator
|
|
28
28
|
def test_class_name
|
29
29
|
assert_equal 'TwoParterCase', GeneratorCases.class_name('two-parter')
|
30
30
|
end
|
31
|
+
|
32
|
+
def test_load_filename # test the cases_filename alternative
|
33
|
+
track_path = 'test/fixtures/xruby'
|
34
|
+
exercise_name = 'foo'
|
35
|
+
expected_filename = track_path + '/exercises/foo/.meta/generator/foo_cases.rb'
|
36
|
+
File.stub(:exist?, true) do
|
37
|
+
assert_equal(
|
38
|
+
expected_filename,
|
39
|
+
GeneratorCases.load_filename(track_path, exercise_name)
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_load_legacy_filename # test the cases_filename alternative
|
45
|
+
track_path = 'test/fixtures/xruby'
|
46
|
+
exercise_name = 'foo'
|
47
|
+
expected_filename = track_path + '/lib/foo_cases.rb'
|
48
|
+
File.stub(:exist?, false) do
|
49
|
+
assert_equal(
|
50
|
+
expected_filename,
|
51
|
+
GeneratorCases.load_filename(track_path, exercise_name)
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
31
55
|
end
|
32
56
|
end
|
33
57
|
end
|
@@ -21,5 +21,26 @@ module Generator
|
|
21
21
|
assert_instance_of CanonicalDataFile, subject.canonical_data
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
class CanonicalDataFileTest < Minitest::Test
|
26
|
+
def test_version_for_file_that_does_not_exist
|
27
|
+
subject = CanonicalDataFile.new(filename: 'nonexistant')
|
28
|
+
assert_nil subject.version
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_version
|
32
|
+
subject = CanonicalDataFile.new(filename: 'has version key')
|
33
|
+
Files.stub(:read, '{"version": "1.2.3"}' ) do
|
34
|
+
assert_equal "1.2.3", subject.version
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_version_not_present
|
39
|
+
subject = CanonicalDataFile.new(filename: 'no version key')
|
40
|
+
Files.stub(:read, '{ "json": true }' ) do
|
41
|
+
assert_nil subject.version
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
24
45
|
end
|
25
46
|
end
|
@@ -34,7 +34,8 @@ module Generator
|
|
34
34
|
|
35
35
|
def test_tests_template
|
36
36
|
subject = TestTrackFiles.new
|
37
|
-
|
37
|
+
expected_filename = FixturePaths.track + '/exercises/alpha/.meta/generator/test_template.erb'
|
38
|
+
assert_equal expected_filename, subject.tests_template.filename
|
38
39
|
end
|
39
40
|
|
40
41
|
class TestTrackFilesUseDefault
|
@@ -47,8 +48,24 @@ module Generator
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def test_default_tests_template
|
50
|
-
subject =
|
51
|
-
|
51
|
+
subject = TestTrackFilesUseDefault.new
|
52
|
+
expected_filename = FixturePaths.track + '/lib/generator/test_template.erb'
|
53
|
+
assert_equal expected_filename, subject.tests_template.filename
|
54
|
+
end
|
55
|
+
|
56
|
+
class TestTrackFilesUseLegacy
|
57
|
+
def initialize
|
58
|
+
@paths = FixturePaths
|
59
|
+
@exercise_name = 'beta'
|
60
|
+
end
|
61
|
+
attr_reader :paths, :exercise_name
|
62
|
+
include TrackFiles
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_legacy_tests_template
|
66
|
+
subject = TestTrackFilesUseLegacy.new
|
67
|
+
expected_filename = FixturePaths.track + '/exercises/beta/example.tt'
|
68
|
+
assert_equal expected_filename, subject.tests_template.filename
|
52
69
|
end
|
53
70
|
end
|
54
71
|
|
@@ -2,6 +2,24 @@ require_relative '../test_helper'
|
|
2
2
|
|
3
3
|
module Generator
|
4
4
|
module Files
|
5
|
+
|
6
|
+
class ReadTest < Minitest::Test
|
7
|
+
def test_read_existing_file
|
8
|
+
expected = 'content unimportant'
|
9
|
+
File.stub(:exist?, true) do
|
10
|
+
File.stub(:read, expected ) do
|
11
|
+
assert_equal expected, Files.read('pretend/this/exists')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_read_non_existing_file
|
17
|
+
File.stub(:exist?, false) do
|
18
|
+
assert_nil Files.read('pretend/this/does/not/exist')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
5
23
|
class ReadableTest < Minitest::Test
|
6
24
|
def test_abbreviated_commit_hash
|
7
25
|
mock_git_command = Minitest::Mock.new.expect :call, nil, ['path/.git', 'subdir/file']
|
data/tracks/typescript/README.md
CHANGED
@@ -21,7 +21,7 @@ Then, `make` commands will install other dependencies as needed.
|
|
21
21
|
|
22
22
|
## Shared Code
|
23
23
|
|
24
|
-
Please keep the `common` folder files synced across all the sub folders. These files should be the same across
|
24
|
+
Please keep the `common` folder files synced across all the sub folders. These files should be the same across all problems.
|
25
25
|
|
26
26
|
* package.json
|
27
27
|
* tsconfig.json
|
@@ -0,0 +1,39 @@
|
|
1
|
+
export default class Squares {
|
2
|
+
squareOfSums: number
|
3
|
+
sumOfSquares: number
|
4
|
+
difference: number
|
5
|
+
|
6
|
+
constructor(int: number) {
|
7
|
+
this.squareOfSums = this._squareOfSums(int)
|
8
|
+
this.sumOfSquares = this._sumOfSquares(int)
|
9
|
+
this.difference = this._difference()
|
10
|
+
}
|
11
|
+
|
12
|
+
private _squareOfSums(int: number) {
|
13
|
+
let sum = 0
|
14
|
+
let i = 1
|
15
|
+
|
16
|
+
while (i <= int) {
|
17
|
+
sum += i
|
18
|
+
i++
|
19
|
+
}
|
20
|
+
|
21
|
+
return sum * sum
|
22
|
+
}
|
23
|
+
|
24
|
+
private _sumOfSquares(int: number) {
|
25
|
+
let sum = 0
|
26
|
+
let i = 1
|
27
|
+
|
28
|
+
while (i <= int) {
|
29
|
+
sum += (i * i)
|
30
|
+
i++
|
31
|
+
}
|
32
|
+
|
33
|
+
return sum
|
34
|
+
}
|
35
|
+
|
36
|
+
private _difference() {
|
37
|
+
return this.squareOfSums - this.sumOfSquares
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import Squares from './difference-of-squares'
|
2
|
+
|
3
|
+
describe('Squares', () => {
|
4
|
+
|
5
|
+
describe('up to 5', () => {
|
6
|
+
const squares = new Squares(5)
|
7
|
+
|
8
|
+
it('gets the square of sums', () => {
|
9
|
+
expect(squares.squareOfSums).toBe(225)
|
10
|
+
})
|
11
|
+
|
12
|
+
xit('gets the sum of squares', () => {
|
13
|
+
expect(squares.sumOfSquares).toBe(55)
|
14
|
+
})
|
15
|
+
|
16
|
+
xit('gets the difference', () => {
|
17
|
+
expect(squares.difference).toBe(170)
|
18
|
+
})
|
19
|
+
|
20
|
+
})
|
21
|
+
|
22
|
+
describe('up to 10', () => {
|
23
|
+
const squares = new Squares(10)
|
24
|
+
|
25
|
+
xit('gets the square of sums', () => {
|
26
|
+
expect(squares.squareOfSums).toBe(3025)
|
27
|
+
})
|
28
|
+
|
29
|
+
xit('gets the sum of squares', () => {
|
30
|
+
expect(squares.sumOfSquares).toBe(385)
|
31
|
+
})
|
32
|
+
|
33
|
+
xit('gets the difference', () => {
|
34
|
+
expect(squares.difference).toBe(2640)
|
35
|
+
})
|
36
|
+
|
37
|
+
})
|
38
|
+
|
39
|
+
describe('up to 100', () => {
|
40
|
+
const squares = new Squares(100)
|
41
|
+
|
42
|
+
xit('gets the square of sums', () => {
|
43
|
+
expect(squares.squareOfSums).toBe(25502500)
|
44
|
+
})
|
45
|
+
|
46
|
+
xit('gets the sum of squares', () => {
|
47
|
+
expect(squares.sumOfSquares).toBe(338350)
|
48
|
+
})
|
49
|
+
|
50
|
+
xit('gets the difference', () => {
|
51
|
+
expect(squares.difference).toBe(25164150)
|
52
|
+
})
|
53
|
+
|
54
|
+
})
|
55
|
+
|
56
|
+
})
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"name": "xtypescript",
|
3
|
+
"version": "0",
|
4
|
+
"description": "Exercism exercises in Typescript.",
|
5
|
+
"author": "",
|
6
|
+
"private": true,
|
7
|
+
"repository": {
|
8
|
+
"type": "git",
|
9
|
+
"url": "https://github.com/exercism/xtypescript"
|
10
|
+
},
|
11
|
+
"devDependencies": {},
|
12
|
+
"scripts": {
|
13
|
+
"test": "jest --no-cache",
|
14
|
+
"lint": "tslint '*.ts?(x)'; exit 0"
|
15
|
+
},
|
16
|
+
"dependencies": {
|
17
|
+
"@types/jest": "^18.1.1",
|
18
|
+
"@types/node": "^7.0.5",
|
19
|
+
"jest": "^19.0.2",
|
20
|
+
"ts-jest": "^19.0.0",
|
21
|
+
"tslint": "^4.5.1",
|
22
|
+
"typescript": "^2.2.1"
|
23
|
+
},
|
24
|
+
"jest": {
|
25
|
+
"transform": {
|
26
|
+
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
|
27
|
+
},
|
28
|
+
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
|
29
|
+
"testResultsProcessor": "<rootDir>/node_modules/ts-jest/coverageprocessor.js",
|
30
|
+
"moduleFileExtensions": [
|
31
|
+
"ts",
|
32
|
+
"tsx",
|
33
|
+
"js"
|
34
|
+
]
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"target": "es2017",
|
4
|
+
"module": "commonjs",
|
5
|
+
"alwaysStrict": true,
|
6
|
+
"noUnusedLocals": true,
|
7
|
+
"noUnusedParameters": true,
|
8
|
+
"noImplicitAny": true,
|
9
|
+
"strictNullChecks": true,
|
10
|
+
"preserveConstEnums": true,
|
11
|
+
"noFallthroughCasesInSwitch":true,
|
12
|
+
"noImplicitThis":true,
|
13
|
+
"noImplicitReturns":true,
|
14
|
+
"sourceMap": true,
|
15
|
+
"outDir": "./build"
|
16
|
+
},
|
17
|
+
"compileOnSave": true,
|
18
|
+
"exclude": [
|
19
|
+
"node_modules"
|
20
|
+
]
|
21
|
+
}
|