CanonSharp/CanonSharp.Tests/ReaderTests/StringReadStateTests.cs
jackfiled cf19f8197e feat: Grammar Parser (#3)
Reviewed-on: https://git.bupt-hpc.cn/jackfiled/CanonSharp/pulls/3
Co-authored-by: jackfiled <xcrenchangjun@outlook.com>
Co-committed-by: jackfiled <xcrenchangjun@outlook.com>
2024-08-18 12:01:27 +08:00

22 lines
512 B
C#

using CanonSharp.Combinator.Extensions;
using CanonSharp.Pascal.Scanner;
namespace CanonSharp.Tests.ReaderTests;
public class StringReadStateTests
{
[Fact]
public void AsEnumerableTest()
{
StringReadState state = new("abc");
IEnumerable<StringReadState> states = state.AsEnumerable<char, StringReadState>();
foreach ((char c, StringReadState s) in "abc".Zip(states))
{
Assert.True(s.HasValue);
Assert.Equal(c, s.Current);
}
}
}