trackler 2.0.6.31 → 2.0.6.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/go/exercises/allergies/allergies_test.go +4 -1
  4. data/tracks/go/exercises/anagram/anagram_test.go +8 -0
  5. data/tracks/go/exercises/anagram/example.go +2 -0
  6. data/tracks/go/exercises/atbash-cipher/atbash_cipher_test.go +8 -0
  7. data/tracks/go/exercises/atbash-cipher/example.go +2 -0
  8. data/tracks/ocaml/tools/test-generator/Makefile +3 -3
  9. data/tracks/perl6/SETUP.md +4 -4
  10. data/tracks/perl6/exercises/allergies/allergies.t +0 -0
  11. data/tracks/perl6/exercises/atbash-cipher/cipher.t +0 -0
  12. data/tracks/perl6/exercises/grade-school/grade-school.t +0 -0
  13. data/tracks/perl6/exercises/trinary/trinary.t +0 -0
  14. data/tracks/perl6/exercises/wordy/wordy.t +0 -0
  15. data/tracks/r/config.json +15 -0
  16. data/tracks/r/exercises/hello-world/test_hello-world.R +1 -1
  17. data/tracks/r/exercises/leap/example.R +6 -0
  18. data/tracks/r/exercises/leap/leap.R +3 -0
  19. data/tracks/r/exercises/leap/test_leap.R +24 -0
  20. data/tracks/r/exercises/raindrops/example.R +28 -0
  21. data/tracks/r/exercises/raindrops/raindrops.R +3 -0
  22. data/tracks/r/exercises/raindrops/test_raindrops.R +94 -0
  23. data/tracks/r/exercises/sum-of-multiples/example.R +16 -0
  24. data/tracks/r/exercises/sum-of-multiples/sum-of-multiples.R +3 -0
  25. data/tracks/r/exercises/sum-of-multiples/test_sum-of-multiples.R +52 -0
  26. metadata +11 -8
  27. data/tracks/ocaml/tools/test-generator/interfaces/codegen.mli +0 -13
  28. data/tracks/ocaml/tools/test-generator/interfaces/controller.mli +0 -3
  29. data/tracks/ocaml/tools/test-generator/interfaces/parser.mli +0 -15
  30. data/tracks/ocaml/tools/test-generator/interfaces/special_cases.mli +0 -7
  31. data/tracks/ocaml/tools/test-generator/interfaces/template.mli +0 -11
  32. data/tracks/ocaml/tools/test-generator/interfaces/utils.mli +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce72cb821d80518789fa621475071a4dbb30197a
4
- data.tar.gz: b7b14debc8e89d780f361c1419aea892a3bca8c8
3
+ metadata.gz: 9f6e3f97fb0442bba06845f093f9ab9ea5d92a79
4
+ data.tar.gz: cbb479cfd8d79e854facf50b3e114d21e76e637f
5
5
  SHA512:
6
- metadata.gz: fe5a09839008c9ec917ea7410db0a82a41afba57c16e986e928817cec9dbff96377c07d1cc9604915519e20c689ae431c54c9b33550bbedc5efed724d738b132
7
- data.tar.gz: a5647458958f9a1540c0320b5eb0dce76e98a8010c76a73fddb6f8bc90298490c836b00bbd5f4eed81795d9084a72b1cdc650474921364023956d3202844bbc4
6
+ metadata.gz: 0f08eba9a5d7e964a238e50dc854d66444bd8f05d21e3263f4e8e272312cbb1ad46f628883621a181bdf23e4f7156bdfdb6eaf0312be81020061e927fea4d8c2
7
+ data.tar.gz: 7e7956710060f07e599ef66a935d2759340ab4a1598139b7314879db60fc6d863f9714ff36a88c3377ddc51130ba442d195b8769ffa7ac1b295b5a7d06b06786
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.6.31"
2
+ VERSION = "2.0.6.32"
3
3
  end
@@ -23,10 +23,13 @@ var allergiesTests = []struct {
23
23
  {[]string{"eggs", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats"}, 509},
24
24
  }
25
25
 
26
- func TestAllergies(t *testing.T) {
26
+ func TestTestVersion(t *testing.T) {
27
27
  if testVersion != targetTestVersion {
28
28
  t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
29
29
  }
30
+ }
31
+
32
+ func TestAllergies(t *testing.T) {
30
33
  for _, test := range allergiesTests {
31
34
  actual := Allergies(test.input)
32
35
  sort.Strings(actual)
@@ -6,6 +6,8 @@ import (
6
6
  "testing"
7
7
  )
8
8
 
9
+ const targetTestVersion = 1
10
+
9
11
  var testCases = []struct {
10
12
  subject string
11
13
  candidates []string
@@ -138,6 +140,12 @@ func equal(a []string, b []string) bool {
138
140
  return fmt.Sprintf("%v", a) == fmt.Sprintf("%v", b)
139
141
  }
140
142
 
143
+ func TestTestVersion(t *testing.T) {
144
+ if testVersion != targetTestVersion {
145
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
146
+ }
147
+ }
148
+
141
149
  func TestDetectAnagrams(t *testing.T) {
142
150
  for _, tt := range testCases {
143
151
  actual := Detect(tt.subject, tt.candidates)
@@ -5,6 +5,8 @@ import (
5
5
  "strings"
6
6
  )
7
7
 
8
+ const testVersion = 1
9
+
8
10
  func Detect(subject string, candidates []string) []string {
9
11
  subject = strings.ToLower(subject)
10
12
  var matches []string
@@ -2,6 +2,8 @@ package atbash
2
2
 
3
3
  import "testing"
4
4
 
5
+ const targetTestVersion = 1
6
+
5
7
  var tests = []struct {
6
8
  expected string
7
9
  s string
@@ -17,6 +19,12 @@ var tests = []struct {
17
19
  {"gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt", "The quick brown fox jumps over the lazy dog."},
18
20
  }
19
21
 
22
+ func TestTestVersion(t *testing.T) {
23
+ if testVersion != targetTestVersion {
24
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
25
+ }
26
+ }
27
+
20
28
  func TestAtbash(t *testing.T) {
21
29
  for _, test := range tests {
22
30
  actual := Atbash(test.s)
@@ -5,6 +5,8 @@ import (
5
5
  "strings"
6
6
  )
7
7
 
8
+ const testVersion = 1
9
+
8
10
  var alphabet = "abcdefghijklmnopqrstuvwxyz"
9
11
 
10
12
  func Atbash(s string) string {
@@ -1,13 +1,13 @@
1
1
  test: test_gen.native
2
2
  @./all_tests.native
3
3
 
4
- canonical_data_checker.native: all_tests.native src/*.ml interfaces/*.mli test/*.ml
4
+ canonical_data_checker.native: all_tests.native src/*.ml test/*.ml
5
5
  @ocamlbuild -use-ocamlfind -tag thread -tag short_paths -cflags -strict-sequence -r -pkg core -pkg yojson -pkg ppx_deriving -pkg ppx_deriving.eq -pkg ppx_deriving.show -Is src,interfaces canonical_data_checker.native
6
6
 
7
- test_gen.byte: all_tests.native src/*.ml interfaces/*.mli test/*.ml
7
+ test_gen.byte: all_tests.native src/*.ml test/*.ml
8
8
  @ocamlbuild -use-ocamlfind -tag thread -tag short_paths -cflags -strict-sequence -r -pkg core -pkg yojson -pkg ppx_deriving -pkg ppx_deriving.eq -pkg ppx_deriving.show -Is src,interfaces test_gen.byte
9
9
 
10
- test_gen.native: all_tests.native src/*.ml interfaces/*.mli test/*.ml
10
+ test_gen.native: all_tests.native src/*.ml test/*.ml
11
11
  @ocamlbuild -use-ocamlfind -tag thread -tag short_paths -cflags -strict-sequence -r -pkg core -pkg yojson -pkg ppx_deriving -pkg ppx_deriving.eq -pkg ppx_deriving.show -Is src,interfaces test_gen.native
12
12
 
13
13
  all_tests.native: src/*.ml test/*.ml
@@ -7,7 +7,7 @@ examples if you get stuck.
7
7
  ## Running the tests
8
8
 
9
9
  There is a test script included with the exercise; a file with the extension
10
- `.t`. You can run the test script for the exercise with the following commands:
11
-
12
- - `prove -ve perl6 .`
13
- - `perl6 example.t` (replacing `example.t` with the included `.t` file.)
10
+ `.t`. You can run the test script for the exercise by executing the command
11
+ `prove . --exec=perl6` in the exercise directory. You can also add the `-v` flag
12
+ e.g. `prove . --exec=perl6 -v` to display all tests, including any optional
13
+ tests marked as 'TODO'.
File without changes
File without changes
File without changes
File without changes
File without changes
data/tracks/r/config.json CHANGED
@@ -54,6 +54,21 @@
54
54
  "difficulty": 1,
55
55
  "slug": "hamming",
56
56
  "topics": []
57
+ },
58
+ {
59
+ "difficulty": 1,
60
+ "slug": "leap",
61
+ "topics": []
62
+ },
63
+ {
64
+ "difficulty": 1,
65
+ "slug": "raindrops",
66
+ "topics": []
67
+ },
68
+ {
69
+ "difficulty": 1,
70
+ "slug": "sum-of-multiples",
71
+ "topics": []
57
72
  }
58
73
  ]
59
74
  }
@@ -1,4 +1,4 @@
1
- source('./hello_world.R')
1
+ source('./hello-world.R')
2
2
  suppressPackageStartupMessages({ require(testthat) })
3
3
 
4
4
  test_that("no name", {
@@ -0,0 +1,6 @@
1
+ leap <- function(year) {
2
+ # on every year that is evenly divisible by 4
3
+ # except every year that is evenly divisible by 100
4
+ # unless the year is also evenly divisible by 400
5
+ year %% 400 == 0 || (year %% 100 != 0 & year %% 4 == 0)
6
+ }
@@ -0,0 +1,3 @@
1
+ leap <- function(year) {
2
+
3
+ }
@@ -0,0 +1,24 @@
1
+ source('./leap.R')
2
+ suppressPackageStartupMessages({ require(testthat) })
3
+
4
+ test_that("year not divisible by 4: common year", {
5
+ year <- 2015
6
+ expect_equal(leap(year), FALSE)
7
+ })
8
+
9
+ test_that("year divisible by 4, not divisible by 100: leap year", {
10
+ year <- 2016
11
+ expect_equal(leap(year), TRUE)
12
+ })
13
+
14
+ test_that("year divisible by 100, not divisible by 400: common year", {
15
+ year <- 2100
16
+ expect_equal(leap(year), FALSE)
17
+ })
18
+
19
+ test_that("year divisible by 400: leap year", {
20
+ year <- 2000
21
+ expect_equal(leap(year), TRUE)
22
+ })
23
+
24
+ print("All tests passed!")
@@ -0,0 +1,28 @@
1
+ raindrops <- function(number) {
2
+
3
+ Pling <- ''
4
+ Plang <- ''
5
+ Plong <- ''
6
+
7
+ # If the number has 3 as a factor, output 'Pling'.
8
+ if (number %% 3 == 0) {
9
+ Pling <- 'Pling'
10
+ }
11
+ # If the number has 5 as a factor, output 'Plang'.
12
+ if (number %% 5 == 0) {
13
+ Plang <- 'Plang'
14
+ }
15
+ # If the number has 7 as a factor, output 'Plong'.
16
+ if (number %% 7 == 0) {
17
+ Plong <- 'Plong'
18
+ }
19
+
20
+ PlingPlangPlong <- paste(Pling, Plang, Plong, sep = "")
21
+
22
+ # If the number does not have 3, 5, or 7 as a factor, just pass the number's digits straight through.
23
+ if (PlingPlangPlong == "") {
24
+ PlingPlangPlong = as.character(number)
25
+ }
26
+
27
+ PlingPlangPlong
28
+ }
@@ -0,0 +1,3 @@
1
+ raindrops <- function(number) {
2
+
3
+ }
@@ -0,0 +1,94 @@
1
+ source('./raindrops.R')
2
+ suppressPackageStartupMessages({ require(testthat) })
3
+
4
+ test_that("the sound for 1 is 1", {
5
+ number <- 1
6
+ expect_equal(raindrops(number), "1")
7
+ })
8
+
9
+ test_that("the sound for 3 is Pling", {
10
+ number <- 3
11
+ expect_equal(raindrops(number), "Pling")
12
+ })
13
+
14
+ test_that("the sound for 5 is Plang", {
15
+ number <- 5
16
+ expect_equal(raindrops(number), "Plang")
17
+ })
18
+
19
+ test_that("the sound for 7 is Plong", {
20
+ number <- 7
21
+ expect_equal(raindrops(number), "Plong")
22
+ })
23
+
24
+ test_that("the sound for 6 is Pling as it has a factor 3", {
25
+ number <- 6
26
+ expect_equal(raindrops(number), "Pling")
27
+ })
28
+
29
+ test_that("2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base", {
30
+ number <- 8
31
+ expect_equal(raindrops(number), "8")
32
+ })
33
+
34
+ test_that("the sound for 9 is Pling as it has a factor 3", {
35
+ number <- 9
36
+ expect_equal(raindrops(number), "Pling")
37
+ })
38
+
39
+ test_that("the sound for 10 is Plang as it has a factor 5", {
40
+ number <- 10
41
+ expect_equal(raindrops(number), "Plang")
42
+ })
43
+
44
+ test_that("the sound for 14 is Plong as it has a factor of 7", {
45
+ number <- 14
46
+ expect_equal(raindrops(number), "Plong")
47
+ })
48
+
49
+ test_that("the sound for 15 is PlingPlang as it has factors 3 and 5", {
50
+ number <- 15
51
+ expect_equal(raindrops(number), "PlingPlang")
52
+ })
53
+
54
+ test_that("the sound for 21 is PlingPlong as it has factors 3 and 7", {
55
+ number <- 21
56
+ expect_equal(raindrops(number), "PlingPlong")
57
+ })
58
+
59
+ test_that("the sound for 25 is Plang as it has a factor 5", {
60
+ number <- 25
61
+ expect_equal(raindrops(number), "Plang")
62
+ })
63
+
64
+ test_that("the sound for 27 is Pling as it has a factor 3", {
65
+ number <- 27
66
+ expect_equal(raindrops(number), "Pling")
67
+ })
68
+
69
+ test_that("the sound for 35 is PlangPlong as it has factors 5 and 7", {
70
+ number <- 35
71
+ expect_equal(raindrops(number), "PlangPlong")
72
+ })
73
+
74
+ test_that("the sound for 49 is Plong as it has a factor 7", {
75
+ number <- 49
76
+ expect_equal(raindrops(number), "Plong")
77
+ })
78
+
79
+ test_that("the sound for 52 is 52", {
80
+ number <- 52
81
+ expect_equal(raindrops(number), "52")
82
+ })
83
+
84
+ test_that("the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7", {
85
+ number <- 105
86
+ expect_equal(raindrops(number), "PlingPlangPlong")
87
+ })
88
+
89
+ test_that("the sound for 3125 is Plang as it has a factor 5", {
90
+ number <- 3125
91
+ expect_equal(raindrops(number), "Plang")
92
+ })
93
+
94
+ print("All tests passed!")
@@ -0,0 +1,16 @@
1
+ sum_of_multiples <- function(factors, limit) {
2
+
3
+ get_mults <- function(factor) {
4
+
5
+ max_mult <- ceiling(limit / factor) - 1
6
+ if (max_mult > 0) {
7
+ new_multiples <- factor * 1:max_mult
8
+ }
9
+
10
+ }
11
+
12
+ multiples <- unique(unlist(lapply(factors, FUN = get_mults)))
13
+
14
+ return(sum(as.numeric(multiples)))
15
+
16
+ }
@@ -0,0 +1,3 @@
1
+ sum_of_multiples <- function(factors, limit) {
2
+
3
+ }
@@ -0,0 +1,52 @@
1
+ source('./sum_of_multiples.R')
2
+ suppressPackageStartupMessages({ require(testthat) })
3
+
4
+ test_that("Case 1", {
5
+ expect_equal(sum_of_multiples(c(3,5), 1), 0)
6
+ })
7
+
8
+ test_that("Case 2", {
9
+ expect_equal(sum_of_multiples(c(3,5), 4), 3)
10
+ })
11
+
12
+ test_that("Case 3", {
13
+ expect_equal(sum_of_multiples(c(3,5), 10), 23)
14
+ })
15
+
16
+ test_that("Case 4", {
17
+ expect_equal(sum_of_multiples(c(3,5), 100), 2318)
18
+ })
19
+
20
+ test_that("Case 5", {
21
+ expect_equal(sum_of_multiples(c(3,5), 1000), 233168)
22
+ })
23
+
24
+ test_that("Case 6", {
25
+ expect_equal(sum_of_multiples(c(7,13,17), 20), 51)
26
+ })
27
+
28
+ test_that("Case 7", {
29
+ expect_equal(sum_of_multiples(c(4,6), 15), 30)
30
+ })
31
+
32
+ test_that("Case 8", {
33
+ expect_equal(sum_of_multiples(c(5,6,8), 150), 4419)
34
+ })
35
+
36
+ test_that("Case 9", {
37
+ expect_equal(sum_of_multiples(c(5,25), 51), 275)
38
+ })
39
+
40
+ test_that("Case 10", {
41
+ expect_equal(sum_of_multiples(c(43,47), 10000), 2203160)
42
+ })
43
+
44
+ test_that("Case 11", {
45
+ expect_equal(sum_of_multiples(c(1), 100), 4950)
46
+ })
47
+
48
+ test_that("Case 12", {
49
+ expect_equal(sum_of_multiples(c(), 10000), 0)
50
+ })
51
+
52
+ print("All tests passed!")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6.31
4
+ version: 2.0.6.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-04 00:00:00.000000000 Z
11
+ date: 2017-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -5412,12 +5412,6 @@ files:
5412
5412
  - tracks/ocaml/tools/test-generator/Makefile
5413
5413
  - tracks/ocaml/tools/test-generator/README.md
5414
5414
  - tracks/ocaml/tools/test-generator/_tags
5415
- - tracks/ocaml/tools/test-generator/interfaces/codegen.mli
5416
- - tracks/ocaml/tools/test-generator/interfaces/controller.mli
5417
- - tracks/ocaml/tools/test-generator/interfaces/parser.mli
5418
- - tracks/ocaml/tools/test-generator/interfaces/special_cases.mli
5419
- - tracks/ocaml/tools/test-generator/interfaces/template.mli
5420
- - tracks/ocaml/tools/test-generator/interfaces/utils.mli
5421
5415
  - tracks/ocaml/tools/test-generator/src/canonical_data_checker.ml
5422
5416
  - tracks/ocaml/tools/test-generator/src/codegen.ml
5423
5417
  - tracks/ocaml/tools/test-generator/src/controller.ml
@@ -6164,12 +6158,21 @@ files:
6164
6158
  - tracks/r/exercises/hello-world/example.R
6165
6159
  - tracks/r/exercises/hello-world/hello-world.R
6166
6160
  - tracks/r/exercises/hello-world/test_hello-world.R
6161
+ - tracks/r/exercises/leap/example.R
6162
+ - tracks/r/exercises/leap/leap.R
6163
+ - tracks/r/exercises/leap/test_leap.R
6167
6164
  - tracks/r/exercises/luhn/example.R
6168
6165
  - tracks/r/exercises/luhn/luhn.R
6169
6166
  - tracks/r/exercises/luhn/test_luhn.R
6167
+ - tracks/r/exercises/raindrops/example.R
6168
+ - tracks/r/exercises/raindrops/raindrops.R
6169
+ - tracks/r/exercises/raindrops/test_raindrops.R
6170
6170
  - tracks/r/exercises/space-age/example.R
6171
6171
  - tracks/r/exercises/space-age/space-age.R
6172
6172
  - tracks/r/exercises/space-age/test_space-age.R
6173
+ - tracks/r/exercises/sum-of-multiples/example.R
6174
+ - tracks/r/exercises/sum-of-multiples/sum-of-multiples.R
6175
+ - tracks/r/exercises/sum-of-multiples/test_sum-of-multiples.R
6173
6176
  - tracks/r/exercises/word-count/example.R
6174
6177
  - tracks/r/exercises/word-count/test_word-count.R
6175
6178
  - tracks/r/exercises/word-count/word-count.R
@@ -1,13 +0,0 @@
1
- open Core.Std
2
-
3
- open Model
4
-
5
- type edit_expected_function = value: parameter -> string
6
-
7
- type edit_parameters_function = (string * string) list -> (string * string) list
8
-
9
- type subst = Subst of string
10
-
11
- val subst_to_string : subst -> string
12
-
13
- val fill_in_template : edit_expected_function -> edit_parameters_function -> string -> case list -> (subst list, string) Result.t
@@ -1,3 +0,0 @@
1
- open Core.Std
2
-
3
- val run : templates_folder: string -> canonical_data_folder: string -> output_folder: string -> unit
@@ -1,15 +0,0 @@
1
- open Core.Std
2
- open Model
3
-
4
- type error = TopLevelMustHaveKeyCalledCases | ExpectingListOfCases |
5
- ExpectingMapForCase | BadDescription | BadExpected
6
-
7
- type test = {name: string; cases: case list} [@@deriving eq, show]
8
-
9
- type tests =
10
- | Single of case list
11
- | Suite of test list [@@deriving eq, show]
12
-
13
- val parse_json_text : string -> (tests, error) Result.t
14
-
15
- val show_error : error -> string
@@ -1,7 +0,0 @@
1
- open Core.Std
2
-
3
- open Model
4
-
5
- val edit_expected : stringify:(parameter -> string) -> slug:string -> key:string -> value:parameter -> string
6
-
7
- val edit_parameters : slug: string -> (string * string) list -> (string * string) list
@@ -1,11 +0,0 @@
1
- open Core.Std
2
-
3
- open Codegen
4
-
5
- type t = {start: int; finish: int; file_text: string; template: string}
6
-
7
- val fill : int -> int -> template: string -> subst list -> string
8
-
9
- val find_template : template_text: string -> (int * int * string) option
10
-
11
- val show : t -> string
@@ -1,22 +0,0 @@
1
- open Core.Std
2
- open Yojson.Safe
3
-
4
- val map2 : ('a -> 'b -> 'c) -> ('a, 'e) Result.t -> ('b, 'e) Result.t -> ('c, 'e) Result.t
5
-
6
- val sequence : (('a, 'e) Result.t) list -> (('a list), 'e) Result.t
7
-
8
- val to_list_option : json -> json list option
9
-
10
- val to_list_note : 'e -> json -> ((json list, 'e) Result.t)
11
-
12
- val to_assoc_note : 'e -> json -> ((json list, 'e) Result.t)
13
-
14
- val to_string_note : 'e -> json -> ((string, 'e) Result.t)
15
-
16
- val member_note : 'e -> string -> json -> ((json, 'e) Result.t)
17
-
18
- val safe_to_int_option : json -> int option
19
-
20
- val find_arrayi : ?start:int -> 'a array -> f:('a -> bool) -> (int * 'a) option
21
-
22
- val (>>) : ('a -> 'b) -> ('c -> 'a) -> 'c -> 'b