2024-08-13 14:46:11 +08:00
|
|
|
using CanonSharp.Combinator.Extensions;
|
2024-08-14 19:41:10 +08:00
|
|
|
using CanonSharp.Pascal.Scanner;
|
2024-08-13 14:46:11 +08:00
|
|
|
|
|
|
|
namespace CanonSharp.Tests.LexicalAnalyzerTests;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|