fix: allow for parsing single chars as input, ref: NOISSUE

This commit is contained in:
2024-12-05 23:58:11 +01:00
parent b261773b13
commit 550c8280a6
13 changed files with 325 additions and 21 deletions

View File

@@ -30,6 +30,9 @@ public class TextParserTests
private const string testInput9 = @"2 4 6 4 1
3 5 4 7 6
4 6 8 3 9";
private const string testInput10 = @"abc
bca
cab";
[Fact]
public void LineParser_TestSimpleRepetition()
@@ -322,7 +325,7 @@ public class TextParserTests
[Fact]
public void DataManipulator_SimpleOneDimensionalTest()
{
{
var schemaBuilder = new InputSchemaBuilder();
var schema = schemaBuilder
.Repeat()
@@ -351,7 +354,7 @@ public class TextParserTests
[Fact]
public void DataManipulator_SimpleTwoDimensionalTest()
{
{
var schemaBuilder = new InputSchemaBuilder();
var schema = schemaBuilder
.Repeat()
@@ -389,4 +392,27 @@ public class TextParserTests
Assert.Equal(Direction.SE, searchResults[4].Direction);
Assert.Equal(Direction.W, searchResults[5].Direction);
}
[Fact]
public void TextPArser_TestReadingChars()
{
var schemaBuilder = new InputSchemaBuilder();
var schema = schemaBuilder
.Repeat()
.Expect(InputType.Char)
.EndRepetition()
.Build();
var parser = new TextParser<InputSchemaContext>(schema);
var row = parser
.SetInputText(testInput10)
.Parse()
.AsListRows<string>();
Assert.Equal(3, row.Count);
Assert.Equal("a", row[0][0]);
Assert.Equal(3, row[0].Count);
Assert.Equal(3, row[1].Count);
Assert.Equal(3, row[2].Count);
}
}