public void CanParseCommandWithStringArg() { // Arrange var textParser = new TurtleGraphicsLexicalAnalyser(); // Act var parsedValue = textParser.Parse(CommandWithStringArgs); // Assert Assert.AreEqual(CommandWithNoArgs, parsedValue[0]); }
public void CanParseCommandWithArgs() { // Arrange var textParser = new TurtleGraphicsLexicalAnalyser(); // Act var parsedValue = textParser.Parse(CommandWithArgs); // Assert Assert.AreEqual(Command, parsedValue[0]); Assert.AreEqual(Argument, parsedValue[1]); }
public void CanParseComplexCommand() { // Arrange var textParser = new TurtleGraphicsLexicalAnalyser(); // Act var parsedValues = textParser.Parse(ComplexCommand); // Assert Assert.AreEqual(14, parsedValues.Count); Assert.AreEqual("REPEAT", parsedValues[0]); Assert.AreEqual("4", parsedValues[1]); Assert.AreEqual("[", parsedValues[2]); Assert.AreEqual("LEFT", parsedValues[3]); Assert.AreEqual("10", parsedValues[4]); Assert.AreEqual("PRINT", parsedValues[5]); Assert.AreEqual("\"HELLO WORLD\"", parsedValues[6]); Assert.AreEqual("REPEAT", parsedValues[7]); Assert.AreEqual("10", parsedValues[8]); Assert.AreEqual("[", parsedValues[9]); Assert.AreEqual("RIGHT", parsedValues[10]); Assert.AreEqual("10", parsedValues[11]); Assert.AreEqual("]", parsedValues[12]); Assert.AreEqual("]", parsedValues[13]); }
public void CanParseEmptyCommand() { // Arrange var textParser = new TurtleGraphicsLexicalAnalyser(); // Act var parsedValue = textParser.Parse(EmptyCommand); // Assert Assert.AreEqual(0, parsedValue.Count); }