Exemplo n.º 1
0
        public void LookAheadReturnsNothingWhenOutOfRange()
        {
            //Arrange
            var input     = "123";
            var scanState = new SourceScanState(input.AsMemory());

            //Act
            scanState.LookAhead(4).IsEmpty.Should().BeTrue();
        }
Exemplo n.º 2
0
        public void LookAheadReturnsStuff()
        {
            //Arrange
            var input     = "123";
            var scanState = new SourceScanState(input.AsMemory());

            //Act
            scanState.LookAhead(2).ToArray().Should().BeEquivalentTo(new[] { '1', '2' });
        }
Exemplo n.º 3
0
        public void LookAheadWhenAtEndReturnsEmpty()
        {
            //Arrange
            var input     = "123";
            var scanState = new SourceScanState(input.AsMemory());

            scanState.Advance();
            scanState.Advance();
            scanState.Advance();

            //Act & Assert
            scanState.LookAhead(2).IsEmpty.Should().BeTrue();
        }