feat: Parser Combinator库和词法分析器 (#2)
All checks were successful
Run unit test / Unit-Test (push) Successful in 41s
All checks were successful
Run unit test / Unit-Test (push) Successful in 41s
Reviewed-on: https://git.bupt-hpc.cn/jackfiled/CanonSharp/pulls/2 Co-authored-by: jackfiled <xcrenchangjun@outlook.com> Co-committed-by: jackfiled <xcrenchangjun@outlook.com>
This commit is contained in:
21
CanonSharp.Tests/ReaderTests/StringReadStateTests.cs
Normal file
21
CanonSharp.Tests/ReaderTests/StringReadStateTests.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using CanonSharp.Combinator.Extensions;
|
||||
using CanonSharp.Common.Scanner;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user