Skip to content

Commit

Permalink
Diamond tests adjustment (#2345)
Browse files Browse the repository at this point in the history
* Updated DiamondTests.cs

`Rows` method adjusted to use system dependent new line characters.

* DiamondTests.Rows method adjusted to be line-ending tolerant.
  • Loading branch information
spirit11 authored Dec 10, 2024
1 parent 3bc3370 commit f3c98a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions exercises/practice/diamond/DiamondTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class DiamondTests
{
public static readonly char[] AllLetters = GetLetterRange('A', 'Z');
private static string[] Rows(string x) => x.Split(new[] { '\n' }, StringSplitOptions.None);
private static string[] Rows(string x) => x.Split('\n').Select(line => line.TrimEnd('\r')).ToArray();

private static string LeadingSpaces(string x) => x.Substring(0, x.IndexOfAny(AllLetters));
private static string TrailingSpaces(string x) => x.Substring(x.LastIndexOfAny(AllLetters) + 1);
Expand Down Expand Up @@ -125,4 +125,4 @@ public static Arbitrary<char> Chars()
{
return Arb.Default.Char().Filter(x => x >= 'A' && x <= 'Z');
}
}
}

0 comments on commit f3c98a6

Please sign in to comment.