trackler 2.2.1.142 → 2.2.1.143
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/dart/config.json +13 -0
- data/tracks/dart/exercises/armstrong-numbers/lib/example.dart +0 -1
- data/tracks/dart/exercises/gigasecond/lib/example.dart +2 -6
- data/tracks/dart/exercises/gigasecond/test/gigasecond_test.dart +35 -49
- data/tracks/dart/exercises/hello-world/test/hello_world_test.dart +3 -3
- data/tracks/dart/exercises/phone-number/lib/example.dart +2 -2
- data/tracks/dart/exercises/phone-number/lib/phone_number.dart +1 -1
- data/tracks/dart/exercises/phone-number/pubspec.yaml +1 -1
- data/tracks/dart/exercises/phone-number/test/phone_number_test.dart +47 -21
- data/tracks/dart/exercises/scrabble-score/README.md +55 -0
- data/tracks/dart/exercises/scrabble-score/lib/example.dart +39 -0
- data/tracks/dart/exercises/scrabble-score/lib/scrabble_score.dart +1 -0
- data/tracks/dart/exercises/scrabble-score/pubspec.yaml +3 -0
- data/tracks/dart/exercises/scrabble-score/test/scrabble_score_test.dart +58 -0
- data/tracks/dart/pubspec.lock +1 -1
- data/tracks/dart/test/exercises_test.dart +1 -1
- data/tracks/erlang/exercises/raindrops/test/raindrops_tests.erl +32 -21
- data/tracks/nim/config.json +10 -0
- data/tracks/nim/exercises/acronym/README.md +14 -0
- data/tracks/nim/exercises/acronym/acronym_test.nim +20 -0
- data/tracks/nim/exercises/acronym/example.nim +6 -0
- data/tracks/powershell/config.json +12 -0
- data/tracks/powershell/exercises/leap/.gitignore +1 -0
- data/tracks/powershell/exercises/leap/.version +1 -0
- data/tracks/powershell/exercises/leap/README.md +25 -0
- data/tracks/powershell/exercises/leap/leap-example.ps1 +14 -0
- data/tracks/powershell/exercises/leap/leap.tests.ps1 +33 -0
- metadata +15 -6
- data/tracks/coq/.github/PULL_REQUEST_TEMPLATE.md +0 -23
- data/tracks/dart/exercises/gigasecond/pubspec.lock +0 -293
- data/tracks/dart/exercises/hello-world/pubspec.lock +0 -293
- data/tracks/dart/exercises/phone-number/pubspec.lock +0 -293
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b65c8a425dbf105a088d9dbaf07e19f8f0391b4d
|
|
4
|
+
data.tar.gz: a91c0542e0d47d449d0844166d924688af580f06
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82bf770e80b49014a2835430b8533263e55d288afca5174018889303989666d2d8f9f06d1a7cea641d4707cb5010652beaf8c9367734af4956c72197b4f80c4c
|
|
7
|
+
data.tar.gz: 1393c650ebdc992c6e15029799280df1fbcfb5aa9a02c5fc6957423863189ef58059f9ea1edd46696d5e40319c4b3153df34dfbe4081e51498208eb02dc418a3
|
data/lib/trackler/version.rb
CHANGED
data/tracks/dart/config.json
CHANGED
|
@@ -26,6 +26,19 @@
|
|
|
26
26
|
"unlocked_by": null,
|
|
27
27
|
"uuid": "4bcfd789-dee6-4dd9-8524-076508504eda"
|
|
28
28
|
},
|
|
29
|
+
{
|
|
30
|
+
"core": true,
|
|
31
|
+
"difficulty": 1,
|
|
32
|
+
"slug": "scrabble-score",
|
|
33
|
+
"topics": [
|
|
34
|
+
"control_flow_conditionals",
|
|
35
|
+
"control_flow_loops",
|
|
36
|
+
"equality",
|
|
37
|
+
"strings"
|
|
38
|
+
],
|
|
39
|
+
"unlocked_by": null,
|
|
40
|
+
"uuid": "d74be875-bc1c-47a5-bf80-0c4c57ed200e"
|
|
41
|
+
},
|
|
29
42
|
{
|
|
30
43
|
"core": true,
|
|
31
44
|
"difficulty": 1,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import 'dart:math' show pow;
|
|
2
2
|
|
|
3
3
|
class ArmstrongNumbers {
|
|
4
|
-
|
|
5
4
|
/// The parameters and variables within the method that are set to final in order to prevent the accidentally modification of the value.
|
|
6
5
|
/// As those variables are not needed to be changed.
|
|
7
6
|
bool isArmstrongNumber(final int number) {
|
|
@@ -1,62 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
DateTime birthDate;
|
|
5
|
-
DateTime expectedDate;
|
|
6
|
-
Gigasecond gigasecond;
|
|
1
|
+
import 'package:test/test.dart';
|
|
2
|
+
import 'package:gigasecond/gigasecond.dart';
|
|
7
3
|
|
|
8
4
|
void main() {
|
|
9
|
-
group(
|
|
5
|
+
group('Add one gigasecond to the input.', gigasecondTests);
|
|
10
6
|
}
|
|
11
7
|
|
|
12
8
|
void gigasecondTests() {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
group("since midnight tests", sinceMidnightTests);
|
|
20
|
-
group("at night tests", atNightTests);
|
|
21
|
-
group("unixEpoch tests", unixEpochTests);
|
|
22
|
-
}
|
|
9
|
+
test("date only specification of time", () {
|
|
10
|
+
final DateTime birthDate = new DateTime.utc(2011, DateTime.APRIL, 25);
|
|
11
|
+
final DateTime result = add(birthDate);
|
|
12
|
+
DateTime expectedDate = new DateTime.utc(2043, DateTime.JANUARY, 1, 1, 46, 40);
|
|
23
13
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
gigasecond = new Gigasecond(birthDate);
|
|
27
|
-
expectedDate = new DateTime.utc(2047, DateTime.MAY, 23, 1, 46, 40);
|
|
28
|
-
});
|
|
14
|
+
expect(result, equals(expectedDate));
|
|
15
|
+
}, skip: false);
|
|
29
16
|
|
|
30
|
-
test("
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
test("second test for date only specification of time", () {
|
|
18
|
+
final DateTime birthDate = new DateTime.utc(1977, DateTime.JUNE, 13);
|
|
19
|
+
final DateTime result = add(birthDate);
|
|
20
|
+
DateTime expectedDate = new DateTime.utc(2009, DateTime.FEBRUARY, 19, 1, 46, 40);
|
|
33
21
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
expect(gigasecond.date(), equals(expectedDate));
|
|
37
|
-
});
|
|
38
|
-
}
|
|
22
|
+
expect(result, equals(expectedDate));
|
|
23
|
+
}, skip: true);
|
|
39
24
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
expectedDate = new DateTime.utc(2047, DateTime.MAY, 24, 1, 46, 39);
|
|
45
|
-
});
|
|
25
|
+
test("third test for date only specification of time", () {
|
|
26
|
+
final DateTime birthDate = new DateTime.utc(1959, DateTime.JULY, 19);
|
|
27
|
+
final DateTime result = add(birthDate);
|
|
28
|
+
DateTime expectedDate = new DateTime.utc(1991, DateTime.MARCH, 27, 1, 46, 40);
|
|
46
29
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
30
|
+
expect(result, equals(expectedDate));
|
|
31
|
+
}, skip: true);
|
|
32
|
+
|
|
33
|
+
test("full time specified", () {
|
|
34
|
+
final DateTime birthDate = new DateTime.utc(2015, DateTime.JANUARY, 24, 22, 00, 00);
|
|
35
|
+
final DateTime result = add(birthDate);
|
|
36
|
+
DateTime expectedDate = new DateTime.utc(2046, DateTime.OCTOBER, 2, 23, 46, 40);
|
|
37
|
+
|
|
38
|
+
expect(result, equals(expectedDate));
|
|
39
|
+
}, skip: true);
|
|
51
40
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
expectedDate = new DateTime.utc(1991, DateTime.MARCH, 27, 7, 0, 25);
|
|
57
|
-
});
|
|
41
|
+
test("full time with day roll-over", () {
|
|
42
|
+
final DateTime birthDate = new DateTime.utc(2015, DateTime.JANUARY, 24, 23, 59, 59);
|
|
43
|
+
final DateTime result = add(birthDate);
|
|
44
|
+
DateTime expectedDate = new DateTime.utc(2046, DateTime.OCTOBER, 3, 01, 46, 39);
|
|
58
45
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
46
|
+
expect(result, equals(expectedDate));
|
|
47
|
+
}, skip: true);
|
|
62
48
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import 'package:test/test.dart';
|
|
2
|
+
import 'package:hello_world/hello_world.dart';
|
|
3
3
|
|
|
4
4
|
void main() {
|
|
5
|
-
test("
|
|
5
|
+
test("Say Hi!", () {
|
|
6
6
|
expect(new HelloWorld().hello(), equals("Hello, World!"));
|
|
7
7
|
});
|
|
8
8
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class PhoneNumber {
|
|
2
2
|
/// Returns `String` for a valid number, `null` for invalid.
|
|
3
|
-
|
|
3
|
+
String clean(String phoneNumber) {
|
|
4
4
|
/// initialize an empty string.
|
|
5
5
|
String onlyDigits = "";
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@ class PhoneNumber {
|
|
|
16
16
|
/// Only these special characters are allowed.
|
|
17
17
|
/// **"." "(" ")" "-" "+" ** and space,
|
|
18
18
|
/// remove these characters.
|
|
19
|
-
phoneNumber = phoneNumber.replaceAll(new RegExp(r"^[
|
|
19
|
+
phoneNumber = phoneNumber.replaceAll(new RegExp(r"^[-.()+\s]*$"), "");
|
|
20
20
|
|
|
21
21
|
/// "123-@:!-7890" is invalid, however **"123-@:!-789012"** is valid
|
|
22
22
|
/// by the current logic since the regex grabs all the digits
|
|
@@ -1,66 +1,92 @@
|
|
|
1
1
|
import 'package:test/test.dart';
|
|
2
2
|
import 'package:phone_number/phone_number.dart';
|
|
3
3
|
|
|
4
|
-
final phoneNumber = new PhoneNumber();
|
|
4
|
+
final PhoneNumber phoneNumber = new PhoneNumber();
|
|
5
5
|
|
|
6
6
|
void main() {
|
|
7
7
|
group("PhoneNumber: Cleanup special characters - ", cleanUpTest);
|
|
8
8
|
group("PhoneNumber: Number length - ", numberLengthTest);
|
|
9
9
|
group("PhoneNumber: Accept only numbers - ", numbersOnlyTest);
|
|
10
|
-
group("PhoneNumber: Area/Exchange Code - ",
|
|
11
|
-
group("PhoneNumber: Edge cases - ",
|
|
10
|
+
group("PhoneNumber: Area/Exchange Code - ", areaCodeTests);
|
|
11
|
+
group("PhoneNumber: Edge cases - ", exchangeCodeTests);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
void cleanUpTest() {
|
|
15
15
|
test("cleans the number", () {
|
|
16
|
-
|
|
16
|
+
final String result = phoneNumber.clean("(223) 456-7890");
|
|
17
|
+
expect(result, equals("2234567890"));
|
|
17
18
|
}, skip: false);
|
|
19
|
+
|
|
18
20
|
test("cleans numbers with multiple spaces", () {
|
|
19
|
-
|
|
21
|
+
final String result = phoneNumber.clean("223 456 7890 ");
|
|
22
|
+
expect(result, equals("2234567890"));
|
|
20
23
|
}, skip: true);
|
|
24
|
+
|
|
21
25
|
test("cleans numbers with dots", () {
|
|
22
|
-
|
|
26
|
+
final String result = phoneNumber.clean("223.456.7890");
|
|
27
|
+
expect(result, equals("2234567890"));
|
|
23
28
|
}, skip: true);
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
void numberLengthTest() {
|
|
27
32
|
test("invalid when 9 digits", () {
|
|
28
|
-
|
|
33
|
+
final String result = phoneNumber.clean("123456789");
|
|
34
|
+
expect(result, equals(null));
|
|
29
35
|
}, skip: true);
|
|
36
|
+
|
|
30
37
|
test("invalid when 11 digits and does not start with a 1", () {
|
|
31
|
-
|
|
38
|
+
final String result = phoneNumber.clean("22234567890");
|
|
39
|
+
expect(result, equals(null));
|
|
32
40
|
}, skip: true);
|
|
41
|
+
|
|
33
42
|
test("valid when 11 digits and starting with 1", () {
|
|
34
|
-
|
|
43
|
+
final String result = phoneNumber.clean("12234567890");
|
|
44
|
+
expect(result, equals("2234567890"));
|
|
35
45
|
}, skip: true);
|
|
46
|
+
|
|
36
47
|
test("valid when 11 digits and starting with 1 even with punctuation", () {
|
|
37
|
-
|
|
48
|
+
final String result = phoneNumber.clean("+1 (223) 456-7890");
|
|
49
|
+
expect(result, equals("2234567890"));
|
|
38
50
|
}, skip: true);
|
|
51
|
+
|
|
39
52
|
test("invalid when more than 11 digits", () {
|
|
40
|
-
|
|
53
|
+
final String result = phoneNumber.clean("321234567890");
|
|
54
|
+
expect(result, equals(null));
|
|
41
55
|
}, skip: true);
|
|
42
56
|
}
|
|
43
57
|
|
|
44
58
|
void numbersOnlyTest() {
|
|
45
59
|
test("invalid with letters", () {
|
|
46
|
-
|
|
60
|
+
final String result = phoneNumber.clean("123-abc-7890");
|
|
61
|
+
expect(result, equals(null));
|
|
47
62
|
}, skip: true);
|
|
63
|
+
|
|
48
64
|
test("invalid with punctuations", () {
|
|
49
|
-
|
|
65
|
+
final String result = phoneNumber.clean("123-@:!-7890");
|
|
66
|
+
expect(result, equals(null));
|
|
50
67
|
}, skip: true);
|
|
51
68
|
}
|
|
52
69
|
|
|
53
|
-
void
|
|
54
|
-
test("invalid if area code
|
|
55
|
-
|
|
70
|
+
void areaCodeTests() {
|
|
71
|
+
test("invalid if area code starts with 0", () {
|
|
72
|
+
final String result = phoneNumber.clean("(023) 456-7890");
|
|
73
|
+
expect(result, equals(null));
|
|
56
74
|
}, skip: true);
|
|
57
|
-
|
|
58
|
-
|
|
75
|
+
|
|
76
|
+
test("invalid if area code starts with 1", () {
|
|
77
|
+
final String result = phoneNumber.clean("(123) 456-7890");
|
|
78
|
+
expect(result, equals(null));
|
|
59
79
|
}, skip: true);
|
|
60
80
|
}
|
|
61
81
|
|
|
62
|
-
void
|
|
63
|
-
test("invalid if
|
|
64
|
-
|
|
82
|
+
void exchangeCodeTests() {
|
|
83
|
+
test("invalid if exchange code starts with 0", () {
|
|
84
|
+
final Null result = phoneNumber.clean("(223) 056-7890");
|
|
85
|
+
expect(result, equals(null));
|
|
86
|
+
}, skip: true);
|
|
87
|
+
|
|
88
|
+
test("invalid if exchange code starts with 1", () {
|
|
89
|
+
final Null result = phoneNumber.clean("(223) 156-7890");
|
|
90
|
+
expect(result, equals(null));
|
|
65
91
|
}, skip: true);
|
|
66
92
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Scrabble Score
|
|
2
|
+
|
|
3
|
+
Given a word, compute the scrabble score for that word.
|
|
4
|
+
|
|
5
|
+
## Letter Values
|
|
6
|
+
|
|
7
|
+
You'll need these:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
Letter Value
|
|
11
|
+
A, E, I, O, U, L, N, R, S, T 1
|
|
12
|
+
D, G 2
|
|
13
|
+
B, C, M, P 3
|
|
14
|
+
F, H, V, W, Y 4
|
|
15
|
+
K 5
|
|
16
|
+
J, X 8
|
|
17
|
+
Q, Z 10
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
21
|
+
|
|
22
|
+
"cabbage" should be scored as worth 14 points:
|
|
23
|
+
|
|
24
|
+
- 3 points for C
|
|
25
|
+
- 1 point for A, twice
|
|
26
|
+
- 3 points for B, twice
|
|
27
|
+
- 2 points for G
|
|
28
|
+
- 1 point for E
|
|
29
|
+
|
|
30
|
+
And to total:
|
|
31
|
+
|
|
32
|
+
- `3 + 2*1 + 2*3 + 2 + 1`
|
|
33
|
+
- = `3 + 2 + 6 + 3`
|
|
34
|
+
- = `5 + 9`
|
|
35
|
+
- = 14
|
|
36
|
+
|
|
37
|
+
## Extensions
|
|
38
|
+
|
|
39
|
+
- You can play a double or a triple letter.
|
|
40
|
+
- You can play a double or a triple word.
|
|
41
|
+
|
|
42
|
+
To run the tests:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
$ pub run test
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For more detailed info about the Dart track see the [help page](http://exercism.io/languages/dart).
|
|
49
|
+
|
|
50
|
+
## Source
|
|
51
|
+
|
|
52
|
+
Inspired by the Extreme Startup game [https://github.com/rchatley/extreme_startup](https://github.com/rchatley/extreme_startup)
|
|
53
|
+
|
|
54
|
+
## Submitting Incomplete Solutions
|
|
55
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
final Map<String, int> _scores = const {
|
|
2
|
+
'a': 1,
|
|
3
|
+
'e': 1,
|
|
4
|
+
'i': 1,
|
|
5
|
+
'o': 1,
|
|
6
|
+
'u': 1,
|
|
7
|
+
'n': 1,
|
|
8
|
+
'l': 1,
|
|
9
|
+
'r': 1,
|
|
10
|
+
's': 1,
|
|
11
|
+
't': 1,
|
|
12
|
+
'd': 2,
|
|
13
|
+
'g': 2,
|
|
14
|
+
'b': 3,
|
|
15
|
+
'c': 3,
|
|
16
|
+
'm': 3,
|
|
17
|
+
'p': 3,
|
|
18
|
+
'f': 4,
|
|
19
|
+
'h': 4,
|
|
20
|
+
'v': 4,
|
|
21
|
+
'w': 4,
|
|
22
|
+
'y': 4,
|
|
23
|
+
'k': 5,
|
|
24
|
+
'j': 8,
|
|
25
|
+
'x': 8,
|
|
26
|
+
'z': 10,
|
|
27
|
+
'q': 10
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
int score(String word) {
|
|
31
|
+
int val = 0;
|
|
32
|
+
if (word.length > 0) {
|
|
33
|
+
word.split('').forEach((char) {
|
|
34
|
+
int score = _scores[char.toLowerCase()];
|
|
35
|
+
val += score ?? 0;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return val;
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Put your code here
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import 'package:test/test.dart';
|
|
2
|
+
import 'package:scrabble_score/scrabble_score.dart';
|
|
3
|
+
|
|
4
|
+
void main() {
|
|
5
|
+
group('Scrabble score', () {
|
|
6
|
+
group('should return a score of 0 for', () {
|
|
7
|
+
test('empty input', () {
|
|
8
|
+
expect(score(''), equals(0));
|
|
9
|
+
}, skip: false);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
group('should return the appropriate score for', () {
|
|
13
|
+
test('lowercase letters', () {
|
|
14
|
+
expect(score('a'), equals(1));
|
|
15
|
+
}, skip: true);
|
|
16
|
+
|
|
17
|
+
test('uppercase letters', () {
|
|
18
|
+
expect(score('A'), equals(1));
|
|
19
|
+
}, skip: true);
|
|
20
|
+
|
|
21
|
+
test('valuable letters', () {
|
|
22
|
+
expect(score('f'), equals(4));
|
|
23
|
+
}, skip: true);
|
|
24
|
+
|
|
25
|
+
test('english-like word', () {
|
|
26
|
+
expect(score('pinata'), equals(8));
|
|
27
|
+
}, skip: true);
|
|
28
|
+
|
|
29
|
+
test('long, mixed-case word', () {
|
|
30
|
+
expect(score('OxyphenButazone'), equals(41));
|
|
31
|
+
}, skip: true);
|
|
32
|
+
|
|
33
|
+
test('medium, valuable word', () {
|
|
34
|
+
expect(score('quirky'), equals(22));
|
|
35
|
+
}, skip: true);
|
|
36
|
+
|
|
37
|
+
test('medium word', () {
|
|
38
|
+
expect(score('street'), equals(6));
|
|
39
|
+
}, skip: true);
|
|
40
|
+
|
|
41
|
+
test('short, valuable word', () {
|
|
42
|
+
expect(score('zoo'), equals(12));
|
|
43
|
+
}, skip: true);
|
|
44
|
+
|
|
45
|
+
test('short word', () {
|
|
46
|
+
expect(score('at'), equals(2));
|
|
47
|
+
}, skip: true);
|
|
48
|
+
|
|
49
|
+
test('a word containing one of every letter of the alphabet', () {
|
|
50
|
+
expect(score('abcdefghijklmnopqrstuvwxyz'), equals(87));
|
|
51
|
+
}, skip: true);
|
|
52
|
+
|
|
53
|
+
test('a word containing one of every letter of the alphabet in reverse', () {
|
|
54
|
+
expect(score('zyxwvutsrqponmlkjihgfedcba'), equals(87));
|
|
55
|
+
}, skip: true);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
data/tracks/dart/pubspec.lock
CHANGED
|
@@ -3,48 +3,59 @@
|
|
|
3
3
|
-include_lib("erl_exercism/include/exercism.hrl").
|
|
4
4
|
-include_lib("eunit/include/eunit.hrl").
|
|
5
5
|
|
|
6
|
-
% test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
|
7
|
-
|
|
8
6
|
sound_of_1_is_1_test() ->
|
|
9
|
-
?
|
|
7
|
+
?assertEqual("1", raindrops:convert(1)).
|
|
8
|
+
|
|
10
9
|
sound_of_3_is_Pling_test() ->
|
|
11
|
-
?
|
|
10
|
+
?assertEqual("Pling", raindrops:convert(3)).
|
|
11
|
+
|
|
12
12
|
sound_of_5_is_Plang_test() ->
|
|
13
|
-
?
|
|
13
|
+
?assertEqual("Plang", raindrops:convert(5)).
|
|
14
|
+
|
|
14
15
|
sound_of_7_is_Plong_test() ->
|
|
15
|
-
?
|
|
16
|
+
?assertEqual("Plong", raindrops:convert(7)).
|
|
16
17
|
|
|
17
18
|
sound_of_6_is_Pling_test() ->
|
|
18
|
-
?
|
|
19
|
+
?assertEqual("Pling", raindrops:convert(6)).
|
|
20
|
+
|
|
19
21
|
sound_of_2_to_the_power_3_is_8_test() ->
|
|
20
|
-
?
|
|
22
|
+
?assertEqual("8", raindrops:convert(8)).
|
|
23
|
+
|
|
21
24
|
sound_of_9_is_Pling_test() ->
|
|
22
|
-
?
|
|
25
|
+
?assertEqual("Pling", raindrops:convert(9)).
|
|
26
|
+
|
|
23
27
|
sound_of_10_is_Plang_test() ->
|
|
24
|
-
?
|
|
28
|
+
?assertEqual("Plang", raindrops:convert(10)).
|
|
29
|
+
|
|
25
30
|
sound_of_14_is_Plong_test() ->
|
|
26
|
-
?
|
|
31
|
+
?assertEqual("Plong", raindrops:convert(14)).
|
|
27
32
|
|
|
28
33
|
sound_of_15_is_PlingPlang_test() ->
|
|
29
|
-
?
|
|
34
|
+
?assertEqual("PlingPlang", raindrops:convert(15)).
|
|
35
|
+
|
|
30
36
|
sound_of_21_is_PlingPlong_test() ->
|
|
31
|
-
?
|
|
37
|
+
?assertEqual("PlingPlong", raindrops:convert(21)).
|
|
38
|
+
|
|
32
39
|
sound_of_25_is_Plang_test() ->
|
|
33
|
-
?
|
|
40
|
+
?assertEqual("Plang", raindrops:convert(25)).
|
|
34
41
|
|
|
35
42
|
sound_of_27_is_Pling_test() ->
|
|
36
|
-
?
|
|
43
|
+
?assertEqual("Pling", raindrops:convert(27)).
|
|
44
|
+
|
|
37
45
|
sound_of_35_is_PlangPlong_test() ->
|
|
38
|
-
?
|
|
46
|
+
?assertEqual("PlangPlong", raindrops:convert(35)).
|
|
47
|
+
|
|
39
48
|
sound_of_49_is_Plong_test() ->
|
|
40
|
-
?
|
|
49
|
+
?assertEqual("Plong", raindrops:convert(49)).
|
|
41
50
|
|
|
42
51
|
sound_of_52_is_52_test() ->
|
|
43
|
-
?
|
|
52
|
+
?assertEqual("52", raindrops:convert(52)).
|
|
53
|
+
|
|
44
54
|
sound_of_105_is_PlingPlangPlong_test() ->
|
|
45
|
-
?
|
|
55
|
+
?assertEqual("PlingPlangPlong", raindrops:convert(105)).
|
|
56
|
+
|
|
46
57
|
sound_of_3125_is_Plang_test() ->
|
|
47
|
-
?
|
|
58
|
+
?assertEqual("Plang", raindrops:convert(3125)).
|
|
48
59
|
|
|
49
60
|
version_test() ->
|
|
50
|
-
?
|
|
61
|
+
?assertEqual(1, raindrops:test_version()).
|
data/tracks/nim/config.json
CHANGED
|
@@ -209,6 +209,16 @@
|
|
|
209
209
|
"algorithms",
|
|
210
210
|
"maps"
|
|
211
211
|
]
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"uuid": "cc35f8f2-488e-40f7-adcd-1e690cabc6f8",
|
|
215
|
+
"slug": "acronym",
|
|
216
|
+
"core": false,
|
|
217
|
+
"unlocked_by": null,
|
|
218
|
+
"difficulty": 1,
|
|
219
|
+
"topics": [
|
|
220
|
+
"strings"
|
|
221
|
+
]
|
|
212
222
|
}
|
|
213
223
|
]
|
|
214
224
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Acronym
|
|
2
|
+
|
|
3
|
+
Convert a phrase to its acronym.
|
|
4
|
+
|
|
5
|
+
Techies love their TLA (Three Letter Acronyms)!
|
|
6
|
+
|
|
7
|
+
Help generate some jargon by writing a program that converts a long name
|
|
8
|
+
like Portable Network Graphics to its acronym (PNG).
|
|
9
|
+
## Source
|
|
10
|
+
|
|
11
|
+
Julien Vanier [https://github.com/monkbroc](https://github.com/monkbroc)
|
|
12
|
+
|
|
13
|
+
## Submitting Incomplete Solutions
|
|
14
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
import acronym
|
|
4
|
+
|
|
5
|
+
suite "Acronym":
|
|
6
|
+
|
|
7
|
+
test "basic":
|
|
8
|
+
check abbreviate("Portable Network Graphics") == "PNG"
|
|
9
|
+
|
|
10
|
+
test "lowercase_words":
|
|
11
|
+
check abbreviate("Ruby on Rails") == "ROR"
|
|
12
|
+
|
|
13
|
+
test "punctuation":
|
|
14
|
+
check abbreviate("First In, First Out") == "FIFO"
|
|
15
|
+
|
|
16
|
+
test "all_caps_words":
|
|
17
|
+
check abbreviate("GNU Image Manipulation Program") == "GIMP"
|
|
18
|
+
|
|
19
|
+
test "punctuation_without_whitespace":
|
|
20
|
+
check abbreviate("Complementary metal-oxide semiconductor") == "CMOS"
|