public void AllowEmptyProgramAtCreation()
        {
            var microScanner = new MicroScanner(string.Empty);

            Assert.IsNotNull(microScanner);
            Assert.AreEqual(string.Empty, microScanner.Input);
        }
        public void DetectAndReturnMinusOp()
        {
            string program      = "-";
            var    microScanner = new MicroScanner(program);

            var token = microScanner.Scan();

            Assert.AreEqual("MinusOp", token.Name);
        }
        public void DetectAndIgnoreCommentLine()
        {
            string program      = "-- Some comment 12345\r\n ";
            var    microScanner = new MicroScanner(program);

            var token = microScanner.Scan();

            Assert.AreEqual("EofSym", token.Name);
            Assert.AreEqual("EOF", token.Value);
        }
        public void DetectAndReturnLiteral()
        {
            string program      = "abcdefghijklmnopqrstuvwxyz0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            var    microScanner = new MicroScanner(program);

            var token = microScanner.Scan();

            Assert.AreEqual("Id", token.Name);
            Assert.AreEqual(program, token.Value);
        }
        public void DetectAndReturnEndReservedWord()
        {
            string program      = "End";
            var    microScanner = new MicroScanner(program);

            var token = microScanner.Scan();

            Assert.AreEqual("EndSym", token.Name);
            Assert.AreEqual("END", token.Value);
        }
        public void DetectAndReturnWriteReservedWord()
        {
            string program      = "Write";
            var    microScanner = new MicroScanner(program);

            var token = microScanner.Scan();

            Assert.AreEqual("WriteSym", token.Name);
            Assert.AreEqual("WRITE", token.Value);
        }
        public void ReturnLexicalErrorWhenBadCharactersEncountered()
        {
            string program      = "First<Second";
            var    microScanner = new MicroScanner(program);

            var token = microScanner.Scan();

            Assert.AreEqual("Id", token.Name);
            Assert.AreEqual("First", token.Value);

            token = microScanner.Scan();
            Assert.AreEqual("Lexical Error", token.Name, token.Value);
            Assert.AreEqual("Bad char value: '<'", token.Value);

            token = microScanner.Scan();
            Assert.AreEqual("Id", token.Name);
            Assert.AreEqual("Second", token.Value);
        }