trackler 2.2.1.73 → 2.2.1.74

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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/rna-transcription/canonical-data.json +1 -31
  4. data/problem-specifications/exercises/secret-handshake/metadata.yml +1 -1
  5. data/tracks/csharp/config.json +10 -0
  6. data/tracks/csharp/exercises/Exercises.sln +7 -1
  7. data/tracks/csharp/exercises/armstrong-numbers/ArmstrongNumbers.cs +9 -0
  8. data/tracks/csharp/exercises/armstrong-numbers/ArmstrongNumbers.csproj +17 -0
  9. data/tracks/csharp/exercises/armstrong-numbers/ArmstrongNumbersTest.cs +54 -0
  10. data/tracks/csharp/exercises/armstrong-numbers/Example.cs +18 -0
  11. data/tracks/csharp/exercises/armstrong-numbers/README.md +10 -0
  12. data/tracks/csharp/exercises/bob/BobTest.cs +2 -2
  13. data/tracks/csharp/exercises/bob/Example.cs +2 -0
  14. data/tracks/csharp/exercises/book-store/BookStoreTest.cs +8 -1
  15. data/tracks/csharp/exercises/change/README.md +1 -1
  16. data/tracks/csharp/exercises/rna-transcription/RnaTranscriptionTest.cs +1 -20
  17. data/tracks/csharp/exercises/secret-handshake/README.md +1 -1
  18. data/tracks/csharp/exercises/word-count/WordCountTest.cs +12 -0
  19. data/tracks/csharp/generators/Exercises/ArmstrongNumbers.cs +6 -0
  20. data/tracks/dart/config.json +4 -3
  21. data/tracks/dart/config/maintainers.json +3 -3
  22. data/tracks/delphi/exercises/armstrong-numbers/uArmstrongNumbersExample.pas +13 -10
  23. data/tracks/delphi/exercises/rna-transcription/uTestRnaTranscription.pas +4 -28
  24. data/tracks/ecmascript/config.json +5 -5
  25. data/tracks/fsharp/config.json +11 -0
  26. data/tracks/fsharp/exercises/Exercises.sln +6 -0
  27. data/tracks/fsharp/exercises/armstrong-numbers/ArmstrongNumbers.fs +3 -0
  28. data/tracks/fsharp/exercises/armstrong-numbers/ArmstrongNumbers.fsproj +23 -0
  29. data/tracks/fsharp/exercises/armstrong-numbers/ArmstrongNumbersTest.fs +41 -0
  30. data/tracks/fsharp/exercises/armstrong-numbers/Example.fs +7 -0
  31. data/tracks/fsharp/exercises/armstrong-numbers/Program.fs +1 -0
  32. data/tracks/fsharp/exercises/armstrong-numbers/README.md +15 -0
  33. data/tracks/fsharp/exercises/change/README.md +1 -1
  34. data/tracks/fsharp/exercises/secret-handshake/README.md +1 -1
  35. data/tracks/fsharp/generators/Common.fs +1 -0
  36. data/tracks/fsharp/generators/Generators.fs +7 -0
  37. data/tracks/go/exercises/secret-handshake/README.md +1 -1
  38. data/tracks/idris/.travis.yml +23 -3
  39. data/tracks/idris/bin/fetch-exercism-infra.sh +121 -0
  40. data/tracks/idris/bin/fetch-stack.sh +11 -0
  41. data/tracks/idris/bin/solve_exercises.sh +59 -0
  42. data/tracks/idris/config.json +6 -0
  43. data/tracks/idris/exercises/hello-world/src/HelloWorld.idr +4 -0
  44. data/tracks/java/exercises/reverse-string/src/main/java/ReverseString.java +1 -1
  45. data/tracks/javascript/.eslintignore +0 -7
  46. data/tracks/javascript/config.json +11 -0
  47. data/tracks/javascript/exercises/anagram/example.js +2 -2
  48. data/tracks/javascript/exercises/circular-buffer/circular-buffer.spec.js +1 -1
  49. data/tracks/javascript/exercises/circular-buffer/example.js +1 -1
  50. data/tracks/javascript/exercises/pangram/example.js +5 -4
  51. data/tracks/javascript/exercises/say/example.js +5 -2
  52. data/tracks/javascript/exercises/scrabble-score/example.js +2 -3
  53. data/tracks/javascript/exercises/secret-handshake/README.md +1 -1
  54. data/tracks/javascript/exercises/triangle/example.js +3 -2
  55. data/tracks/javascript/exercises/trinary/example.js +1 -1
  56. data/tracks/javascript/exercises/two-fer/README.md +41 -0
  57. data/tracks/javascript/exercises/two-fer/example.js +10 -0
  58. data/tracks/javascript/exercises/two-fer/two-fer.js +12 -0
  59. data/tracks/javascript/exercises/two-fer/two-fer.spec.js +18 -0
  60. data/tracks/kotlin/exercises/secret-handshake/README.md +1 -1
  61. data/tracks/perl6/exercises/rna-transcription/Example.pm6 +1 -2
  62. data/tracks/perl6/exercises/rna-transcription/RNA.pm6 +1 -1
  63. data/tracks/perl6/exercises/rna-transcription/example.yaml +3 -10
  64. data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +4 -40
  65. data/tracks/php/exercises/hamming/hamming_test.php +2 -1
  66. data/tracks/python/config.json +12 -0
  67. data/tracks/python/exercises/armstrong-numbers/README.md +28 -0
  68. data/tracks/python/exercises/armstrong-numbers/armstrong_numbers.py +2 -0
  69. data/tracks/python/exercises/armstrong-numbers/armstrong_numbers_test.py +36 -0
  70. data/tracks/python/exercises/armstrong-numbers/example.py +2 -0
  71. data/tracks/python/exercises/protein-translation/example.py +1 -1
  72. data/tracks/python/exercises/protein-translation/protein_translation.py +1 -5
  73. data/tracks/python/exercises/protein-translation/protein_translation_test.py +30 -19
  74. data/tracks/ruby/exercises/secret-handshake/README.md +1 -1
  75. data/tracks/rust/exercises/simple-linked-list/.meta/hints.md +2 -3
  76. data/tracks/rust/exercises/simple-linked-list/README.md +3 -3
  77. data/tracks/swift/config.json +13 -0
  78. data/tracks/swift/exercises/protein-translation/Package.swift +5 -0
  79. data/tracks/swift/exercises/protein-translation/README.md +56 -0
  80. data/tracks/swift/exercises/protein-translation/Sources/ProteinTranslation.swift +1 -0
  81. data/tracks/swift/exercises/protein-translation/Sources/ProteinTranslationExample.swift +54 -0
  82. data/tracks/swift/exercises/protein-translation/Tests/LinuxMain.swift +6 -0
  83. data/tracks/swift/exercises/protein-translation/Tests/ProteinTranslationTests/ProteinTranslationTests.swift +83 -0
  84. metadata +32 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f1190037e0e9c682c6f7b8e7dd6d72336c10f81
4
- data.tar.gz: 453ac98b453e57a0c63c04149776bdbd71d868a3
3
+ metadata.gz: 7a7b4624cf3983efc89bfe64c619f3b279d50de1
4
+ data.tar.gz: b8e4bbc0f9f8272c855fbea003cdc30195a2288f
5
5
  SHA512:
6
- metadata.gz: c6b4e7c7ceee1e344f37ffa51c3958efa8aa8ec479347d76a61d95cf08d920ea9cf56235258621aea6edee89ba74946081ac8ce8eb246f6382542fea59875028
7
- data.tar.gz: e2cf231717954447616835a4f21934430fadac65ceaa46f6e73e027d30a3d2c280aabff12f9d478b0ecdd8d557d02a6da7657d4e4ab7281699fe404aae2ab653
6
+ metadata.gz: ec2977ea8d584e80be5ed3cd8ceccfa35c1a69d5af7cffe379cda9f6b600dc83f3e08a65a981ee013c6e8efeaaa8655f34ce32b8a4ba242e863c0aa1fb197d90
7
+ data.tar.gz: dc9f246584ced43eeeeeb2676567b02015f6b03176a58c329694035cfed04bbe62a9db03c10421c993e2a83e51f072b6e95069ae913bfd348f012008bbbf2a44
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.73"
2
+ VERSION = "2.2.1.74"
3
3
  end
@@ -1,18 +1,6 @@
1
1
  {
2
2
  "exercise": "rna-transcription",
3
- "version": "1.0.1",
4
- "comments": [
5
- "Language implementations vary on the issue of invalid input data.",
6
- "A language may elect to simplify this task by only presenting valid",
7
- "test cases. For languages handling invalid input data as",
8
- "error conditions, invalid test cases are included here and are",
9
- "indicated with an expected value of null. Note however that null is",
10
- "simply an indication here in the JSON. Actually returning null from",
11
- "a rna-transcription function may or may not be idiomatic in a language.",
12
- "Language idioms of errors or exceptions should be followed.",
13
- "Alternative interpretations such as ignoring excess length at the end",
14
- "are not represented here."
15
- ],
3
+ "version": "1.1.0",
16
4
  "cases": [
17
5
  {
18
6
  "description": "RNA complement of cytosine is guanine",
@@ -43,24 +31,6 @@
43
31
  "property": "toRna",
44
32
  "dna": "ACGTGGTCTTAA",
45
33
  "expected": "UGCACCAGAAUU"
46
- },
47
- {
48
- "description": "correctly handles invalid input (RNA instead of DNA)",
49
- "property": "toRna",
50
- "dna": "U",
51
- "expected": null
52
- },
53
- {
54
- "description": "correctly handles completely invalid DNA input",
55
- "property": "toRna",
56
- "dna": "XXX",
57
- "expected": null
58
- },
59
- {
60
- "description": "correctly handles partially invalid DNA input",
61
- "property": "toRna",
62
- "dna": "ACGTXXXCTTAA",
63
- "expected": null
64
34
  }
65
35
  ]
66
36
  }
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  blurb: "Given a decimal number, convert it to the appropriate sequence of events for a secret handshake."
3
3
  source: "Bert, in Mary Poppins"
4
- source_url: "http://www.imdb.com/character/ch0011238/quotes"
4
+ source_url: "http://www.imdb.com/title/tt0058331/quotes/qt0437047"
@@ -125,6 +125,16 @@
125
125
  "unlocked_by": "sum-of-multiples",
126
126
  "uuid": "c4efbf8a-8e76-4700-807d-830a4938f4d0"
127
127
  },
128
+ {
129
+ "core": false,
130
+ "difficulty": 2,
131
+ "slug": "armstrong-numbers",
132
+ "topics": [
133
+ "mathematics"
134
+ ],
135
+ "unlocked_by": "sum-of-multiples",
136
+ "uuid": "8150604d-4cdc-414a-a523-dd65ac536f0e"
137
+ },
128
138
  {
129
139
  "core": true,
130
140
  "difficulty": 3,
@@ -1,6 +1,6 @@
1
1
  Microsoft Visual Studio Solution File, Format Version 12.00
2
2
  # Visual Studio 15
3
- VisualStudioVersion = 15.0.27004.2008
3
+ VisualStudioVersion = 15.0.27004.2009
4
4
  MinimumVisualStudioVersion = 15.0.26124.0
5
5
  Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accumulate", "accumulate\Accumulate.csproj", "{F16C0EE1-6923-4328-B015-363CF24FF867}"
6
6
  EndProject
@@ -224,6 +224,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IsbnVerifier", "isbn-verifi
224
224
  EndProject
225
225
  Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReverseString", "reverse-string\ReverseString.csproj", "{D2105979-EE3B-432B-8016-172BA949DE2F}"
226
226
  EndProject
227
+ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArmstrongNumbers", "armstrong-numbers\ArmstrongNumbers.csproj", "{7015C2C4-4050-4631-9394-7EAF19AB0191}"
228
+ EndProject
227
229
  Global
228
230
  GlobalSection(SolutionConfigurationPlatforms) = preSolution
229
231
  Debug|Any CPU = Debug|Any CPU
@@ -674,6 +676,10 @@ Global
674
676
  {D2105979-EE3B-432B-8016-172BA949DE2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
675
677
  {D2105979-EE3B-432B-8016-172BA949DE2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
676
678
  {D2105979-EE3B-432B-8016-172BA949DE2F}.Release|Any CPU.Build.0 = Release|Any CPU
679
+ {7015C2C4-4050-4631-9394-7EAF19AB0191}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
680
+ {7015C2C4-4050-4631-9394-7EAF19AB0191}.Debug|Any CPU.Build.0 = Debug|Any CPU
681
+ {7015C2C4-4050-4631-9394-7EAF19AB0191}.Release|Any CPU.ActiveCfg = Release|Any CPU
682
+ {7015C2C4-4050-4631-9394-7EAF19AB0191}.Release|Any CPU.Build.0 = Release|Any CPU
677
683
  EndGlobalSection
678
684
  GlobalSection(SolutionProperties) = preSolution
679
685
  HideSolutionNode = FALSE
@@ -0,0 +1,9 @@
1
+ using System;
2
+
3
+ public static class ArmstrongNumbers
4
+ {
5
+ public static bool IsArmstrongNumber(int number)
6
+ {
7
+ throw new NotImplementedException("You need to implement this function.");
8
+ }
9
+ }
@@ -0,0 +1,17 @@
1
+ <Project Sdk="Microsoft.NET.Sdk">
2
+
3
+ <PropertyGroup>
4
+ <TargetFramework>netcoreapp2.0</TargetFramework>
5
+ </PropertyGroup>
6
+
7
+ <ItemGroup>
8
+ <Compile Remove="Example.cs" />
9
+ </ItemGroup>
10
+
11
+ <ItemGroup>
12
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
13
+ <PackageReference Include="xunit" Version="2.3.1" />
14
+ <PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
15
+ </ItemGroup>
16
+
17
+ </Project>
@@ -0,0 +1,54 @@
1
+ // This file was auto-generated based on version 1.0.0 of the canonical data.
2
+
3
+ using Xunit;
4
+
5
+ public class ArmstrongNumbersTest
6
+ {
7
+ [Fact]
8
+ public void Single_digit_numbers_are_armstrong_numbers()
9
+ {
10
+ Assert.True(ArmstrongNumbers.IsArmstrongNumber(5));
11
+ }
12
+
13
+ [Fact(Skip = "Remove to run test")]
14
+ public void There_are_no_2_digit_armstrong_numbers()
15
+ {
16
+ Assert.False(ArmstrongNumbers.IsArmstrongNumber(10));
17
+ }
18
+
19
+ [Fact(Skip = "Remove to run test")]
20
+ public void Three_digit_number_that_is_an_armstrong_number()
21
+ {
22
+ Assert.True(ArmstrongNumbers.IsArmstrongNumber(153));
23
+ }
24
+
25
+ [Fact(Skip = "Remove to run test")]
26
+ public void Three_digit_number_that_is_not_an_armstrong_number()
27
+ {
28
+ Assert.False(ArmstrongNumbers.IsArmstrongNumber(100));
29
+ }
30
+
31
+ [Fact(Skip = "Remove to run test")]
32
+ public void Four_digit_number_that_is_an_armstrong_number()
33
+ {
34
+ Assert.True(ArmstrongNumbers.IsArmstrongNumber(9474));
35
+ }
36
+
37
+ [Fact(Skip = "Remove to run test")]
38
+ public void Four_digit_number_that_is_not_an_armstrong_number()
39
+ {
40
+ Assert.False(ArmstrongNumbers.IsArmstrongNumber(9475));
41
+ }
42
+
43
+ [Fact(Skip = "Remove to run test")]
44
+ public void Seven_digit_number_that_is_an_armstrong_number()
45
+ {
46
+ Assert.True(ArmstrongNumbers.IsArmstrongNumber(9926315));
47
+ }
48
+
49
+ [Fact(Skip = "Remove to run test")]
50
+ public void Seven_digit_number_that_is_not_an_armstrong_number()
51
+ {
52
+ Assert.False(ArmstrongNumbers.IsArmstrongNumber(9926314));
53
+ }
54
+ }
@@ -0,0 +1,18 @@
1
+ using System;
2
+
3
+ public static class ArmstrongNumbers
4
+ {
5
+ public static bool IsArmstrongNumber(int number)
6
+ {
7
+ var numString = number.ToString();
8
+ var length = numString.Length;
9
+
10
+ double total = 0;
11
+ for (int i = 0; i < length; i++)
12
+ {
13
+ total += Math.Pow(int.Parse(numString[i].ToString()), length);
14
+ }
15
+
16
+ return number == (int)total;
17
+ }
18
+ }
@@ -0,0 +1,10 @@
1
+ An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits.
2
+
3
+ For example:
4
+
5
+ - 9 is an Armstrong number, because `9 = 9^1 = 9`
6
+ - 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 2`
7
+ - 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
8
+ - 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
9
+
10
+ Write some code to determine whether a number is an Armstrong number.
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.0.0 of the canonical data.
1
+ // This file was auto-generated based on version 1.1.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
@@ -55,7 +55,7 @@ public void Using_acronyms_in_regular_speech()
55
55
  [Fact(Skip = "Remove to run test")]
56
56
  public void Forceful_question()
57
57
  {
58
- Assert.Equal("Whoa, chill out!", Bob.Response("WHAT THE HELL WERE YOU THINKING?"));
58
+ Assert.Equal("Calm down, I know what I'm doing!", Bob.Response("WHAT THE HELL WERE YOU THINKING?"));
59
59
  }
60
60
 
61
61
  [Fact(Skip = "Remove to run test")]
@@ -4,6 +4,8 @@ public static string Response(string statement)
4
4
  {
5
5
  if (IsSilence(statement))
6
6
  return "Fine. Be that way!";
7
+ if (IsYelling(statement) && IsQuestion(statement))
8
+ return "Calm down, I know what I'm doing!";
7
9
  if (IsYelling(statement))
8
10
  return "Whoa, chill out!";
9
11
  if (IsQuestion(statement))
@@ -1,4 +1,4 @@
1
- // This file was auto-generated based on version 1.0.1 of the canonical data.
1
+ // This file was auto-generated based on version 1.1.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
4
 
@@ -94,4 +94,11 @@ public void Three_each_of_first_2_books_and_2_each_of_remaining_books()
94
94
  var basket = new[] { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2 };
95
95
  Assert.Equal(75.2, BookStore.Total(basket));
96
96
  }
97
+
98
+ [Fact(Skip = "Remove to run test")]
99
+ public void Four_groups_of_four_are_cheaper_than_two_groups_each_of_five_and_three()
100
+ {
101
+ var basket = new[] { 1, 1, 2, 2, 3, 3, 4, 5, 1, 1, 2, 2, 3, 3, 4, 5 };
102
+ Assert.Equal(102.4, BookStore.Total(basket));
103
+ }
97
104
  }
@@ -23,7 +23,7 @@ Note that, when trying to submit an exercise, make sure the exercise file that y
23
23
  For example, if you're submitting `bob.cs` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/csharp/bob/bob.cs`.
24
24
  ## Source
25
25
 
26
- Software Craftsmanship - Kata-logue [http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata](http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata)
26
+ Software Craftsmanship - Kata-logue [http://craftsmanship.sv.cmu.edu/exercises/coin-change-kata](https://web.archive.org/web/20130115115225/http://craftsmanship.sv.cmu.edu:80/exercises/coin-change-kata)
27
27
 
28
28
  ## Submitting Incomplete Solutions
29
29
  It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -1,7 +1,6 @@
1
- // This file was auto-generated based on version 1.0.1 of the canonical data.
1
+ // This file was auto-generated based on version 1.1.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
- using System;
5
4
 
6
5
  public class RnaTranscriptionTest
7
6
  {
@@ -34,22 +33,4 @@ public void Rna_complement()
34
33
  {
35
34
  Assert.Equal("UGCACCAGAAUU", RnaTranscription.ToRna("ACGTGGTCTTAA"));
36
35
  }
37
-
38
- [Fact(Skip = "Remove to run test")]
39
- public void Correctly_handles_invalid_input_rna_instead_of_dna_()
40
- {
41
- Assert.Throws<ArgumentException>(() => RnaTranscription.ToRna("U"));
42
- }
43
-
44
- [Fact(Skip = "Remove to run test")]
45
- public void Correctly_handles_completely_invalid_dna_input()
46
- {
47
- Assert.Throws<ArgumentException>(() => RnaTranscription.ToRna("XXX"));
48
- }
49
-
50
- [Fact(Skip = "Remove to run test")]
51
- public void Correctly_handles_partially_invalid_dna_input()
52
- {
53
- Assert.Throws<ArgumentException>(() => RnaTranscription.ToRna("ACGTXXXCTTAA"));
54
- }
55
36
  }
@@ -35,7 +35,7 @@ Note that, when trying to submit an exercise, make sure the exercise file that y
35
35
  For example, if you're submitting `bob.cs` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/csharp/bob/bob.cs`.
36
36
  ## Source
37
37
 
38
- Bert, in Mary Poppins [http://www.imdb.com/character/ch0011238/quotes](http://www.imdb.com/character/ch0011238/quotes)
38
+ Bert, in Mary Poppins [http://www.imdb.com/title/tt0058331/quotes/qt0437047](http://www.imdb.com/title/tt0058331/quotes/qt0437047)
39
39
 
40
40
  ## Submitting Incomplete Solutions
41
41
  It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -140,4 +140,16 @@ public void With_quotations()
140
140
  };
141
141
  Assert.Equal(expected, actual);
142
142
  }
143
+
144
+ [Fact(Skip = "Remove to run test")]
145
+ public void Multiple_spaces_not_detected_as_a_word()
146
+ {
147
+ var actual = WordCount.Countwords(" multiple whitespaces");
148
+ var expected = new Dictionary<string, int>
149
+ {
150
+ ["multiple"] = 1,
151
+ ["whitespaces"] = 1
152
+ };
153
+ Assert.Equal(expected, actual);
154
+ }
143
155
  }
@@ -0,0 +1,6 @@
1
+ namespace Generators.Exercises
2
+ {
3
+ public class ArmstrongNumbers : GeneratorExercise
4
+ {
5
+ }
6
+ }
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "active": false,
3
- "exercises": [{
3
+ "exercises": [
4
+ {
4
5
  "core": true,
5
6
  "difficulty": 1,
6
7
  "slug": "hello-world",
@@ -42,9 +43,9 @@
42
43
  "slug": "word-count",
43
44
  "topics": [
44
45
  "control_flow_loops",
45
- "regular_expressions",
46
+ "lists",
46
47
  "maps",
47
- "lists"
48
+ "regular_expressions"
48
49
  ],
49
50
  "unlocked_by": "difference-of-squares",
50
51
  "uuid": "b74dde02-03d0-4165-8302-e8ba119b486b"
@@ -11,7 +11,7 @@
11
11
  "show_on_website": false
12
12
  },
13
13
  {
14
- "avatar_url": "https://avatars0.githubusercontent.com/u/7527155?v=4&s=460",
14
+ "avatar_url": "https://avatars0.githubusercontent.com/u/7527155?v=4\u0026s=460",
15
15
  "bio": null,
16
16
  "github_username": "Stargator",
17
17
  "link_text": null,
@@ -20,7 +20,7 @@
20
20
  "show_on_website": true
21
21
  },
22
22
  {
23
- "avatar_url": "https://avatars3.githubusercontent.com/u/190414?v=4&s=460",
23
+ "avatar_url": "https://avatars3.githubusercontent.com/u/190414?v=4\u0026s=460",
24
24
  "bio": null,
25
25
  "github_username": "fwip",
26
26
  "link_text": null,
@@ -29,7 +29,7 @@
29
29
  "show_on_website": false
30
30
  },
31
31
  {
32
- "avatar_url": "https://avatars1.githubusercontent.com/u/18462563?v=4&s=460",
32
+ "avatar_url": "https://avatars1.githubusercontent.com/u/18462563?v=4\u0026s=460",
33
33
  "bio": null,
34
34
  "github_username": "kabiir",
35
35
  "link_text": null,
@@ -8,17 +8,20 @@ function isArmstrongNumber(aNumber: integer): Boolean;
8
8
  implementation
9
9
 
10
10
  function isArmstrongNumber(aNumber: integer): Boolean;
11
- var wrkString: string;
12
- Exponent: integer;
13
- wrkInteger: integer;
14
- i: integer;
11
+ var
12
+ wrkNumber: integer;
13
+ Calculation: integer;
14
+ valLength: integer;
15
15
  begin
16
- wrkString := aNumber.ToString;
17
- Exponent := length(wrkString);
18
- wrkInteger := 0;
19
- for i := low(wrkString) to high(wrkString) do
20
- wrkInteger := wrkInteger + trunc(Power(string.ToInteger(wrkString[i]), Exponent));
21
- result := wrkInteger = aNumber;
16
+ wrkNumber := aNumber;
17
+ Calculation := 0;
18
+ valLength := aNumber.ToString.Length;
19
+ while wrkNumber > 0 do
20
+ begin
21
+ Calculation := Calculation + trunc(IntPower((wrkNumber mod 10), valLength));
22
+ wrkNumber := wrkNumber div 10;
23
+ end;
24
+ result := aNumber = Calculation;
22
25
  end;
23
26
 
24
27
  end.
@@ -4,12 +4,15 @@ interface
4
4
  uses
5
5
  DUnitX.TestFramework;
6
6
 
7
+ const
8
+ CanonicalVersion = '1.1.0';
9
+
7
10
  type
8
11
  [TestFixture]
9
12
  RnaTranscriptionTest = class(TObject)
10
13
  public
11
14
  [Test]
12
- // [Ignore('Comment the "[Ignore]" statement to run the test')]
15
+ // [Ignore('Comment the "[Ignore]" statement to run the test')]
13
16
  procedure Rna_complement_of_cytosine_is_guanine;
14
17
 
15
18
  [Test]
@@ -27,18 +30,6 @@ type
27
30
  [Test]
28
31
  [Ignore]
29
32
  procedure Rna_complement;
30
-
31
- [Test]
32
- [Ignore]
33
- procedure Dna_correctly_handles_invalid_input;
34
-
35
- [Test]
36
- [Ignore]
37
- procedure Dna_correctly_handles_completely_invalid_input;
38
-
39
- [Test]
40
- [Ignore]
41
- procedure Dna_correctly_handles_partially_invalid_input;
42
33
  end;
43
34
 
44
35
  implementation
@@ -69,21 +60,6 @@ begin
69
60
  Assert.AreEqual('UGCACCAGAAUU', complement.OfDna('ACGTGGTCTTAA'));
70
61
  end;
71
62
 
72
- procedure RnaTranscriptionTest.Dna_correctly_handles_invalid_input;
73
- begin
74
- Assert.AreEqual('', complement.OfDna('U'));
75
- end;
76
-
77
- procedure RnaTranscriptionTest.Dna_correctly_handles_completely_invalid_input;
78
- begin
79
- Assert.AreEqual('', complement.OfDna('XXX'));
80
- end;
81
-
82
- procedure RnaTranscriptionTest.Dna_correctly_handles_partially_invalid_input;
83
- begin
84
- Assert.AreEqual('', complement.OfDna('ACGTXXXCTTAA'));
85
- end;
86
-
87
63
  initialization
88
64
  TDUnitX.RegisterTestFixture(RnaTranscriptionTest);
89
65
  end.