-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v1.5.6 continuing test project restucturing
- Loading branch information
Showing
12 changed files
with
85 additions
and
71 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
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
File renamed without changes.
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,33 @@ | ||
namespace Smab.Helpers.Test.ArrayHelperTests; | ||
public partial class GetAdjacent { | ||
|
||
[Theory] | ||
[InlineData(0, 0, false, 2)] | ||
[InlineData(0, 0, true, 3)] | ||
[InlineData(1, 1, false, 4)] | ||
[InlineData(1, 1, true, 8)] | ||
public void GetAdjacentCells_Should_Have(int X, int Y, bool includeDiagonals, int expected) { | ||
(char, int)[] input = new (char, int)[26]; | ||
for (int i = 0; i < input.GetUpperBound(0); i++) { | ||
input[i] = new((char)(65 + i), i + 1); | ||
} | ||
(char, int)[,] array = input.To2dArray<(char, int)>(5); | ||
var points = array.GetAdjacentCells((X, Y), includeDiagonals: includeDiagonals); | ||
points.Count().ShouldBe(expected); | ||
} | ||
|
||
[Theory] | ||
[InlineData(0, 0, false, 1)] | ||
[InlineData(1, 1, false, 3)] | ||
[InlineData(1, 1, true, 6)] | ||
public void GetAdjacentCells_Should_Not_Have(int X, int Y, bool includeDiagonals, int expected) { | ||
(char, int)[] input = new (char, int)[26]; | ||
for (int i = 0; i < input.GetUpperBound(0); i++) { | ||
input[i] = new((char)(65 + i), i + 1); | ||
} | ||
(char, int)[,] array = input.To2dArray(5); | ||
var points = array.GetAdjacentCells((X, Y), includeDiagonals: includeDiagonals, exclude: [ArrayHelpers.RIGHT, ArrayHelpers.NORTH_EAST]); | ||
points.Count().ShouldBe(expected); | ||
} | ||
|
||
} |
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,19 @@ | ||
namespace Smab.Helpers.Test.ParsingHelperTests; | ||
public partial class FromBinaryAs { | ||
[Theory] | ||
[InlineData("#", 1)] | ||
[InlineData("#..#", 9)] | ||
public void FromBinaryAs_ShouldBe(string input, int expected) { | ||
int actual = input.FromBinaryAs<int>(); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Theory] | ||
[InlineData("█", 1)] | ||
[InlineData("█ █", 9)] | ||
public void FromBinaryAs_WithReplacements_ShouldBe(string input, int expected) { | ||
int actual = input.FromBinaryAs<int>(' ', '█'); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
} |
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,18 @@ | ||
namespace Smab.Helpers.Test.ParsingHelperTests; | ||
public partial class TrimmedSplit { | ||
[Fact] | ||
public void TrimmedSplit_ShouldBe() { | ||
|
||
const string INPUT = """ | ||
123, 4, 5 L : 123 , | ||
aaa, 4, ; x : 123 , | ||
"""; | ||
|
||
INPUT.TrimmedSplit().Length.ShouldBe(1); | ||
INPUT.TrimmedSplit(Environment.NewLine).Length.ShouldBe(2); | ||
INPUT.TrimmedSplit(',').Length.ShouldBe(6); | ||
INPUT.TrimmedSplit([";"]).Length.ShouldBe(2); | ||
INPUT.TrimmedSplit([";"]).Last().ShouldBe("x : 123 ,"); | ||
INPUT.TrimmedSplit(",", 5)[^2].ShouldBe("aaa"); | ||
} | ||
} |
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