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

            //Act
            scanState.LookAhead(4).IsEmpty.Should().BeTrue();
        }
Esempio 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' });
        }
Esempio 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();
        }