-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* alphametics: add generator * anagram: add generator * armstrong-numbers: add generator * Remove old generators * atbash-cipher: add generator [no important files changed]
- Loading branch information
1 parent
9d88508
commit d7ceef1
Showing
11 changed files
with
120 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Xunit; | ||
|
||
public class AlphameticsTests | ||
{ | ||
{{for test in tests}} | ||
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}] | ||
public void {{test.methodName}}() | ||
{ | ||
{{if test.expected}} | ||
var actual = Alphametics.Solve({{test.input.puzzle | string.literal}}); | ||
var expected = new Dictionary<char, int> | ||
{ | ||
{{for key in test.expected | object.keys}} | ||
['{{key}}'] = {{test.expected[key]}}{{if !for.last}},{{end}} | ||
{{end}} | ||
}; | ||
Assert.Equal(expected, actual); | ||
{{else}} | ||
Assert.Throws<ArgumentException>(() => Alphametics.Solve({{test.input.puzzle | string.literal}})); | ||
{{end}} | ||
} | ||
{{end}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Xunit; | ||
|
||
public class AnagramTests | ||
{ | ||
{{for test in tests}} | ||
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}] | ||
public void {{test.methodName}}() | ||
{ | ||
string[] candidates = {{test.input.candidates}}; | ||
var sut = new Anagram({{test.input.subject | string.literal}}); | ||
{{if test.expected.empty?}} | ||
Assert.Empty(sut.FindAnagrams(candidates)); | ||
{{else}} | ||
string[] expected = {{test.expected}}; | ||
Assert.Equal(expected, sut.FindAnagrams(candidates)); | ||
{{end}} | ||
} | ||
{{end}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Xunit; | ||
|
||
public class ArmstrongNumbersTests | ||
{ | ||
{{for test in tests}} | ||
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}] | ||
public void {{test.methodName}}() | ||
{ | ||
Assert.{{test.expected ? "True" : "False"}}(ArmstrongNumbers.IsArmstrongNumber({{test.input.number}})); | ||
} | ||
{{end}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Xunit; | ||
|
||
public class AtbashCipherTests | ||
{ | ||
{{for test in tests}} | ||
[Fact{{if !for.first}}(Skip = "Remove this Skip property to run this test"){{end}}] | ||
public void {{test.shortMethodName}}() | ||
{ | ||
Assert.Equal({{test.expected | string.literal}}, AtbashCipher.{{test.property | string.capitalize}}({{test.input.phrase | string.literal}})); | ||
} | ||
{{end}} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
generators.deprecated/Exercises/Generators/ArmstrongNumbers.cs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.