예제 #1
0
		public void Peek_AtEnd_NullChar()
		{
			StringScanner scanner = new StringScanner(Text);
			scanner.Seek(Text.Length);
			Assert.IsTrue(scanner.AtEnd);
			Assert.AreEqual('\0', scanner.Peek());
		}
예제 #2
0
		public void Read_AtEnd_Throws()
		{
			StringScanner scanner = new StringScanner(Text);
			scanner.Seek(Text.Length);
			Assert.IsTrue(scanner.AtEnd);
			Assert.Throws<InvalidOperationException>(
				() => scanner.Read());
		}
예제 #3
0
		public void Seek()
		{
			StringScanner scanner = new StringScanner(Text);
			int i=(int)Offset;
			scanner.Seek(Offset);

			while (!scanner.AtEnd)
			{
				Assert.Less(i, Text.Length);
				Assert.AreEqual(Text[i], scanner.Peek());
				scanner.Read();
				++i;
			}

			Assert.AreEqual(Text.Length,i);
		}