Exemplo n.º 1
0
        public void AddIdOrIntegerTokenIdSuccessTest()
        {
            //Arrange at Initialize
            //Arrange
            var line              = "Three = One + Two";
            var lineIndex         = 5;
            var c                 = ' ';
            var tokens            = new List <Token>();
            var scanningId        = true;
            var scanningInteger   = false;
            var idStartIndex      = 0;
            var integerStartIndex = -1;

            //Act
            _lexicalAnalyzer.AddIdOrIntegerToken(line, lineIndex, c, tokens, ref scanningId, ref scanningInteger, ref idStartIndex, ref integerStartIndex);
            tokens[0].PopulateContent();

            //Assert
            Assert.IsTrue(tokens.Count == 1);
            Assert.AreEqual(TokenType.ID, tokens[0].TokenType);
            Assert.AreEqual(0, tokens[0].StartIndex);
            Assert.AreEqual(5, tokens[0].CharCount);
            Assert.AreEqual(line, tokens[0].SourceLine);
            Assert.AreEqual("Three", tokens[0].Content);
        }