public void LookAheadReturnsNegativeOneOnEnd() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual("Test", scanningReader.ReadToEnd()); Assert.AreEqual(-1, scanningReader.LookAhead(0)); Assert.AreEqual(-1, scanningReader.LookAhead(5)); }
public void LookAheadMany() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('t', scanningReader.LookAhead(3)); Assert.AreEqual('e', scanningReader.LookAhead(1)); Assert.AreEqual('s', scanningReader.LookAhead(2)); Assert.AreEqual('T', scanningReader.LookAhead(0)); Assert.AreEqual("Test", scanningReader.ReadToEnd()); }
public void LookAheadOne() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('T', scanningReader.LookAhead(0)); Assert.AreEqual('T', scanningReader.Read()); Assert.AreEqual('e', scanningReader.Read()); Assert.AreEqual('s', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.Read()); Assert.AreEqual('t', scanningReader.Read()); }
public void PeekWithLookahead() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('T', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.LookAhead(2)); Assert.AreEqual('T', scanningReader.Peek()); Assert.AreEqual('T', scanningReader.Read()); Assert.AreEqual('e', scanningReader.Read()); Assert.AreEqual('s', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.Peek()); Assert.AreEqual("st", scanningReader.ReadToEnd()); }
public void PeekWithLookahead() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('T', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.LookAhead(2)); Assert.AreEqual('T', scanningReader.Peek()); Assert.AreEqual('T', scanningReader.Read()); Assert.AreEqual('e', scanningReader.Read()); Assert.AreEqual('s', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.Peek()); Assert.AreEqual("st", scanningReader.ReadToEnd()); }
public void LookAheadReturnsNegativeOneOnEnd() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual("Test", scanningReader.ReadToEnd()); Assert.AreEqual(-1, scanningReader.LookAhead(0)); Assert.AreEqual(-1, scanningReader.LookAhead(5)); }
public void LookAheadMany() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('t', scanningReader.LookAhead(3)); Assert.AreEqual('e', scanningReader.LookAhead(1)); Assert.AreEqual('s', scanningReader.LookAhead(2)); Assert.AreEqual('T', scanningReader.LookAhead(0)); Assert.AreEqual("Test", scanningReader.ReadToEnd()); }
public void LookAheadOne() { StringReader reader = new StringReader("Test"); ScanningTextReader scanningReader = new ScanningTextReader(reader); Assert.AreEqual('T', scanningReader.LookAhead(0)); Assert.AreEqual('T', scanningReader.Read()); Assert.AreEqual('e', scanningReader.Read()); Assert.AreEqual('s', scanningReader.LookAhead(0)); Assert.AreEqual('s', scanningReader.Read()); Assert.AreEqual('t', scanningReader.Read()); }