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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/dart/config.json +13 -0
  4. data/tracks/dart/exercises/armstrong-numbers/lib/example.dart +0 -1
  5. data/tracks/dart/exercises/gigasecond/lib/example.dart +2 -6
  6. data/tracks/dart/exercises/gigasecond/test/gigasecond_test.dart +35 -49
  7. data/tracks/dart/exercises/hello-world/test/hello_world_test.dart +3 -3
  8. data/tracks/dart/exercises/phone-number/lib/example.dart +2 -2
  9. data/tracks/dart/exercises/phone-number/lib/phone_number.dart +1 -1
  10. data/tracks/dart/exercises/phone-number/pubspec.yaml +1 -1
  11. data/tracks/dart/exercises/phone-number/test/phone_number_test.dart +47 -21
  12. data/tracks/dart/exercises/scrabble-score/README.md +55 -0
  13. data/tracks/dart/exercises/scrabble-score/lib/example.dart +39 -0
  14. data/tracks/dart/exercises/scrabble-score/lib/scrabble_score.dart +1 -0
  15. data/tracks/dart/exercises/scrabble-score/pubspec.yaml +3 -0
  16. data/tracks/dart/exercises/scrabble-score/test/scrabble_score_test.dart +58 -0
  17. data/tracks/dart/pubspec.lock +1 -1
  18. data/tracks/dart/test/exercises_test.dart +1 -1
  19. data/tracks/erlang/exercises/raindrops/test/raindrops_tests.erl +32 -21
  20. data/tracks/nim/config.json +10 -0
  21. data/tracks/nim/exercises/acronym/README.md +14 -0
  22. data/tracks/nim/exercises/acronym/acronym_test.nim +20 -0
  23. data/tracks/nim/exercises/acronym/example.nim +6 -0
  24. data/tracks/powershell/config.json +12 -0
  25. data/tracks/powershell/exercises/leap/.gitignore +1 -0
  26. data/tracks/powershell/exercises/leap/.version +1 -0
  27. data/tracks/powershell/exercises/leap/README.md +25 -0
  28. data/tracks/powershell/exercises/leap/leap-example.ps1 +14 -0
  29. data/tracks/powershell/exercises/leap/leap.tests.ps1 +33 -0
  30. metadata +15 -6
  31. data/tracks/coq/.github/PULL_REQUEST_TEMPLATE.md +0 -23
  32. data/tracks/dart/exercises/gigasecond/pubspec.lock +0 -293
  33. data/tracks/dart/exercises/hello-world/pubspec.lock +0 -293
  34. 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: f52701e66b6ce85f9aa2618511e820b44d7e1bf5
4
- data.tar.gz: 74e6a01530e8898b4be659e0d917ddd6a356146d
3
+ metadata.gz: b65c8a425dbf105a088d9dbaf07e19f8f0391b4d
4
+ data.tar.gz: a91c0542e0d47d449d0844166d924688af580f06
5
5
  SHA512:
6
- metadata.gz: 4c8f48e65a5424b3fad45d72e1c3bd32094cc0e6ac96a327a1db770b89e8c54493ddf1f063da624ce29694a8900c801beddc42e96c704940c1d8b0e72a09aa0d
7
- data.tar.gz: 16ea92d343df84c9160ffbdc8347ce72890765881fc633f35618832364eceddf3af72f16d62fc28a9e9f1ca9813347a0a44ed737e42a5c7331a268ae90464a83
6
+ metadata.gz: 82bf770e80b49014a2835430b8533263e55d288afca5174018889303989666d2d8f9f06d1a7cea641d4707cb5010652beaf8c9367734af4956c72197b4f80c4c
7
+ data.tar.gz: 1393c650ebdc992c6e15029799280df1fbcfb5aa9a02c5fc6957423863189ef58059f9ea1edd46696d5e40319c4b3153df34dfbe4081e51498208eb02dc418a3
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.142"
2
+ VERSION = "2.2.1.143"
3
3
  end
@@ -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,7 +1,3 @@
1
- class Gigasecond {
2
- DateTime birthDate;
3
-
4
- Gigasecond(DateTime this.birthDate);
5
-
6
- DateTime date() => birthDate.add(new Duration(seconds: 1000000000));
1
+ DateTime add(final DateTime birthDate) {
2
+ return birthDate.add(new Duration(seconds: 1000000000));
7
3
  }
@@ -1,62 +1,48 @@
1
- import "package:test/test.dart";
2
- import "package:gigasecond/gigasecond.dart";
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("Gigasecond", gigasecondTests);
5
+ group('Add one gigasecond to the input.', gigasecondTests);
10
6
  }
11
7
 
12
8
  void gigasecondTests() {
13
- // The setUp() function is used to share code between tests. It is executed
14
- // before every test in a group or test suite.
15
- setUp(() {
16
- birthDate = new DateTime.utc(2015, DateTime.SEPTEMBER, 14);
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
- void sinceMidnightTests() {
25
- setUp(() {
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("tells a gigasecond anniversary since midnight", () {
31
- expect(gigasecond.date(), equals(expectedDate));
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
- test("make sure calling \"date()\" doesn't mutate value", () {
35
- gigasecond.date();
36
- expect(gigasecond.date(), equals(expectedDate));
37
- });
38
- }
22
+ expect(result, equals(expectedDate));
23
+ }, skip: true);
39
24
 
40
- void atNightTests() {
41
- setUp(() {
42
- birthDate = birthDate.add(new Duration(hours: 23, minutes: 59, seconds: 59));
43
- gigasecond = new Gigasecond(birthDate);
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
- test("tells the anniversary is next day when you are born at night", () {
48
- expect(gigasecond.date(), equals(expectedDate));
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
- void unixEpochTests() {
53
- setUp(() {
54
- birthDate = new DateTime.utc(1959, DateTime.JULY, 19, 5, 13, 45);
55
- gigasecond = new Gigasecond(birthDate);
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
- test("even works before 1970 (beginning of Unix epoch)", () {
60
- expect(gigasecond.date(), equals(expectedDate));
61
- });
46
+ expect(result, equals(expectedDate));
47
+ }, skip: true);
62
48
  }
@@ -1,8 +1,8 @@
1
- import "package:test/test.dart";
2
- import "package:hello_world/hello_world.dart";
1
+ import 'package:test/test.dart';
2
+ import 'package:hello_world/hello_world.dart';
3
3
 
4
4
  void main() {
5
- test("returns \"Hello, World!\"", () {
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
- dynamic cleanNumber(String phoneNumber) {
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"^[\-\.\(\)\+\s+]*$"), "");
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,3 +1,3 @@
1
1
  class PhoneNumber {
2
- // Put your code here.
2
+ // Put your code here
3
3
  }
@@ -1,3 +1,3 @@
1
1
  name: 'phone_number'
2
2
  dev_dependencies:
3
- test: '<0.13.0'
3
+ test: '<0.13.0'
@@ -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 - ", codeRangeTest);
11
- group("PhoneNumber: Edge cases - ", edgeCases);
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
- expect(phoneNumber.cleanNumber("(223) 456-7890"), equals("2234567890"));
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
- expect(phoneNumber.cleanNumber("223 456 7890 "), equals("2234567890"));
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
- expect(phoneNumber.cleanNumber("223.456.7890"), equals("2234567890"));
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
- expect(phoneNumber.cleanNumber("123456789"), equals(null));
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
- expect(phoneNumber.cleanNumber("22234567890"), equals(null));
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
- expect(phoneNumber.cleanNumber("12234567890"), equals("2234567890"));
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
- expect(phoneNumber.cleanNumber("+1 (223) 456-7890"), equals("2234567890"));
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
- expect(phoneNumber.cleanNumber("321234567890"), equals(null));
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
- expect(phoneNumber.cleanNumber("123-abc-7890"), equals(null));
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
- expect(phoneNumber.cleanNumber("123-@:!-7890"), equals(null));
65
+ final String result = phoneNumber.clean("123-@:!-7890");
66
+ expect(result, equals(null));
50
67
  }, skip: true);
51
68
  }
52
69
 
53
- void codeRangeTest() {
54
- test("invalid if area code does not start with 2-9", () {
55
- expect(phoneNumber.cleanNumber("(123) 456-7890"), equals(null));
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
- test("invalid if exchange code does not start with 2-9", () {
58
- expect(phoneNumber.cleanNumber("(223) 056-7890"), equals(null));
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 edgeCases() {
63
- test("invalid if passes all other tests but contains special characters", () {
64
- expect(phoneNumber.cleanNumber("123-@:!-78901256"), equals(null));
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,3 @@
1
+ name: 'scrabble_score'
2
+ dev_dependencies:
3
+ test: '<0.13.0'
@@ -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
+ }
@@ -114,7 +114,7 @@ packages:
114
114
  name: io
115
115
  url: "https://pub.dartlang.org"
116
116
  source: hosted
117
- version: "0.3.2+1"
117
+ version: "0.3.0"
118
118
  isolate:
119
119
  description:
120
120
  name: isolate
@@ -1,4 +1,4 @@
1
- @Timeout(const Duration(seconds: 60))
1
+ @Timeout(const Duration(seconds: 120))
2
2
 
3
3
  import "dart:io";
4
4
  import "dart:async";
@@ -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
- ?assert( raindrops:convert(1) =:= "1").
7
+ ?assertEqual("1", raindrops:convert(1)).
8
+
10
9
  sound_of_3_is_Pling_test() ->
11
- ?assert( raindrops:convert(3) =:= "Pling").
10
+ ?assertEqual("Pling", raindrops:convert(3)).
11
+
12
12
  sound_of_5_is_Plang_test() ->
13
- ?assert( raindrops:convert(5) =:= "Plang").
13
+ ?assertEqual("Plang", raindrops:convert(5)).
14
+
14
15
  sound_of_7_is_Plong_test() ->
15
- ?assert( raindrops:convert(7) =:= "Plong").
16
+ ?assertEqual("Plong", raindrops:convert(7)).
16
17
 
17
18
  sound_of_6_is_Pling_test() ->
18
- ?assert( raindrops:convert(6) =:= "Pling").
19
+ ?assertEqual("Pling", raindrops:convert(6)).
20
+
19
21
  sound_of_2_to_the_power_3_is_8_test() ->
20
- ?assert( raindrops:convert(8) =:= "8").
22
+ ?assertEqual("8", raindrops:convert(8)).
23
+
21
24
  sound_of_9_is_Pling_test() ->
22
- ?assert( raindrops:convert(9) =:= "Pling").
25
+ ?assertEqual("Pling", raindrops:convert(9)).
26
+
23
27
  sound_of_10_is_Plang_test() ->
24
- ?assert( raindrops:convert(10) =:= "Plang").
28
+ ?assertEqual("Plang", raindrops:convert(10)).
29
+
25
30
  sound_of_14_is_Plong_test() ->
26
- ?assert( raindrops:convert(14) =:= "Plong").
31
+ ?assertEqual("Plong", raindrops:convert(14)).
27
32
 
28
33
  sound_of_15_is_PlingPlang_test() ->
29
- ?assert( raindrops:convert(15) =:= "PlingPlang").
34
+ ?assertEqual("PlingPlang", raindrops:convert(15)).
35
+
30
36
  sound_of_21_is_PlingPlong_test() ->
31
- ?assert( raindrops:convert(21) =:= "PlingPlong").
37
+ ?assertEqual("PlingPlong", raindrops:convert(21)).
38
+
32
39
  sound_of_25_is_Plang_test() ->
33
- ?assert( raindrops:convert(25) =:= "Plang").
40
+ ?assertEqual("Plang", raindrops:convert(25)).
34
41
 
35
42
  sound_of_27_is_Pling_test() ->
36
- ?assert( raindrops:convert(27) =:= "Pling").
43
+ ?assertEqual("Pling", raindrops:convert(27)).
44
+
37
45
  sound_of_35_is_PlangPlong_test() ->
38
- ?assert( raindrops:convert(35) =:= "PlangPlong").
46
+ ?assertEqual("PlangPlong", raindrops:convert(35)).
47
+
39
48
  sound_of_49_is_Plong_test() ->
40
- ?assert( raindrops:convert(49) =:= "Plong").
49
+ ?assertEqual("Plong", raindrops:convert(49)).
41
50
 
42
51
  sound_of_52_is_52_test() ->
43
- ?assert( raindrops:convert(52) =:= "52").
52
+ ?assertEqual("52", raindrops:convert(52)).
53
+
44
54
  sound_of_105_is_PlingPlangPlong_test() ->
45
- ?assert( raindrops:convert(105) =:= "PlingPlangPlong").
55
+ ?assertEqual("PlingPlangPlong", raindrops:convert(105)).
56
+
46
57
  sound_of_3125_is_Plang_test() ->
47
- ?assert( raindrops:convert(3125) =:= "Plang").
58
+ ?assertEqual("Plang", raindrops:convert(3125)).
48
59
 
49
60
  version_test() ->
50
- ?assertMatch(1, raindrops:test_version()).
61
+ ?assertEqual(1, raindrops:test_version()).
@@ -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"
@@ -0,0 +1,6 @@
1
+ import
2
+ strutils, sequtils
3
+
4
+ proc abbreviate*(phrase: string): string =
5
+ let words = phrase.split({' ', '-', ','}).filterIt(it.isAlphaAscii)
6
+ words.mapIt(it[0].toUpperAscii).join