trackler 2.1.0.38 → 2.1.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/clojure/config.json +0 -7
  4. data/tracks/{coldfusion/SETUP.md → clojure/docs/EXERCISE_README_INSERT.md} +0 -0
  5. data/tracks/coldfusion/config.json +3 -5
  6. data/tracks/{fortran/exercises/TRACK_HINTS.md → coldfusion/docs/EXERCISE_README_INSERT.md} +0 -0
  7. data/tracks/coq/{exercises/TRACK_HINTS.md → docs/EXERCISE_README_INSERT.md} +0 -0
  8. data/tracks/dlang/config.json +0 -3
  9. data/tracks/{prolog/SETUP.md → elisp/docs/EXERCISE_README_INSERT.md} +0 -0
  10. data/tracks/elm/config.json +229 -172
  11. data/tracks/fortran/config.json +21 -19
  12. data/tracks/{purescript/SETUP.md → fortran/docs/EXERCISE_README_INSERT.md} +0 -0
  13. data/tracks/groovy/config.json +39 -16
  14. data/tracks/haxe/config.json +0 -5
  15. data/tracks/java/POLICIES.md +4 -0
  16. data/tracks/lfe/config.json +0 -7
  17. data/tracks/mips/config.json +0 -4
  18. data/tracks/nasm/config.json +0 -5
  19. data/tracks/nim/config.json +42 -18
  20. data/tracks/php/config.json +0 -4
  21. data/tracks/plsql/config.json +0 -4
  22. data/tracks/powershell/config.json +0 -5
  23. data/tracks/prolog/config.json +35 -18
  24. data/tracks/prolog/docs/EXERCISE_README_INSERT.md +0 -0
  25. data/tracks/purescript/docs/EXERCISE_README_INSERT.md +0 -0
  26. data/tracks/python/config.json +0 -5
  27. data/tracks/python/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
  28. data/tracks/r/.gitignore +3 -0
  29. data/tracks/r/exercises/luhn/test_luhn.R +10 -5
  30. data/tracks/r/exercises/phone-number/example.R +6 -1
  31. data/tracks/r/exercises/phone-number/test_phone-number.R +13 -9
  32. data/tracks/racket/config.json +0 -6
  33. data/tracks/scheme/config.json +0 -4
  34. data/tracks/sml/config.json +24 -13
  35. data/tracks/sml/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
  36. data/tracks/tcl/config.json +0 -5
  37. data/tracks/vbnet/config.json +0 -4
  38. metadata +10 -8
File without changes
File without changes
@@ -580,11 +580,6 @@
580
580
  "binary",
581
581
  "hexadecimal"
582
582
  ],
583
- "ignored": [
584
- "docs",
585
- "test",
586
- "img"
587
- ],
588
583
  "foregone": [
589
584
 
590
585
  ]
data/tracks/r/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
1
  bin/configlet
2
2
  bin/configlet.exe
3
3
  .Rproj.user
4
+ .RData
5
+ .Rhistory
6
+ *.Rproj
@@ -11,8 +11,13 @@ test_that("A single zero is invalid", {
11
11
  expect_equal(is_valid(input), FALSE)
12
12
  })
13
13
 
14
- test_that("simple valid sin", {
15
- input <- " 5 9 "
14
+ test_that("a simple valid SIN that remains valid if reversed", {
15
+ input <- "059"
16
+ expect_equal(is_valid(input), TRUE)
17
+ })
18
+
19
+ test_that("a simple valid SIN that becomes invalid if reversed", {
20
+ input <- "59"
16
21
  expect_equal(is_valid(input), TRUE)
17
22
  })
18
23
 
@@ -32,7 +37,7 @@ test_that("invalid credit card", {
32
37
  })
33
38
 
34
39
  test_that("valid strings with a non-digit added become invalid", {
35
- input <- "046a 454 286"
40
+ input <- "055a 444 285"
36
41
  expect_equal(is_valid(input), FALSE)
37
42
  })
38
43
 
@@ -51,8 +56,8 @@ test_that("single zero with space is invalid", {
51
56
  expect_equal(is_valid(input), FALSE)
52
57
  })
53
58
 
54
- test_that("lots of zeros are valid", {
55
- input <- " 00000"
59
+ test_that("more than a single zero is valid", {
60
+ input <- "0000 0"
56
61
  expect_equal(is_valid(input), TRUE)
57
62
  })
58
63
 
@@ -1,7 +1,8 @@
1
1
  parse_phone_number <- function(number_string) {
2
2
 
3
3
  # If the number is less than 10 digits assume that it is bad number
4
- # If the number is 10 digits assume that it is good
4
+ # If the number is 10 digits assume that it is good, unless area or exchange
5
+ # code are not between 2 to 9
5
6
  # If the number is 11 digits and the first number is 1, use the last 10 digits
6
7
  # If the number is 11 digits and the first number is not 1, it is a bad number
7
8
  # If the number is more than 11 digits assume that it is a bad number
@@ -16,6 +17,10 @@ parse_phone_number <- function(number_string) {
16
17
 
17
18
  if (nchar(cleaned) < 10) {
18
19
  NULL
20
+ }
21
+ else if (nchar(cleaned) == 10 & (substr(cleaned, 1, 1) %in% c("0", "1") |
22
+ substr(cleaned, 4, 4) %in% c("0", "1"))) {
23
+ NULL
19
24
  }
20
25
  else if (nchar(cleaned) == 10) {
21
26
  cleaned
@@ -2,30 +2,30 @@ source("./phone-number.R")
2
2
  library(testthat)
3
3
 
4
4
  test_that("cleans the number", {
5
- expect_equal(parse_phone_number("(123) 456-7890"), "1234567890")
5
+ expect_equal(parse_phone_number("(223) 456-7890"), "2234567890")
6
6
  })
7
7
 
8
8
  test_that("cleans numbers with dots", {
9
- expect_equal(parse_phone_number("123.456.7890"), "1234567890")
9
+ expect_equal(parse_phone_number("223.456.7890"), "2234567890")
10
10
  })
11
11
 
12
12
  test_that("cleans numbers with multiple spaces", {
13
- expect_equal(parse_phone_number("123 456 7890 "), "1234567890")
13
+ expect_equal(parse_phone_number("223 456 7890 "), "2234567890")
14
14
  })
15
15
 
16
16
  test_that("invalid when 9 digits", {
17
17
  expect_equal(parse_phone_number("123456789"), NULL)
18
18
  })
19
19
 
20
- test_that("invalid when 11 digits", {
21
- expect_equal(parse_phone_number("21234567890"), NULL)
20
+ test_that("invalid when 11 digits and not starting with a 1", {
21
+ expect_equal(parse_phone_number("22234567890"), NULL)
22
22
  })
23
23
 
24
24
  test_that("valid when 11 digits and starting with 1", {
25
- expect_equal(parse_phone_number("11234567890"), "1234567890")
25
+ expect_equal(parse_phone_number("12234567890"), "2234567890")
26
26
  })
27
27
 
28
- test_that("invalid when 12 digits", {
28
+ test_that("invalid when more than 11 digits", {
29
29
  expect_equal(parse_phone_number("321234567890"), NULL)
30
30
  })
31
31
 
@@ -37,8 +37,12 @@ test_that("invalid with punctuations", {
37
37
  expect_equal(parse_phone_number("123-@:!-7890"), NULL)
38
38
  })
39
39
 
40
- test_that("invalid with right number of digits but letters mixed in", {
41
- expect_equal(parse_phone_number("1a2b3c4d5e6f7g8h9i0j"), NULL)
40
+ test_that("invalid if area code does not start with 2-9", {
41
+ expect_equal(parse_phone_number("(123) 456-7890"), NULL)
42
+ })
43
+
44
+ test_that("invalid if exchange code does not start with 2-9", {
45
+ expect_equal(parse_phone_number("(223) 056-7890"), NULL)
42
46
  })
43
47
 
44
48
  print("All tests passed for exercise: phone-number")
@@ -163,12 +163,6 @@
163
163
  "deprecated": [
164
164
  "accumulate"
165
165
  ],
166
- "ignored": [
167
- "travis-racket",
168
- "bin",
169
- "docs",
170
- "img"
171
- ],
172
166
  "foregone": [
173
167
 
174
168
  ]
@@ -105,10 +105,6 @@
105
105
  ],
106
106
  "deprecated": [
107
107
 
108
- ],
109
- "ignored": [
110
- "docs",
111
- "img"
112
108
  ],
113
109
  "foregone": [
114
110
 
@@ -9,51 +9,62 @@
9
9
  {
10
10
  "slug": "accumulate",
11
11
  "difficulty": 1,
12
- "topics": []
12
+ "topics": [
13
+
14
+ ]
13
15
  },
14
16
  {
15
17
  "slug": "allergies",
16
18
  "difficulty": 1,
17
- "topics": []
19
+ "topics": [
20
+
21
+ ]
18
22
  },
19
23
  {
20
24
  "slug": "anagram",
21
25
  "difficulty": 1,
22
- "topics": []
26
+ "topics": [
27
+
28
+ ]
23
29
  },
24
30
  {
25
31
  "slug": "binary",
26
32
  "difficulty": 1,
27
- "topics": []
33
+ "topics": [
34
+
35
+ ]
28
36
  },
29
37
  {
30
38
  "slug": "flatten-array",
31
39
  "difficulty": 1,
32
- "topics": []
40
+ "topics": [
41
+
42
+ ]
33
43
  },
34
44
  {
35
45
  "slug": "hamming",
36
46
  "difficulty": 1,
37
- "topics": []
47
+ "topics": [
48
+
49
+ ]
38
50
  },
39
51
  {
40
52
  "slug": "raindrops",
41
53
  "difficulty": 1,
42
- "topics": []
54
+ "topics": [
55
+
56
+ ]
43
57
  },
44
58
  {
45
59
  "slug": "nth-prime",
46
60
  "difficulty": 1,
47
- "topics": []
61
+ "topics": [
62
+
63
+ ]
48
64
  }
49
65
  ],
50
66
  "deprecated": [
51
67
 
52
- ],
53
- "ignored": [
54
- "bin",
55
- "docs",
56
- "img"
57
68
  ],
58
69
  "foregone": [
59
70
 
@@ -6,11 +6,6 @@
6
6
  "test_pattern": "TODO",
7
7
  "deprecated": [
8
8
 
9
- ],
10
- "ignored": [
11
- "bin",
12
- "docs",
13
- "img"
14
9
  ],
15
10
  "foregone": [
16
11
 
@@ -6,10 +6,6 @@
6
6
  "active": false,
7
7
  "deprecated": [
8
8
 
9
- ],
10
- "ignored": [
11
- "docs",
12
- "img"
13
9
  ],
14
10
  "foregone": [
15
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.38
4
+ version: 2.1.0.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
@@ -904,6 +904,7 @@ files:
904
904
  - tracks/clojure/bin/restructure.clj
905
905
  - tracks/clojure/config.json
906
906
  - tracks/clojure/docs/ABOUT.org
907
+ - tracks/clojure/docs/EXERCISE_README_INSERT.md
907
908
  - tracks/clojure/docs/INSTALLATION.org
908
909
  - tracks/clojure/docs/LEARNING.org
909
910
  - tracks/clojure/docs/RESOURCES.org
@@ -1175,9 +1176,9 @@ files:
1175
1176
  - tracks/coldfusion/.travis.yml
1176
1177
  - tracks/coldfusion/LICENSE
1177
1178
  - tracks/coldfusion/README.md
1178
- - tracks/coldfusion/SETUP.md
1179
1179
  - tracks/coldfusion/bin/fetch-configlet
1180
1180
  - tracks/coldfusion/config.json
1181
+ - tracks/coldfusion/docs/EXERCISE_README_INSERT.md
1181
1182
  - tracks/coldfusion/exercises/leap/example.cfc
1182
1183
  - tracks/coldfusion/exercises/leap/leap.cfc
1183
1184
  - tracks/coldfusion/exercises/leap/leap_tests.cfc
@@ -1191,11 +1192,11 @@ files:
1191
1192
  - tracks/coq/bin/fetch-configlet
1192
1193
  - tracks/coq/config.json
1193
1194
  - tracks/coq/docs/ABOUT.md
1195
+ - tracks/coq/docs/EXERCISE_README_INSERT.md
1194
1196
  - tracks/coq/docs/INSTALLATION.md
1195
1197
  - tracks/coq/docs/LEARNING.md
1196
1198
  - tracks/coq/docs/RESOURCES.md
1197
1199
  - tracks/coq/docs/TESTS.md
1198
- - tracks/coq/exercises/TRACK_HINTS.md
1199
1200
  - tracks/coq/exercises/hello-world/example.v
1200
1201
  - tracks/coq/exercises/hello-world/helloworld.v
1201
1202
  - tracks/coq/exercises/hello-world/test.v
@@ -2396,6 +2397,7 @@ files:
2396
2397
  - tracks/elisp/bin/test-examples
2397
2398
  - tracks/elisp/config.json
2398
2399
  - tracks/elisp/docs/ABOUT.org
2400
+ - tracks/elisp/docs/EXERCISE_README_INSERT.md
2399
2401
  - tracks/elisp/docs/INSTALLATION.org
2400
2402
  - tracks/elisp/docs/LEARNING.org
2401
2403
  - tracks/elisp/docs/RESOURCES.org
@@ -3184,11 +3186,11 @@ files:
3184
3186
  - tracks/fortran/bin/fetch-configlet
3185
3187
  - tracks/fortran/config.json
3186
3188
  - tracks/fortran/docs/ABOUT.md
3189
+ - tracks/fortran/docs/EXERCISE_README_INSERT.md
3187
3190
  - tracks/fortran/docs/INSTALLATION.md
3188
3191
  - tracks/fortran/docs/LEARNING.md
3189
3192
  - tracks/fortran/docs/RESOURCES.md
3190
3193
  - tracks/fortran/docs/TESTS.md
3191
- - tracks/fortran/exercises/TRACK_HINTS.md
3192
3194
  - tracks/fortran/exercises/bob/bob.fun
3193
3195
  - tracks/fortran/exercises/bob/example.f90
3194
3196
  - tracks/fortran/exercises/difference-of-squares/difference_of_squares.fun
@@ -6823,11 +6825,11 @@ files:
6823
6825
  - tracks/prolog/.travis.yml
6824
6826
  - tracks/prolog/LICENSE
6825
6827
  - tracks/prolog/README.md
6826
- - tracks/prolog/SETUP.md
6827
6828
  - tracks/prolog/bin/build.sh
6828
6829
  - tracks/prolog/bin/fetch-configlet
6829
6830
  - tracks/prolog/config.json
6830
6831
  - tracks/prolog/docs/ABOUT.md
6832
+ - tracks/prolog/docs/EXERCISE_README_INSERT.md
6831
6833
  - tracks/prolog/docs/INSTALLATION.md
6832
6834
  - tracks/prolog/docs/LEARNING.md
6833
6835
  - tracks/prolog/docs/RESOURCES.md
@@ -6873,12 +6875,12 @@ files:
6873
6875
  - tracks/purescript/.travis.yml
6874
6876
  - tracks/purescript/LICENSE
6875
6877
  - tracks/purescript/README.md
6876
- - tracks/purescript/SETUP.md
6877
6878
  - tracks/purescript/bin/fetch-configlet
6878
6879
  - tracks/purescript/bin/test-one.sh
6879
6880
  - tracks/purescript/bin/test.sh
6880
6881
  - tracks/purescript/config.json
6881
6882
  - tracks/purescript/docs/ABOUT.md
6883
+ - tracks/purescript/docs/EXERCISE_README_INSERT.md
6882
6884
  - tracks/purescript/docs/INSTALLATION.md
6883
6885
  - tracks/purescript/docs/LEARNING.md
6884
6886
  - tracks/purescript/docs/RESOURCES.md
@@ -6985,10 +6987,10 @@ files:
6985
6987
  - tracks/python/.travis.yml
6986
6988
  - tracks/python/LICENSE
6987
6989
  - tracks/python/README.md
6988
- - tracks/python/SETUP.md
6989
6990
  - tracks/python/bin/fetch-configlet
6990
6991
  - tracks/python/config.json
6991
6992
  - tracks/python/docs/ABOUT.md
6993
+ - tracks/python/docs/EXERCISE_README_INSERT.md
6992
6994
  - tracks/python/docs/HELLO.md
6993
6995
  - tracks/python/docs/INSTALLATION.md
6994
6996
  - tracks/python/docs/LEARNING.md
@@ -8608,9 +8610,9 @@ files:
8608
8610
  - tracks/sml/.travis.yml
8609
8611
  - tracks/sml/LICENSE
8610
8612
  - tracks/sml/README.md
8611
- - tracks/sml/SETUP.md
8612
8613
  - tracks/sml/bin/fetch-configlet
8613
8614
  - tracks/sml/config.json
8615
+ - tracks/sml/docs/EXERCISE_README_INSERT.md
8614
8616
  - tracks/sml/exercises/accumulate/example.sml
8615
8617
  - tracks/sml/exercises/accumulate/test_accumulate.sml
8616
8618
  - tracks/sml/exercises/allergies/example.sml