trackler 2.0.8.24 → 2.0.8.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/config.json +9 -0
- data/tracks/c/exercises/nucleotide-count/makefile +15 -0
- data/tracks/c/exercises/nucleotide-count/src/example.c +43 -0
- data/tracks/c/exercises/nucleotide-count/src/example.h +6 -0
- data/tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c +58 -0
- data/tracks/c/exercises/nucleotide-count/test/vendor/unity.c +1300 -0
- data/tracks/c/exercises/nucleotide-count/test/vendor/unity.h +274 -0
- data/tracks/c/exercises/nucleotide-count/test/vendor/unity_internals.h +701 -0
- data/tracks/ceylon/README.md +2 -2
- data/tracks/csharp/.gitattributes +11 -0
- data/tracks/csharp/appveyor.yml +1 -4
- data/tracks/csharp/exercises/acronym/AcronymTest.cs +1 -1
- data/tracks/csharp/exercises/atbash-cipher/AtbashCipher.cs +8 -3
- data/tracks/csharp/exercises/atbash-cipher/AtbashCipherTest.cs +76 -0
- data/tracks/csharp/exercises/atbash-cipher/Example.cs +22 -23
- data/tracks/csharp/exercises/isogram/Example.cs +2 -2
- data/tracks/csharp/exercises/isogram/IsogramTest.cs +47 -15
- data/tracks/csharp/exercises/nth-prime/Example.cs +4 -1
- data/tracks/csharp/exercises/nth-prime/NthPrime.cs +1 -1
- data/tracks/csharp/exercises/nth-prime/NthPrimeTest.cs +29 -15
- data/tracks/csharp/exercises/perfect-numbers/Example.cs +14 -16
- data/tracks/csharp/exercises/perfect-numbers/PerfectNumbers.cs +2 -2
- data/tracks/csharp/exercises/perfect-numbers/PerfectNumbersTest.cs +78 -26
- data/tracks/csharp/exercises/pig-latin/PigLatinTest.cs +69 -24
- data/tracks/csharp/exercises/raindrops/Example.cs +1 -1
- data/tracks/csharp/exercises/raindrops/RaindropsTest.cs +93 -31
- data/tracks/csharp/exercises/roman-numerals/HINTS.md +2 -0
- data/tracks/csharp/exercises/roman-numerals/RomanNumeralsTest.cs +106 -23
- data/tracks/csharp/exercises/word-search/HINTS.md +6 -0
- data/tracks/csharp/generators/{TestClass.cs → Classes/TestClass.cs} +2 -1
- data/tracks/csharp/generators/{TestClassNameTransformer.cs → Classes/TestClassNameTransformer.cs} +1 -1
- data/tracks/csharp/generators/{TestClassRenderer.cs → Classes/TestClassRenderer.cs} +2 -1
- data/tracks/csharp/generators/Classes/TestedClassNameTransformer.cs +9 -0
- data/tracks/csharp/generators/{CanonicalData.cs → Data/CanonicalData.cs} +1 -1
- data/tracks/csharp/generators/{CanonicalDataCase.cs → Data/CanonicalDataCase.cs} +3 -3
- data/tracks/csharp/generators/{CanonicalDataCaseJsonConverter.cs → Data/CanonicalDataCaseJsonConverter.cs} +1 -1
- data/tracks/csharp/generators/{CanonicalDataCasesJsonConverter.cs → Data/CanonicalDataCasesJsonConverter.cs} +2 -2
- data/tracks/csharp/generators/{CanonicalDataParser.cs → Data/CanonicalDataParser.cs} +5 -5
- data/tracks/csharp/generators/{ExerciseCollection.cs → Data/ExerciseCollection.cs} +3 -3
- data/tracks/csharp/generators/Exercises/AcronymExercise.cs +20 -0
- data/tracks/csharp/generators/Exercises/AtbashCipherExercise.cs +20 -0
- data/tracks/csharp/generators/Exercises/BooleanExercise.cs +14 -0
- data/tracks/csharp/generators/Exercises/EqualityExercise.cs +14 -0
- data/tracks/csharp/generators/Exercises/Exercise.cs +59 -4
- data/tracks/csharp/generators/Exercises/IsogramExercise.cs +9 -0
- data/tracks/csharp/generators/Exercises/LeapExercise.cs +1 -4
- data/tracks/csharp/generators/Exercises/NthPrimeExercise.cs +25 -0
- data/tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs +29 -0
- data/tracks/csharp/generators/Exercises/PigLatinExercise.cs +9 -0
- data/tracks/csharp/generators/Exercises/RaindropsExercise.cs +20 -0
- data/tracks/csharp/generators/Exercises/RomanNumeralsExercise.cs +30 -0
- data/tracks/csharp/generators/Helpers/StringExtensions.cs +8 -0
- data/tracks/csharp/generators/{To.cs → Helpers/To.cs} +4 -1
- data/tracks/csharp/generators/Methods/BooleanTestMethodGenerator.cs +32 -0
- data/tracks/csharp/generators/Methods/EqualityTestMethodGenerator.cs +25 -0
- data/tracks/csharp/generators/Methods/ExceptionTestMethodGenerator.cs +30 -0
- data/tracks/csharp/generators/{TestMethod.cs → Methods/TestMethod.cs} +6 -3
- data/tracks/csharp/generators/Methods/TestMethodData.cs +12 -0
- data/tracks/csharp/generators/Methods/TestMethodGenerator.cs +64 -0
- data/tracks/csharp/generators/Methods/TestMethodNameTransformer.cs +23 -0
- data/tracks/csharp/generators/Methods/TestMethodOptions.cs +13 -0
- data/tracks/csharp/generators/{TestMethodRenderer.cs → Methods/TestMethodRenderer.cs} +1 -1
- data/tracks/csharp/generators/{TestedMethodNameTransformer.cs → Methods/TestedMethodNameTransformer.cs} +1 -1
- data/tracks/csharp/generators/Methods/TestedMethodType.cs +9 -0
- data/tracks/csharp/generators/Program.cs +2 -0
- data/tracks/elixir/config.json +7 -0
- data/tracks/elixir/exercises/diffie-hellman/HINTS.md +10 -0
- data/tracks/elixir/exercises/diffie-hellman/diffie_hellman.exs +61 -0
- data/tracks/elixir/exercises/diffie-hellman/diffie_hellman_test.exs +99 -0
- data/tracks/elixir/exercises/diffie-hellman/example.exs +64 -0
- data/tracks/haskell/exercises/pov/src/POV.hs +2 -2
- data/tracks/haskell/exercises/pythagorean-triplet/src/Triplet.hs +6 -3
- data/tracks/haskell/exercises/queen-attack/src/Queens.hs +1 -1
- data/tracks/haskell/exercises/raindrops/src/Raindrops.hs +2 -1
- data/tracks/haskell/exercises/robot-name/src/Robot.hs +2 -2
- data/tracks/haskell/exercises/robot-simulator/src/Robot.hs +6 -6
- data/tracks/haskell/exercises/roman-numerals/src/Roman.hs +2 -1
- data/tracks/haskell/exercises/run-length-encoding/src/RunLength.hs +2 -2
- data/tracks/haskell/exercises/saddle-points/src/Matrix.hs +2 -1
- data/tracks/haskell/exercises/say/src/Say.hs +2 -1
- data/tracks/haskell/exercises/scrabble-score/src/Scrabble.hs +4 -2
- data/tracks/haskell/exercises/secret-handshake/src/SecretHandshake.hs +1 -1
- data/tracks/haskell/exercises/sgf-parsing/src/Sgf.hs +1 -1
- data/tracks/java/exercises/acronym/src/example/java/Acronym.java +11 -1
- data/tracks/java/exercises/acronym/src/test/java/AcronymTest.java +8 -9
- data/tracks/java/exercises/grade-school/src/test/java/SchoolTest.java +8 -2
- data/tracks/java/exercises/luhn/src/test/java/LuhnValidatorTest.java +20 -13
- data/tracks/java/exercises/robot-name/src/test/java/RobotTest.java +6 -1
- data/tracks/javascript/README.md +1 -1
- data/tracks/javascript/docs/TESTS.md +9 -1
- data/tracks/kotlin/exercises/luhn/src/example/kotlin/Luhn.kt +18 -26
- data/tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt +40 -38
- data/tracks/php/README.md +1 -1
- data/tracks/php/config.json +5 -0
- data/tracks/php/exercises/perfect-numbers/example.php +23 -0
- data/tracks/php/exercises/perfect-numbers/perfect-numbers_test.php +99 -0
- data/tracks/purescript/.travis.yml +1 -0
- data/tracks/purescript/bin/test.sh +33 -8
- data/tracks/purescript/config.json +7 -0
- data/tracks/purescript/exercises/meetup/bower.json +17 -0
- data/tracks/purescript/exercises/meetup/examples/src/Meetup.purs +37 -0
- data/tracks/purescript/exercises/meetup/src/Meetup.purs +11 -0
- data/tracks/purescript/exercises/meetup/test/Main.purs +395 -0
- data/tracks/python/README.md +7 -6
- data/tracks/python/docs/TOOLS.md +3 -3
- data/tracks/python/exercises/bracket-push/bracket_push_test.py +32 -15
- data/tracks/python/exercises/hamming/hamming_test.py +2 -0
- data/tracks/python/exercises/luhn/luhn_test.py +2 -0
- data/tracks/python/test/check-exercises.py +7 -1
- metadata +56 -20
- data/tracks/csharp/exercises/atbash-cipher/AtbashTest.cs +0 -17
- data/tracks/csharp/generators/BooleanTestMethod.cs +0 -36
- data/tracks/csharp/generators/TestMethodNameTransformer.cs +0 -11
- data/tracks/csharp/generators/TestedClassNameTransformer.cs +0 -11
- data/tracks/java/exercises/allergies/src/main/java/.keep +0 -0
data/tracks/ceylon/README.md
CHANGED
data/tracks/csharp/appveyor.yml
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
using System;
|
2
2
|
|
3
|
-
public static class
|
3
|
+
public static class AtbashCipher
|
4
4
|
{
|
5
|
-
public static string Encode(string
|
5
|
+
public static string Encode(string plainValue)
|
6
6
|
{
|
7
7
|
throw new NotImplementedException("You need to implement this function.");
|
8
8
|
}
|
9
|
-
|
9
|
+
|
10
|
+
public static string Decode(string encodedValue)
|
11
|
+
{
|
12
|
+
throw new NotImplementedException("You need to implement this function.");
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
using Xunit;
|
2
|
+
|
3
|
+
public class AtbashCipherTest
|
4
|
+
{
|
5
|
+
[Fact]
|
6
|
+
public void Encode_yes()
|
7
|
+
{
|
8
|
+
Assert.Equal("bvh", AtbashCipher.Encode("yes"));
|
9
|
+
}
|
10
|
+
|
11
|
+
[Fact(Skip = "Remove to run test")]
|
12
|
+
public void Encode_no()
|
13
|
+
{
|
14
|
+
Assert.Equal("ml", AtbashCipher.Encode("no"));
|
15
|
+
}
|
16
|
+
|
17
|
+
[Fact(Skip = "Remove to run test")]
|
18
|
+
public void Encode_omg()
|
19
|
+
{
|
20
|
+
Assert.Equal("lnt", AtbashCipher.Encode("OMG"));
|
21
|
+
}
|
22
|
+
|
23
|
+
[Fact(Skip = "Remove to run test")]
|
24
|
+
public void Encode_spaces()
|
25
|
+
{
|
26
|
+
Assert.Equal("lnt", AtbashCipher.Encode("O M G"));
|
27
|
+
}
|
28
|
+
|
29
|
+
[Fact(Skip = "Remove to run test")]
|
30
|
+
public void Encode_mindblowingly()
|
31
|
+
{
|
32
|
+
Assert.Equal("nrmwy oldrm tob", AtbashCipher.Encode("mindblowingly"));
|
33
|
+
}
|
34
|
+
|
35
|
+
[Fact(Skip = "Remove to run test")]
|
36
|
+
public void Encode_numbers()
|
37
|
+
{
|
38
|
+
Assert.Equal("gvhgr mt123 gvhgr mt", AtbashCipher.Encode("Testing,1 2 3, testing."));
|
39
|
+
}
|
40
|
+
|
41
|
+
[Fact(Skip = "Remove to run test")]
|
42
|
+
public void Encode_deep_thought()
|
43
|
+
{
|
44
|
+
Assert.Equal("gifgs rhurx grlm", AtbashCipher.Encode("Truth is fiction."));
|
45
|
+
}
|
46
|
+
|
47
|
+
[Fact(Skip = "Remove to run test")]
|
48
|
+
public void Encode_all_the_letters()
|
49
|
+
{
|
50
|
+
Assert.Equal("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt", AtbashCipher.Encode("The quick brown fox jumps over the lazy dog."));
|
51
|
+
}
|
52
|
+
|
53
|
+
[Fact(Skip = "Remove to run test")]
|
54
|
+
public void Decode_exercism()
|
55
|
+
{
|
56
|
+
Assert.Equal("exercism", AtbashCipher.Decode("vcvix rhn"));
|
57
|
+
}
|
58
|
+
|
59
|
+
[Fact(Skip = "Remove to run test")]
|
60
|
+
public void Decode_a_sentence()
|
61
|
+
{
|
62
|
+
Assert.Equal("anobstacleisoftenasteppingstone", AtbashCipher.Decode("zmlyh gzxov rhlug vmzhg vkkrm thglm v"));
|
63
|
+
}
|
64
|
+
|
65
|
+
[Fact(Skip = "Remove to run test")]
|
66
|
+
public void Decode_numbers()
|
67
|
+
{
|
68
|
+
Assert.Equal("testing123testing", AtbashCipher.Decode("gvhgr mt123 gvhgr mt"));
|
69
|
+
}
|
70
|
+
|
71
|
+
[Fact(Skip = "Remove to run test")]
|
72
|
+
public void Decode_all_the_letters()
|
73
|
+
{
|
74
|
+
Assert.Equal("thequickbrownfoxjumpsoverthelazydog", AtbashCipher.Decode("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"));
|
75
|
+
}
|
76
|
+
}
|
@@ -1,35 +1,34 @@
|
|
1
|
+
using System;
|
1
2
|
using System.Collections.Generic;
|
2
3
|
using System.Linq;
|
3
4
|
|
4
|
-
public static class
|
5
|
+
public static class AtbashCipher
|
5
6
|
{
|
6
|
-
private const
|
7
|
-
private const string
|
7
|
+
private const int BlockSize = 5;
|
8
|
+
private const string Plain = "abcdefghijklmnopqrstuvwxyz0123456789";
|
9
|
+
private const string Cipher = "zyxwvutsrqponmlkjihgfedcba0123456789";
|
8
10
|
|
9
|
-
public static string Encode(string
|
10
|
-
|
11
|
-
var encoded = string.Concat(StripInvalidCharacters(value).ToLower().Select(ApplyCipher));
|
12
|
-
return SplitIntoFiveLetterWords(encoded);
|
13
|
-
}
|
11
|
+
public static string Encode(string plainValue)
|
12
|
+
=> string.Join(" ", EncodeInBlocks(GetEncodedCharacters(plainValue)));
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
return string.Concat(value.Where(char.IsLetterOrDigit));
|
18
|
-
}
|
14
|
+
public static string Decode(string encodedValue)
|
15
|
+
=> new string(encodedValue.Replace(" ", "").Select(Decode).ToArray());
|
19
16
|
|
20
|
-
private static char
|
21
|
-
|
22
|
-
var idx = PLAIN.IndexOf(value);
|
23
|
-
return idx >= 0 ? CIPHER[idx] : value;
|
24
|
-
}
|
17
|
+
private static IEnumerable<char> GetEncodedCharacters(string words)
|
18
|
+
=> GetValidCharacters(words).Select(Encode);
|
25
19
|
|
26
|
-
private static
|
27
|
-
|
28
|
-
|
20
|
+
private static IEnumerable<char> GetValidCharacters(string words)
|
21
|
+
=> words.ToLowerInvariant().Where(char.IsLetterOrDigit);
|
22
|
+
|
23
|
+
private static char Encode(char c) => Cipher[Plain.IndexOf(c)];
|
29
24
|
|
30
|
-
|
31
|
-
|
25
|
+
private static char Decode(char c) => Plain[Cipher.IndexOf(c)];
|
26
|
+
|
27
|
+
private static IEnumerable<string> EncodeInBlocks(IEnumerable<char> value)
|
28
|
+
{
|
29
|
+
var valueAsString = new string(value.ToArray());
|
32
30
|
|
33
|
-
|
31
|
+
for (var i = 0; i < valueAsString.Length; i += BlockSize)
|
32
|
+
yield return valueAsString.Substring(i, Math.Min(BlockSize, valueAsString.Length - i));
|
34
33
|
}
|
35
34
|
}
|
@@ -1,20 +1,52 @@
|
|
1
|
-
|
1
|
+
using Xunit;
|
2
2
|
|
3
3
|
public class IsogramTest
|
4
4
|
{
|
5
|
-
[
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
[
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
5
|
+
[Fact]
|
6
|
+
public void Empty_string()
|
7
|
+
{
|
8
|
+
Assert.True(Isogram.IsIsogram(""));
|
9
|
+
}
|
10
|
+
|
11
|
+
[Fact(Skip = "Remove to run test")]
|
12
|
+
public void Isogram_with_only_lower_case_characters()
|
13
|
+
{
|
14
|
+
Assert.True(Isogram.IsIsogram("isogram"));
|
15
|
+
}
|
16
|
+
|
17
|
+
[Fact(Skip = "Remove to run test")]
|
18
|
+
public void Word_with_one_duplicated_character()
|
19
|
+
{
|
20
|
+
Assert.False(Isogram.IsIsogram("eleven"));
|
21
|
+
}
|
22
|
+
|
23
|
+
[Fact(Skip = "Remove to run test")]
|
24
|
+
public void Longest_reported_english_isogram()
|
25
|
+
{
|
26
|
+
Assert.True(Isogram.IsIsogram("subdermatoglyphic"));
|
27
|
+
}
|
28
|
+
|
29
|
+
[Fact(Skip = "Remove to run test")]
|
30
|
+
public void Word_with_duplicated_character_in_mixed_case()
|
31
|
+
{
|
32
|
+
Assert.False(Isogram.IsIsogram("Alphabet"));
|
33
|
+
}
|
34
|
+
|
35
|
+
[Fact(Skip = "Remove to run test")]
|
36
|
+
public void Hypothetical_isogrammic_word_with_hyphen()
|
37
|
+
{
|
38
|
+
Assert.True(Isogram.IsIsogram("thumbscrew-japingly"));
|
39
|
+
}
|
40
|
+
|
41
|
+
[Fact(Skip = "Remove to run test")]
|
42
|
+
public void Isogram_with_duplicated_non_letter_character()
|
43
|
+
{
|
44
|
+
Assert.True(Isogram.IsIsogram("Hjelmqvist-Gryb-Zock-Pfund-Wax"));
|
45
|
+
}
|
46
|
+
|
47
|
+
[Fact(Skip = "Remove to run test")]
|
48
|
+
public void Made_up_name_that_is_an_isogram()
|
49
|
+
{
|
50
|
+
Assert.True(Isogram.IsIsogram("Emily Jung Schwartzkopf"));
|
19
51
|
}
|
20
52
|
}
|
@@ -1,21 +1,35 @@
|
|
1
|
-
|
1
|
+
using Xunit;
|
2
|
+
using System;
|
2
3
|
|
3
4
|
public class NthPrimeTest
|
4
5
|
{
|
5
|
-
[
|
6
|
-
|
7
|
-
[InlineData(2, 3)]
|
8
|
-
[InlineData(3, 5)]
|
9
|
-
[InlineData(4, 7)]
|
10
|
-
[InlineData(5, 11)]
|
11
|
-
[InlineData(6, 13)]
|
12
|
-
[InlineData(7, 17)]
|
13
|
-
[InlineData(8, 19)]
|
14
|
-
[InlineData(1000, 7919)]
|
15
|
-
[InlineData(10000, 104729)]
|
16
|
-
[InlineData(10001, 104743)]
|
17
|
-
public void Nth_prime_calculated(int nth, int expected)
|
6
|
+
[Fact]
|
7
|
+
public void First_prime()
|
18
8
|
{
|
19
|
-
Assert.Equal(
|
9
|
+
Assert.Equal(2, NthPrime.Prime(1));
|
10
|
+
}
|
11
|
+
|
12
|
+
[Fact(Skip = "Remove to run test")]
|
13
|
+
public void Second_prime()
|
14
|
+
{
|
15
|
+
Assert.Equal(3, NthPrime.Prime(2));
|
16
|
+
}
|
17
|
+
|
18
|
+
[Fact(Skip = "Remove to run test")]
|
19
|
+
public void Sixth_prime()
|
20
|
+
{
|
21
|
+
Assert.Equal(13, NthPrime.Prime(6));
|
22
|
+
}
|
23
|
+
|
24
|
+
[Fact(Skip = "Remove to run test")]
|
25
|
+
public void Big_prime()
|
26
|
+
{
|
27
|
+
Assert.Equal(104743, NthPrime.Prime(10001));
|
28
|
+
}
|
29
|
+
|
30
|
+
[Fact(Skip = "Remove to run test")]
|
31
|
+
public void There_is_no_zeroth_prime()
|
32
|
+
{
|
33
|
+
Assert.Throws<ArgumentOutOfRangeException>(() => NthPrime.Prime(0));
|
20
34
|
}
|
21
35
|
}
|
@@ -1,35 +1,33 @@
|
|
1
|
-
|
1
|
+
using System;
|
2
|
+
|
3
|
+
public enum Classification
|
2
4
|
{
|
3
5
|
Perfect,
|
4
6
|
Abundant,
|
5
7
|
Deficient
|
6
8
|
}
|
7
9
|
|
8
|
-
public class PerfectNumbers
|
10
|
+
public static class PerfectNumbers
|
9
11
|
{
|
10
|
-
public static
|
12
|
+
public static Classification Classify(int number)
|
11
13
|
{
|
14
|
+
if (number < 1)
|
15
|
+
throw new ArgumentOutOfRangeException();
|
16
|
+
|
12
17
|
int sumOfFactors = 0;
|
13
18
|
|
14
19
|
for (int i = 1; i < number; i++)
|
15
20
|
{
|
16
21
|
if (number % i == 0)
|
17
|
-
{
|
18
22
|
sumOfFactors += i;
|
19
|
-
}
|
20
23
|
}
|
21
24
|
|
22
25
|
if (sumOfFactors < number)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
}
|
30
|
-
else
|
31
|
-
{
|
32
|
-
return NumberType.Abundant;
|
33
|
-
}
|
26
|
+
return Classification.Deficient;
|
27
|
+
|
28
|
+
if (sumOfFactors == number)
|
29
|
+
return Classification.Perfect;
|
30
|
+
|
31
|
+
return Classification.Abundant;
|
34
32
|
}
|
35
33
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
using System;
|
2
2
|
|
3
|
-
public enum
|
3
|
+
public enum Classification
|
4
4
|
{
|
5
5
|
Perfect,
|
6
6
|
Abundant,
|
@@ -9,7 +9,7 @@ public enum NumberType
|
|
9
9
|
|
10
10
|
public static class PerfectNumbers
|
11
11
|
{
|
12
|
-
public static
|
12
|
+
public static Classification Classify(int number)
|
13
13
|
{
|
14
14
|
throw new NotImplementedException();
|
15
15
|
}
|
@@ -1,31 +1,83 @@
|
|
1
|
-
|
1
|
+
using Xunit;
|
2
|
+
using System;
|
2
3
|
|
3
4
|
public class PerfectNumbersTest
|
4
5
|
{
|
5
|
-
[
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
[
|
18
|
-
public void
|
19
|
-
{
|
20
|
-
Assert.Equal(
|
21
|
-
}
|
22
|
-
|
23
|
-
[
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
6
|
+
[Fact]
|
7
|
+
public void Smallest_perfect_number_is_classified_correctly()
|
8
|
+
{
|
9
|
+
Assert.Equal(Classification.Perfect, PerfectNumbers.Classify(6));
|
10
|
+
}
|
11
|
+
|
12
|
+
[Fact(Skip = "Remove to run test")]
|
13
|
+
public void Medium_perfect_number_is_classified_correctly()
|
14
|
+
{
|
15
|
+
Assert.Equal(Classification.Perfect, PerfectNumbers.Classify(28));
|
16
|
+
}
|
17
|
+
|
18
|
+
[Fact(Skip = "Remove to run test")]
|
19
|
+
public void Large_perfect_number_is_classified_correctly()
|
20
|
+
{
|
21
|
+
Assert.Equal(Classification.Perfect, PerfectNumbers.Classify(33550336));
|
22
|
+
}
|
23
|
+
|
24
|
+
[Fact(Skip = "Remove to run test")]
|
25
|
+
public void Smallest_abundant_number_is_classified_correctly()
|
26
|
+
{
|
27
|
+
Assert.Equal(Classification.Abundant, PerfectNumbers.Classify(12));
|
28
|
+
}
|
29
|
+
|
30
|
+
[Fact(Skip = "Remove to run test")]
|
31
|
+
public void Medium_abundant_number_is_classified_correctly()
|
32
|
+
{
|
33
|
+
Assert.Equal(Classification.Abundant, PerfectNumbers.Classify(30));
|
34
|
+
}
|
35
|
+
|
36
|
+
[Fact(Skip = "Remove to run test")]
|
37
|
+
public void Large_abundant_number_is_classified_correctly()
|
38
|
+
{
|
39
|
+
Assert.Equal(Classification.Abundant, PerfectNumbers.Classify(33550335));
|
40
|
+
}
|
41
|
+
|
42
|
+
[Fact(Skip = "Remove to run test")]
|
43
|
+
public void Smallest_prime_deficient_number_is_classified_correctly()
|
44
|
+
{
|
45
|
+
Assert.Equal(Classification.Deficient, PerfectNumbers.Classify(2));
|
46
|
+
}
|
47
|
+
|
48
|
+
[Fact(Skip = "Remove to run test")]
|
49
|
+
public void Smallest_non_prime_deficient_number_is_classified_correctly()
|
50
|
+
{
|
51
|
+
Assert.Equal(Classification.Deficient, PerfectNumbers.Classify(4));
|
52
|
+
}
|
53
|
+
|
54
|
+
[Fact(Skip = "Remove to run test")]
|
55
|
+
public void Medium_deficient_number_is_classified_correctly()
|
56
|
+
{
|
57
|
+
Assert.Equal(Classification.Deficient, PerfectNumbers.Classify(32));
|
58
|
+
}
|
59
|
+
|
60
|
+
[Fact(Skip = "Remove to run test")]
|
61
|
+
public void Large_deficient_number_is_classified_correctly()
|
62
|
+
{
|
63
|
+
Assert.Equal(Classification.Deficient, PerfectNumbers.Classify(33550337));
|
64
|
+
}
|
65
|
+
|
66
|
+
[Fact(Skip = "Remove to run test")]
|
67
|
+
public void Edge_case_no_factors_other_than_itself_is_classified_correctly()
|
68
|
+
{
|
69
|
+
Assert.Equal(Classification.Deficient, PerfectNumbers.Classify(1));
|
70
|
+
}
|
71
|
+
|
72
|
+
[Fact(Skip = "Remove to run test")]
|
73
|
+
public void Zero_is_rejected_not_a_natural_number_()
|
74
|
+
{
|
75
|
+
Assert.Throws<ArgumentOutOfRangeException>(() => PerfectNumbers.Classify(0));
|
76
|
+
}
|
77
|
+
|
78
|
+
[Fact(Skip = "Remove to run test")]
|
79
|
+
public void Negative_integer_is_rejected_not_a_natural_number_()
|
80
|
+
{
|
81
|
+
Assert.Throws<ArgumentOutOfRangeException>(() => PerfectNumbers.Classify(-1));
|
30
82
|
}
|
31
83
|
}
|