Example #1
0
        public void SingleInt()
        {
            ILexer lexer = new Lexer("1");
            var token1 = lexer.Next();

            Assert.IsType(typeof(NumberLexToken), token1);
            Assert.Equal("0x1", token1.Value());
        }
Example #2
0
        public void BasicMath()
        {
            ILexer lexer = new Lexer("1 + 2");
            var token1 = lexer.Next();
            var token2 = lexer.Next();
            var token3 = lexer.Next();

            Assert.IsType(typeof(NumberLexToken), token1);
            Assert.Equal("0x1", token1.Value());
            Assert.IsType(typeof(BinaryOperatorLexToken), token2);
            Assert.Equal("+", token2.Value());
            Assert.IsType(typeof(NumberLexToken), token3);
            Assert.Equal("0x2", token3.Value());
        }