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.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/clojure/config.json +0 -7
- data/tracks/{coldfusion/SETUP.md → clojure/docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/coldfusion/config.json +3 -5
- data/tracks/{fortran/exercises/TRACK_HINTS.md → coldfusion/docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/coq/{exercises/TRACK_HINTS.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/dlang/config.json +0 -3
- data/tracks/{prolog/SETUP.md → elisp/docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/elm/config.json +229 -172
- data/tracks/fortran/config.json +21 -19
- data/tracks/{purescript/SETUP.md → fortran/docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/groovy/config.json +39 -16
- data/tracks/haxe/config.json +0 -5
- data/tracks/java/POLICIES.md +4 -0
- data/tracks/lfe/config.json +0 -7
- data/tracks/mips/config.json +0 -4
- data/tracks/nasm/config.json +0 -5
- data/tracks/nim/config.json +42 -18
- data/tracks/php/config.json +0 -4
- data/tracks/plsql/config.json +0 -4
- data/tracks/powershell/config.json +0 -5
- data/tracks/prolog/config.json +35 -18
- data/tracks/prolog/docs/EXERCISE_README_INSERT.md +0 -0
- data/tracks/purescript/docs/EXERCISE_README_INSERT.md +0 -0
- data/tracks/python/config.json +0 -5
- data/tracks/python/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/r/.gitignore +3 -0
- data/tracks/r/exercises/luhn/test_luhn.R +10 -5
- data/tracks/r/exercises/phone-number/example.R +6 -1
- data/tracks/r/exercises/phone-number/test_phone-number.R +13 -9
- data/tracks/racket/config.json +0 -6
- data/tracks/scheme/config.json +0 -4
- data/tracks/sml/config.json +24 -13
- data/tracks/sml/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/tcl/config.json +0 -5
- data/tracks/vbnet/config.json +0 -4
- metadata +10 -8
|
File without changes
|
|
File without changes
|
data/tracks/python/config.json
CHANGED
|
File without changes
|
data/tracks/r/.gitignore
CHANGED
|
@@ -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
|
|
15
|
-
input <- "
|
|
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 <- "
|
|
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("
|
|
55
|
-
input <- "
|
|
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("(
|
|
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("
|
|
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("
|
|
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("
|
|
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("
|
|
25
|
+
expect_equal(parse_phone_number("12234567890"), "2234567890")
|
|
26
26
|
})
|
|
27
27
|
|
|
28
|
-
test_that("invalid when
|
|
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
|
|
41
|
-
expect_equal(parse_phone_number("
|
|
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")
|
data/tracks/racket/config.json
CHANGED
data/tracks/scheme/config.json
CHANGED
data/tracks/sml/config.json
CHANGED
|
@@ -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
|
|
|
File without changes
|
data/tracks/tcl/config.json
CHANGED
data/tracks/vbnet/config.json
CHANGED
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.
|
|
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
|