trackler 2.2.1.13 → 2.2.1.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/change/canonical-data.json +8 -1
  4. data/tracks/csharp/config.json +25 -26
  5. data/tracks/csharp/docs/SNIPPET.txt +7 -0
  6. data/tracks/csharp/exercises/house/Example.cs +5 -5
  7. data/tracks/csharp/exercises/house/House.cs +6 -1
  8. data/tracks/csharp/exercises/house/HouseTest.cs +208 -5
  9. data/tracks/csharp/exercises/phone-number/Example.cs +2 -1
  10. data/tracks/csharp/exercises/phone-number/PhoneNumberTest.cs +8 -7
  11. data/tracks/csharp/exercises/rna-transcription/Example.cs +2 -1
  12. data/tracks/csharp/exercises/rna-transcription/RnaTranscriptionTest.cs +4 -3
  13. data/tracks/csharp/exercises/say/SayTest.cs +20 -24
  14. data/tracks/csharp/exercises/sieve/Example.cs +6 -0
  15. data/tracks/csharp/exercises/sieve/SieveTest.cs +25 -17
  16. data/tracks/csharp/exercises/space-age/SpaceAgeTest.cs +19 -24
  17. data/tracks/csharp/exercises/sum-of-multiples/Example.cs +1 -1
  18. data/tracks/csharp/exercises/sum-of-multiples/SumOfMultiples.cs +1 -1
  19. data/tracks/csharp/exercises/sum-of-multiples/SumOfMultiplesTest.cs +48 -16
  20. data/tracks/csharp/generators/Exercises/House.cs +16 -0
  21. data/tracks/csharp/generators/Exercises/PhoneNumber.cs +3 -1
  22. data/tracks/csharp/generators/Exercises/RnaTranscription.cs +11 -1
  23. data/tracks/csharp/generators/Exercises/Say.cs +22 -0
  24. data/tracks/csharp/generators/Exercises/Sieve.cs +17 -0
  25. data/tracks/csharp/generators/Exercises/SpaceAge.cs +25 -0
  26. data/tracks/csharp/generators/Exercises/SumOfMultiples.cs +22 -0
  27. data/tracks/csharp/generators/Output/ValueFormatter.cs +4 -0
  28. data/tracks/dart/docs/ABOUT.md +21 -0
  29. data/tracks/ecmascript/README.md +1 -1
  30. data/tracks/ecmascript/config.json +15 -0
  31. data/tracks/ecmascript/exercises/proverb/README.md +63 -0
  32. data/tracks/ecmascript/exercises/proverb/example.js +23 -0
  33. data/tracks/ecmascript/exercises/proverb/package.json +69 -0
  34. data/tracks/ecmascript/exercises/proverb/proverb.spec.js +70 -0
  35. data/tracks/go/config.json +226 -226
  36. data/tracks/groovy/config.json +11 -0
  37. data/tracks/groovy/exercises/two-fer/Example.groovy +6 -0
  38. data/tracks/groovy/exercises/two-fer/README.md +62 -0
  39. data/tracks/groovy/exercises/two-fer/TwoFer.groovy +6 -0
  40. data/tracks/groovy/exercises/two-fer/TwoFerSpec.groovy +24 -0
  41. data/tracks/java/.travis.yml +2 -2
  42. data/tracks/java/bin/journey-test.sh +44 -1
  43. data/tracks/java/bin/run-journey-test-from-ci.sh +28 -0
  44. data/tracks/java/{docs/EXERCISE_README_INSERT.md → config/exercise-readme-insert.md} +0 -0
  45. data/tracks/java/exercises/bank-account/{HINTS.md → .meta/hints.md} +0 -0
  46. data/tracks/java/exercises/change/src/test/java/ChangeCalculatorTest.java +27 -2
  47. data/tracks/java/exercises/clock/{HINTS.md → .meta/hints.md} +0 -0
  48. data/tracks/java/exercises/hamming/{HINTS.md → .meta/hints.md} +0 -0
  49. data/tracks/java/exercises/hello-world/{HINTS.md → .meta/hints.md} +0 -0
  50. data/tracks/java/exercises/isogram/{HINTS.md → .meta/hints.md} +0 -0
  51. data/tracks/java/exercises/list-ops/{HINTS.md → .meta/hints.md} +0 -0
  52. data/tracks/java/exercises/pig-latin/src/example/java/PigLatinTranslator.java +17 -20
  53. data/tracks/java/exercises/simple-cipher/{HINTS.md → .meta/hints.md} +0 -0
  54. data/tracks/java/exercises/two-fer/{HINTS.md → .meta/hints.md} +0 -0
  55. data/tracks/kotlin/{docs/EXERCISE_README_INSERT.md → config/exercise-readme-insert.md} +0 -0
  56. data/tracks/kotlin/exercises/accumulate/README.md +1 -4
  57. data/tracks/kotlin/exercises/acronym/README.md +1 -1
  58. data/tracks/kotlin/exercises/all-your-base/README.md +1 -1
  59. data/tracks/kotlin/exercises/allergies/README.md +1 -1
  60. data/tracks/kotlin/exercises/anagram/README.md +1 -1
  61. data/tracks/kotlin/exercises/atbash-cipher/README.md +1 -1
  62. data/tracks/kotlin/exercises/bank-account/README.md +1 -1
  63. data/tracks/kotlin/exercises/beer-song/README.md +1 -1
  64. data/tracks/kotlin/exercises/binary-search/README.md +1 -1
  65. data/tracks/kotlin/exercises/binary/README.md +1 -1
  66. data/tracks/kotlin/exercises/bob/README.md +1 -1
  67. data/tracks/kotlin/exercises/bracket-push/README.md +1 -1
  68. data/tracks/kotlin/exercises/change/README.md +1 -1
  69. data/tracks/kotlin/exercises/clock/README.md +1 -1
  70. data/tracks/kotlin/exercises/collatz-conjecture/README.md +1 -1
  71. data/tracks/kotlin/exercises/complex-numbers/README.md +1 -1
  72. data/tracks/kotlin/exercises/diamond/README.md +1 -1
  73. data/tracks/kotlin/exercises/difference-of-squares/README.md +1 -1
  74. data/tracks/kotlin/exercises/etl/README.md +1 -1
  75. data/tracks/kotlin/exercises/flatten-array/README.md +1 -1
  76. data/tracks/kotlin/exercises/gigasecond/README.md +1 -1
  77. data/tracks/kotlin/exercises/grade-school/README.md +1 -1
  78. data/tracks/kotlin/exercises/grains/README.md +1 -1
  79. data/tracks/kotlin/exercises/hamming/README.md +1 -1
  80. data/tracks/kotlin/exercises/hello-world/README.md +1 -1
  81. data/tracks/kotlin/exercises/hexadecimal/README.md +1 -1
  82. data/tracks/kotlin/exercises/isogram/README.md +1 -1
  83. data/tracks/kotlin/exercises/largest-series-product/README.md +1 -1
  84. data/tracks/kotlin/exercises/leap/README.md +1 -1
  85. data/tracks/kotlin/exercises/linked-list/README.md +1 -1
  86. data/tracks/kotlin/exercises/list-ops/{HINTS.md → .meta/hints.md} +0 -0
  87. data/tracks/kotlin/exercises/list-ops/README.md +1 -1
  88. data/tracks/kotlin/exercises/luhn/README.md +1 -1
  89. data/tracks/kotlin/exercises/minesweeper/README.md +1 -1
  90. data/tracks/kotlin/exercises/nth-prime/README.md +1 -1
  91. data/tracks/kotlin/exercises/nucleotide-count/README.md +1 -1
  92. data/tracks/kotlin/exercises/pangram/README.md +1 -1
  93. data/tracks/kotlin/exercises/pascals-triangle/README.md +1 -1
  94. data/tracks/kotlin/exercises/perfect-numbers/README.md +1 -1
  95. data/tracks/kotlin/exercises/phone-number/README.md +1 -1
  96. data/tracks/kotlin/exercises/pig-latin/README.md +1 -1
  97. data/tracks/kotlin/exercises/prime-factors/README.md +1 -1
  98. data/tracks/kotlin/exercises/raindrops/README.md +1 -1
  99. data/tracks/kotlin/exercises/react/README.md +1 -1
  100. data/tracks/kotlin/exercises/rna-transcription/README.md +1 -1
  101. data/tracks/kotlin/exercises/robot-name/README.md +1 -1
  102. data/tracks/kotlin/exercises/robot-simulator/README.md +1 -1
  103. data/tracks/kotlin/exercises/roman-numerals/README.md +1 -1
  104. data/tracks/kotlin/exercises/saddle-points/README.md +1 -1
  105. data/tracks/kotlin/exercises/scrabble-score/README.md +1 -1
  106. data/tracks/kotlin/exercises/secret-handshake/README.md +1 -1
  107. data/tracks/kotlin/exercises/series/README.md +1 -1
  108. data/tracks/kotlin/exercises/sieve/README.md +1 -1
  109. data/tracks/kotlin/exercises/simple-cipher/README.md +2 -2
  110. data/tracks/kotlin/exercises/space-age/README.md +3 -2
  111. data/tracks/kotlin/exercises/spiral-matrix/README.md +1 -1
  112. data/tracks/kotlin/exercises/strain/README.md +1 -1
  113. data/tracks/kotlin/exercises/sublist/README.md +1 -1
  114. data/tracks/kotlin/exercises/sum-of-multiples/README.md +1 -1
  115. data/tracks/kotlin/exercises/triangle/README.md +1 -1
  116. data/tracks/kotlin/exercises/word-count/README.md +1 -1
  117. data/tracks/pony/exercises/atbash-cipher/example.pony +4 -3
  118. data/tracks/pony/exercises/beer-song/example.pony +10 -9
  119. data/tracks/pony/exercises/bob/example.pony +1 -1
  120. data/tracks/pony/exercises/difference-of-squares/example.pony +2 -2
  121. data/tracks/pony/exercises/hamming/example.pony +1 -1
  122. data/tracks/pony/exercises/hamming/test.pony +2 -2
  123. data/tracks/pony/exercises/leap/example.pony +1 -1
  124. data/tracks/pony/exercises/pascals-triangle/example.pony +2 -2
  125. data/tracks/pony/exercises/rna-transcription/test.pony +2 -2
  126. data/tracks/pony/exercises/roman-numerals/test.pony +2 -2
  127. data/tracks/python/config.json +22 -0
  128. data/tracks/python/docs/ABOUT.md +11 -3
  129. data/tracks/python/exercises/collatz-conjecture/README.md +61 -0
  130. data/tracks/python/exercises/collatz-conjecture/collatz_conjecture.py +2 -0
  131. data/tracks/python/exercises/collatz-conjecture/collatz_conjecture_test.py +32 -0
  132. data/tracks/python/exercises/collatz-conjecture/example.py +17 -0
  133. data/tracks/python/exercises/isogram/isogram.py +1 -1
  134. data/tracks/python/exercises/isogram/isogram_test.py +3 -0
  135. data/tracks/python/exercises/scale-generator/example.py +2 -0
  136. data/tracks/python/exercises/scale-generator/scale_generator_test.py +4 -0
  137. data/tracks/python/exercises/two-fer/README.md +29 -0
  138. data/tracks/python/exercises/two-fer/example.py +5 -0
  139. data/tracks/python/exercises/two-fer/two_fer.py +2 -0
  140. data/tracks/python/exercises/two-fer/two_fer_test.py +18 -0
  141. data/tracks/r/config/maintainers.json +2 -2
  142. data/tracks/ruby/config.json +2 -1
  143. data/tracks/scala/exercises/minesweeper/src/test/scala/MinesweeperTest.scala +85 -36
  144. data/tracks/scala/testgen/src/main/scala/MinesweeperTestGenerator.scala +15 -0
  145. data/tracks/vimscript/README.md +1 -1
  146. metadata +37 -13
@@ -1,3 +1,4 @@
1
+ using System;
1
2
  using System.Linq;
2
3
  using System.Text.RegularExpressions;
3
4
 
@@ -17,7 +18,7 @@ public static string Clean(string phoneNumber)
17
18
  }
18
19
  else
19
20
  {
20
- return null;
21
+ throw new ArgumentException("invalid phone number");
21
22
  }
22
23
  }
23
24
  }
@@ -1,6 +1,7 @@
1
1
  // This file was auto-generated based on version 1.2.0 of the canonical data.
2
2
 
3
3
  using Xunit;
4
+ using System;
4
5
 
5
6
  public class PhoneNumberTest
6
7
  {
@@ -29,14 +30,14 @@ public void Cleans_numbers_with_multiple_spaces()
29
30
  public void Invalid_when_9_digits()
30
31
  {
31
32
  var phrase = "123456789";
32
- Assert.Null(PhoneNumber.Clean(phrase));
33
+ Assert.Throws<ArgumentException>(() => PhoneNumber.Clean(phrase));
33
34
  }
34
35
 
35
36
  [Fact(Skip = "Remove to run test")]
36
37
  public void Invalid_when_11_digits_does_not_start_with_a_1()
37
38
  {
38
39
  var phrase = "22234567890";
39
- Assert.Null(PhoneNumber.Clean(phrase));
40
+ Assert.Throws<ArgumentException>(() => PhoneNumber.Clean(phrase));
40
41
  }
41
42
 
42
43
  [Fact(Skip = "Remove to run test")]
@@ -57,34 +58,34 @@ public void Valid_when_11_digits_and_starting_with_1_even_with_punctuation()
57
58
  public void Invalid_when_more_than_11_digits()
58
59
  {
59
60
  var phrase = "321234567890";
60
- Assert.Null(PhoneNumber.Clean(phrase));
61
+ Assert.Throws<ArgumentException>(() => PhoneNumber.Clean(phrase));
61
62
  }
62
63
 
63
64
  [Fact(Skip = "Remove to run test")]
64
65
  public void Invalid_with_letters()
65
66
  {
66
67
  var phrase = "123-abc-7890";
67
- Assert.Null(PhoneNumber.Clean(phrase));
68
+ Assert.Throws<ArgumentException>(() => PhoneNumber.Clean(phrase));
68
69
  }
69
70
 
70
71
  [Fact(Skip = "Remove to run test")]
71
72
  public void Invalid_with_punctuations()
72
73
  {
73
74
  var phrase = "123-@:!-7890";
74
- Assert.Null(PhoneNumber.Clean(phrase));
75
+ Assert.Throws<ArgumentException>(() => PhoneNumber.Clean(phrase));
75
76
  }
76
77
 
77
78
  [Fact(Skip = "Remove to run test")]
78
79
  public void Invalid_if_area_code_does_not_start_with_2_9()
79
80
  {
80
81
  var phrase = "(123) 456-7890";
81
- Assert.Null(PhoneNumber.Clean(phrase));
82
+ Assert.Throws<ArgumentException>(() => PhoneNumber.Clean(phrase));
82
83
  }
83
84
 
84
85
  [Fact(Skip = "Remove to run test")]
85
86
  public void Invalid_if_exchange_code_does_not_start_with_2_9()
86
87
  {
87
88
  var phrase = "(223) 056-7890";
88
- Assert.Null(PhoneNumber.Clean(phrase));
89
+ Assert.Throws<ArgumentException>(() => PhoneNumber.Clean(phrase));
89
90
  }
90
91
  }
@@ -1,3 +1,4 @@
1
+ using System;
1
2
  using System.Collections.Generic;
2
3
  using System.Linq;
3
4
 
@@ -12,7 +13,7 @@ public static string ToRna(string nucleotide)
12
13
  {
13
14
  if (nucleotide.Any(x => !DnaToRna.ContainsKey(x)))
14
15
  {
15
- return null;
16
+ throw new ArgumentException("invalid nucleotide");
16
17
  }
17
18
 
18
19
  return string.Concat(nucleotide.Select(x => DnaToRna[x]));
@@ -1,6 +1,7 @@
1
1
  // This file was auto-generated based on version 1.0.1 of the canonical data.
2
2
 
3
3
  using Xunit;
4
+ using System;
4
5
 
5
6
  public class RnaTranscriptionTest
6
7
  {
@@ -37,18 +38,18 @@ public void Rna_complement()
37
38
  [Fact(Skip = "Remove to run test")]
38
39
  public void Correctly_handles_invalid_input_rna_instead_of_dna_()
39
40
  {
40
- Assert.Null(RnaTranscription.ToRna("U"));
41
+ Assert.Throws<ArgumentException>(() => RnaTranscription.ToRna("U"));
41
42
  }
42
43
 
43
44
  [Fact(Skip = "Remove to run test")]
44
45
  public void Correctly_handles_completely_invalid_dna_input()
45
46
  {
46
- Assert.Null(RnaTranscription.ToRna("XXX"));
47
+ Assert.Throws<ArgumentException>(() => RnaTranscription.ToRna("XXX"));
47
48
  }
48
49
 
49
50
  [Fact(Skip = "Remove to run test")]
50
51
  public void Correctly_handles_partially_invalid_dna_input()
51
52
  {
52
- Assert.Null(RnaTranscription.ToRna("ACGTXXXCTTAA"));
53
+ Assert.Throws<ArgumentException>(() => RnaTranscription.ToRna("ACGTXXXCTTAA"));
53
54
  }
54
55
  }
@@ -1,101 +1,97 @@
1
- using System;
1
+ // This file was auto-generated based on version 1.0.0 of the canonical data.
2
+
2
3
  using Xunit;
4
+ using System;
3
5
 
4
6
  public class SayTest
5
7
  {
6
8
  [Fact]
7
9
  public void Zero()
8
10
  {
9
- Assert.Equal("zero", Say.InEnglish(0L));
11
+ Assert.Equal("zero", Say.InEnglish(0));
10
12
  }
11
13
 
12
14
  [Fact(Skip = "Remove to run test")]
13
15
  public void One()
14
16
  {
15
- Assert.Equal("one", Say.InEnglish(1L));
17
+ Assert.Equal("one", Say.InEnglish(1));
16
18
  }
17
19
 
18
20
  [Fact(Skip = "Remove to run test")]
19
21
  public void Fourteen()
20
22
  {
21
- Assert.Equal("fourteen", Say.InEnglish(14L));
23
+ Assert.Equal("fourteen", Say.InEnglish(14));
22
24
  }
23
25
 
24
26
  [Fact(Skip = "Remove to run test")]
25
27
  public void Twenty()
26
28
  {
27
- Assert.Equal("twenty", Say.InEnglish(20L));
29
+ Assert.Equal("twenty", Say.InEnglish(20));
28
30
  }
29
31
 
30
32
  [Fact(Skip = "Remove to run test")]
31
33
  public void Twenty_two()
32
34
  {
33
- Assert.Equal("twenty-two", Say.InEnglish(22L));
35
+ Assert.Equal("twenty-two", Say.InEnglish(22));
34
36
  }
35
37
 
36
38
  [Fact(Skip = "Remove to run test")]
37
39
  public void One_hundred()
38
40
  {
39
- Assert.Equal("one hundred", Say.InEnglish(100L));
41
+ Assert.Equal("one hundred", Say.InEnglish(100));
40
42
  }
41
43
 
42
44
  [Fact(Skip = "Remove to run test")]
43
45
  public void One_hundred_twenty_three()
44
46
  {
45
- Assert.Equal("one hundred twenty-three", Say.InEnglish(123L));
47
+ Assert.Equal("one hundred twenty-three", Say.InEnglish(123));
46
48
  }
47
49
 
48
50
  [Fact(Skip = "Remove to run test")]
49
51
  public void One_thousand()
50
52
  {
51
- Assert.Equal("one thousand", Say.InEnglish(1000L));
53
+ Assert.Equal("one thousand", Say.InEnglish(1000));
52
54
  }
53
55
 
54
56
  [Fact(Skip = "Remove to run test")]
55
57
  public void One_thousand_two_hundred_thirty_four()
56
58
  {
57
- Assert.Equal("one thousand two hundred thirty-four", Say.InEnglish(1234L));
59
+ Assert.Equal("one thousand two hundred thirty-four", Say.InEnglish(1234));
58
60
  }
59
61
 
60
62
  [Fact(Skip = "Remove to run test")]
61
63
  public void One_million()
62
64
  {
63
- Assert.Equal("one million", Say.InEnglish(1000000L));
64
- }
65
-
66
- [Fact(Skip = "Remove to run test")]
67
- public void One_million_two()
68
- {
69
- Assert.Equal("one million two", Say.InEnglish(1000002L));
65
+ Assert.Equal("one million", Say.InEnglish(1000000));
70
66
  }
71
67
 
72
68
  [Fact(Skip = "Remove to run test")]
73
69
  public void One_million_two_thousand_three_hundred_forty_five()
74
70
  {
75
- Assert.Equal("one million two thousand three hundred forty-five", Say.InEnglish(1002345L));
71
+ Assert.Equal("one million two thousand three hundred forty-five", Say.InEnglish(1002345));
76
72
  }
77
73
 
78
74
  [Fact(Skip = "Remove to run test")]
79
75
  public void One_billion()
80
76
  {
81
- Assert.Equal("one billion", Say.InEnglish(1000000000L));
77
+ Assert.Equal("one billion", Say.InEnglish(1000000000));
82
78
  }
83
79
 
84
80
  [Fact(Skip = "Remove to run test")]
85
81
  public void A_big_number()
86
82
  {
87
- Assert.Equal("nine hundred eighty-seven billion six hundred fifty-four million three hundred twenty-one thousand one hundred twenty-three", Say.InEnglish(987654321123L));
83
+ Assert.Equal("nine hundred eighty-seven billion six hundred fifty-four million three hundred twenty-one thousand one hundred twenty-three", Say.InEnglish(987654321123));
88
84
  }
89
85
 
90
86
  [Fact(Skip = "Remove to run test")]
91
- public void Lower_bound()
87
+ public void Numbers_below_zero_are_out_of_range()
92
88
  {
93
- Assert.Throws<ArgumentOutOfRangeException>(() => Say.InEnglish(-1L));
89
+ Assert.Throws<ArgumentOutOfRangeException>(() => Say.InEnglish(-1));
94
90
  }
95
91
 
96
92
  [Fact(Skip = "Remove to run test")]
97
- public void Upper_bound()
93
+ public void Numbers_above_999_999_999_999_are_out_of_range()
98
94
  {
99
- Assert.Throws<ArgumentOutOfRangeException>(() => Say.InEnglish(1000000000000L));
95
+ Assert.Throws<ArgumentOutOfRangeException>(() => Say.InEnglish(1000000000000));
100
96
  }
101
97
  }
@@ -1,3 +1,4 @@
1
+ using System;
1
2
  using System.Collections.Generic;
2
3
  using System.Linq;
3
4
 
@@ -10,6 +11,11 @@ public static int[] Primes(int limit)
10
11
 
11
12
  private static int[] InitializePrimes(int limit)
12
13
  {
14
+ if (limit < 2)
15
+ {
16
+ throw new ArgumentOutOfRangeException(nameof(limit));
17
+ }
18
+
13
19
  var candidates = new Queue<int>(Enumerable.Range(2, limit - 1));
14
20
  var primes = new List<int>();
15
21
  do
@@ -1,33 +1,41 @@
1
+ // This file was auto-generated based on version 1.0.0 of the canonical data.
2
+
1
3
  using Xunit;
4
+ using System;
2
5
 
3
6
  public class SieveTest
4
7
  {
5
8
  [Fact]
6
- public void Finds_first_prime()
9
+ public void No_primes_under_two()
10
+ {
11
+ Assert.Throws<ArgumentOutOfRangeException>(() => Sieve.Primes(1));
12
+ }
13
+
14
+ [Fact(Skip = "Remove to run test")]
15
+ public void Find_first_prime()
16
+ {
17
+ var expected = new[] { 2 };
18
+ Assert.Equal(expected, Sieve.Primes(2));
19
+ }
20
+
21
+ [Fact(Skip = "Remove to run test")]
22
+ public void Find_primes_up_to_10()
7
23
  {
8
- Assert.Equal(new[] { 2 }, Sieve.Primes(2));
24
+ var expected = new[] { 2, 3, 5, 7 };
25
+ Assert.Equal(expected, Sieve.Primes(10));
9
26
  }
10
27
 
11
28
  [Fact(Skip = "Remove to run test")]
12
- public void Finds_primes_up_to_10()
29
+ public void Limit_is_prime()
13
30
  {
14
- Assert.Equal(new[] { 2, 3, 5, 7 }, Sieve.Primes(10));
31
+ var expected = new[] { 2, 3, 5, 7, 11, 13 };
32
+ Assert.Equal(expected, Sieve.Primes(13));
15
33
  }
16
34
 
17
35
  [Fact(Skip = "Remove to run test")]
18
- public void Finds_primes_up_to_1000()
36
+ public void Find_primes_up_to_1000()
19
37
  {
20
- Assert.Equal(new[]
21
- {
22
- 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
23
- 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199,
24
- 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,
25
- 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443,
26
- 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577,
27
- 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
28
- 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839,
29
- 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983,
30
- 991, 997
31
- }, Sieve.Primes(1000));
38
+ var expected = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997 };
39
+ Assert.Equal(expected, Sieve.Primes(1000));
32
40
  }
33
41
  }
@@ -1,67 +1,62 @@
1
+ // This file was auto-generated based on version 1.0.0 of the canonical data.
2
+
1
3
  using Xunit;
2
4
 
3
5
  public class SpaceAgeTest
4
6
  {
5
- [Fact(Skip = "Remove to run test")]
7
+ [Fact]
6
8
  public void Age_on_earth()
7
9
  {
8
- var age = new SpaceAge(1000000000);
9
- Assert.Equal(31.69, age.OnEarth());
10
+ var sut = new SpaceAge(1000000000);
11
+ Assert.Equal(31.69, sut.OnEarth());
10
12
  }
11
13
 
12
14
  [Fact(Skip = "Remove to run test")]
13
15
  public void Age_on_mercury()
14
16
  {
15
- var age = new SpaceAge(2134835688);
16
- Assert.Equal(67.65, age.OnEarth());
17
- Assert.Equal(280.88, age.OnMercury());
17
+ var sut = new SpaceAge(2134835688);
18
+ Assert.Equal(280.88, sut.OnMercury());
18
19
  }
19
20
 
20
21
  [Fact(Skip = "Remove to run test")]
21
22
  public void Age_on_venus()
22
23
  {
23
- var age = new SpaceAge(189839836);
24
- Assert.Equal(6.02, age.OnEarth());
25
- Assert.Equal(9.78, age.OnVenus());
24
+ var sut = new SpaceAge(189839836);
25
+ Assert.Equal(9.78, sut.OnVenus());
26
26
  }
27
27
 
28
28
  [Fact(Skip = "Remove to run test")]
29
29
  public void Age_on_mars()
30
30
  {
31
- var age = new SpaceAge(2329871239);
32
- Assert.Equal(73.83, age.OnEarth());
33
- Assert.Equal(39.25, age.OnMars());
31
+ var sut = new SpaceAge(2329871239);
32
+ Assert.Equal(39.25, sut.OnMars());
34
33
  }
35
34
 
36
35
  [Fact(Skip = "Remove to run test")]
37
36
  public void Age_on_jupiter()
38
37
  {
39
- var age = new SpaceAge(901876382);
40
- Assert.Equal(28.58, age.OnEarth());
41
- Assert.Equal(2.41, age.OnJupiter());
38
+ var sut = new SpaceAge(901876382);
39
+ Assert.Equal(2.41, sut.OnJupiter());
42
40
  }
43
41
 
44
42
  [Fact(Skip = "Remove to run test")]
45
43
  public void Age_on_saturn()
46
44
  {
47
- var age = new SpaceAge(3000000000);
48
- Assert.Equal(95.06, age.OnEarth());
49
- Assert.Equal(3.23, age.OnSaturn());
45
+ var sut = new SpaceAge(3000000000);
46
+ Assert.Equal(3.23, sut.OnSaturn());
50
47
  }
51
48
 
52
49
  [Fact(Skip = "Remove to run test")]
53
50
  public void Age_on_uranus()
54
51
  {
55
- var age = new SpaceAge(3210123456);
56
- Assert.Equal(101.72, age.OnEarth());
57
- Assert.Equal(1.21, age.OnUranus());
52
+ var sut = new SpaceAge(3210123456);
53
+ Assert.Equal(1.21, sut.OnUranus());
58
54
  }
59
55
 
60
56
  [Fact(Skip = "Remove to run test")]
61
57
  public void Age_on_neptune()
62
58
  {
63
- var age = new SpaceAge(8210123456);
64
- Assert.Equal(260.16, age.OnEarth());
65
- Assert.Equal(1.58, age.OnNeptune());
59
+ var sut = new SpaceAge(8210123456);
60
+ Assert.Equal(1.58, sut.OnNeptune());
66
61
  }
67
62
  }
@@ -3,7 +3,7 @@
3
3
 
4
4
  public static class SumOfMultiples
5
5
  {
6
- public static int To(IEnumerable<int> multiples, int max)
6
+ public static int Sum(IEnumerable<int> multiples, int max)
7
7
  {
8
8
  return Enumerable.Range(1, max - 1)
9
9
  .Where(i => multiples.Any(m => i % m == 0))
@@ -3,7 +3,7 @@
3
3
 
4
4
  public static class SumOfMultiples
5
5
  {
6
- public static int To(IEnumerable<int> multiples, int max)
6
+ public static int Sum(IEnumerable<int> multiples, int max)
7
7
  {
8
8
  throw new NotImplementedException("You need to implement this function.");
9
9
  }
@@ -1,46 +1,78 @@
1
- using Xunit;
1
+ // This file was auto-generated based on version 1.0.0 of the canonical data.
2
+
3
+ using Xunit;
2
4
 
3
5
  public class SumOfMultiplesTest
4
6
  {
5
7
  [Fact]
6
- public void Sum_to_1()
8
+ public void Multiples_of_3_or_5_up_to_1()
9
+ {
10
+ Assert.Equal(0, SumOfMultiples.Sum(new[] { 3, 5 }, 1));
11
+ }
12
+
13
+ [Fact(Skip = "Remove to run test")]
14
+ public void Multiples_of_3_or_5_up_to_4()
15
+ {
16
+ Assert.Equal(3, SumOfMultiples.Sum(new[] { 3, 5 }, 4));
17
+ }
18
+
19
+ [Fact(Skip = "Remove to run test")]
20
+ public void Multiples_of_3_or_5_up_to_10()
21
+ {
22
+ Assert.Equal(23, SumOfMultiples.Sum(new[] { 3, 5 }, 10));
23
+ }
24
+
25
+ [Fact(Skip = "Remove to run test")]
26
+ public void Multiples_of_3_or_5_up_to_100()
27
+ {
28
+ Assert.Equal(2318, SumOfMultiples.Sum(new[] { 3, 5 }, 100));
29
+ }
30
+
31
+ [Fact(Skip = "Remove to run test")]
32
+ public void Multiples_of_3_or_5_up_to_1000()
33
+ {
34
+ Assert.Equal(233168, SumOfMultiples.Sum(new[] { 3, 5 }, 1000));
35
+ }
36
+
37
+ [Fact(Skip = "Remove to run test")]
38
+ public void Multiples_of_7_13_or_17_up_to_20()
7
39
  {
8
- Assert.Equal(0, SumOfMultiples.To(new[] { 3, 5 }, 1));
40
+ Assert.Equal(51, SumOfMultiples.Sum(new[] { 7, 13, 17 }, 20));
9
41
  }
10
42
 
11
43
  [Fact(Skip = "Remove to run test")]
12
- public void Sum_to_3()
44
+ public void Multiples_of_4_or_6_up_to_15()
13
45
  {
14
- Assert.Equal(3, SumOfMultiples.To(new[] { 3, 5 }, 4));
46
+ Assert.Equal(30, SumOfMultiples.Sum(new[] { 4, 6 }, 15));
15
47
  }
16
48
 
17
49
  [Fact(Skip = "Remove to run test")]
18
- public void Sum_to_10()
50
+ public void Multiples_of_5_6_or_8_up_to_150()
19
51
  {
20
- Assert.Equal(23, SumOfMultiples.To(new[] { 3, 5 }, 10));
52
+ Assert.Equal(4419, SumOfMultiples.Sum(new[] { 5, 6, 8 }, 150));
21
53
  }
22
54
 
23
55
  [Fact(Skip = "Remove to run test")]
24
- public void Sum_to_100()
56
+ public void Multiples_of_5_or_25_up_to_51()
25
57
  {
26
- Assert.Equal(2318, SumOfMultiples.To(new[] { 3, 5 }, 100));
58
+ Assert.Equal(275, SumOfMultiples.Sum(new[] { 5, 25 }, 51));
27
59
  }
28
60
 
29
61
  [Fact(Skip = "Remove to run test")]
30
- public void Sum_to_1000()
62
+ public void Multiples_of_43_or_47_up_to_10000()
31
63
  {
32
- Assert.Equal(233168, SumOfMultiples.To(new[] { 3, 5 }, 1000));
64
+ Assert.Equal(2203160, SumOfMultiples.Sum(new[] { 43, 47 }, 10000));
33
65
  }
34
66
 
35
67
  [Fact(Skip = "Remove to run test")]
36
- public void Sum_to_20()
68
+ public void Multiples_of_1_up_to_100()
37
69
  {
38
- Assert.Equal(51, SumOfMultiples.To(new [] { 7, 13, 17 }, 20));
70
+ Assert.Equal(4950, SumOfMultiples.Sum(new[] { 1 }, 100));
39
71
  }
40
72
 
41
73
  [Fact(Skip = "Remove to run test")]
42
- public void Sum_to_10000()
74
+ public void Multiples_of_an_empty_list_up_to_10000()
43
75
  {
44
- Assert.Equal(2203160, SumOfMultiples.To(new [] { 43, 47 }, 10000));
76
+ Assert.Equal(0, SumOfMultiples.Sum(new int[0], 10000));
45
77
  }
46
- }
78
+ }