Resolved #88: Offset and length must refer to a position in the string

This commit is contained in:
Michael Grafnetter 2019-06-27 17:53:45 +02:00
parent efc1be5535
commit ed4111bab8
2 changed files with 14 additions and 2 deletions

View File

@ -141,7 +141,7 @@ Zulu";
// Find first
Assert.IsTrue(searcher.FindString("1AE188AB6DF35626E09C77F2880CAD75"));
// Find last
// Find last
Assert.IsTrue(searcher.FindString("1AE189A6FFF7DB51548F12F063491E36"));
// Find middle
@ -229,7 +229,13 @@ Zulu";
// Find middle
Assert.IsTrue(searcher.FindString("1AE188FF3AF08946C275C9A7E2B894F2"));
// Find non-existing
// Find non-existing (before first)
Assert.IsFalse(searcher.FindString("0AE188AB6DF35626E09C77F2880CAD75"));
// Find non-existing (in the middle)
Assert.IsFalse(searcher.FindString("1AE188FF3AF08946C275C9A7E2B894F1"));
// Find non-existing (after last)
Assert.IsFalse(searcher.FindString("F7EB9C06FAFAA23C4BCF22BA6781C1E2"));
}
}

View File

@ -49,6 +49,12 @@
// Read the current line
string line = this.reader.ReadLine();
if(line == null)
{
// We have reached the end of the file, so the search is over
break;
}
switch (String.Compare(line, 0, query, 0, query.Length, true))
{
case -1: