Esempio n. 1
0
        public void PropertiesTest()
        {
            SigoAssert.Equal(-1, lexer.Min);
            SigoAssert.Equal(2, lexer.Max);
            SigoAssert.Equal(0, lexer.Cursor);

            lexer.Move(2);
            SigoAssert.Equal(2, lexer.Cursor);
            SigoAssert.Equal("2", lexer.Peek(0).Raw);

            lexer.Move(2);
            SigoAssert.Equal(4, lexer.Cursor);
            SigoAssert.Equal("4", lexer.Peek(0).Raw);

            lexer.Peek(lexer.Max); // after peek max, you can Move min, but not min-1
            lexer.Move(-1);
            SigoAssert.Equal(3, lexer.Cursor);
            SigoAssert.Equal("3", lexer.Peek(0).Raw);

            SigoAssert.ThrowsAny <Exception>(() => lexer.Peek(-1));

            // after move(-1) you have limitation
            SigoAssert.ThrowsAny <Exception>(() => lexer.Move(-1));
        }
Esempio n. 2
0
 private void Next()
 {
     lexer.Move(1);
     t = lexer.Peek(0);
 }