Lucene.Net.Analysis.Synonym.TestSynonymMapFilter.Verify C# (CSharp) Метод

Verify() приватный Метод

private Verify ( string input, string output ) : void
input string
output string
Результат void
        private void Verify(string input, string output)
        {
            if (VERBOSE)
            {
                Console.WriteLine("TEST: verify input=" + input + " expectedOutput=" + output);
            }

            tokensIn.Reader = new StringReader(input);
            tokensOut.Reset();
            string[] expected = output.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            int expectedUpto = 0;
            while (tokensOut.IncrementToken())
            {

                if (VERBOSE)
                {
                    Console.WriteLine("  incr token=" + termAtt.ToString() + " posIncr=" + posIncrAtt.PositionIncrement + " startOff=" + offsetAtt.StartOffset() + " endOff=" + offsetAtt.EndOffset());
                }

                assertTrue(expectedUpto < expected.Length);
                int startOffset = offsetAtt.StartOffset();
                int endOffset = offsetAtt.EndOffset();

                string[] expectedAtPos = expected[expectedUpto++].Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
                for (int atPos = 0; atPos < expectedAtPos.Length; atPos++)
                {
                    if (atPos > 0)
                    {
                        assertTrue(tokensOut.IncrementToken());
                        if (VERBOSE)
                        {
                            Console.WriteLine("  incr token=" + termAtt.ToString() + " posIncr=" + posIncrAtt.PositionIncrement + " startOff=" + offsetAtt.StartOffset() + " endOff=" + offsetAtt.EndOffset());
                        }
                    }
                    int colonIndex = expectedAtPos[atPos].IndexOf(':');
                    int underbarIndex = expectedAtPos[atPos].IndexOf('_');
                    string expectedToken;
                    int expectedEndOffset;
                    int expectedPosLen;
                    if (colonIndex != -1)
                    {
                        expectedToken = expectedAtPos[atPos].Substring(0, colonIndex - 0);
                        if (underbarIndex != -1)
                        {
                            expectedEndOffset = int.Parse(expectedAtPos[atPos].Substring(1 + colonIndex, underbarIndex - (1 + colonIndex)));
                            expectedPosLen = int.Parse(expectedAtPos[atPos].Substring(1 + underbarIndex));
                        }
                        else
                        {
                            expectedEndOffset = int.Parse(expectedAtPos[atPos].Substring(1 + colonIndex));
                            expectedPosLen = 1;
                        }
                    }
                    else
                    {
                        expectedToken = expectedAtPos[atPos];
                        expectedEndOffset = endOffset;
                        expectedPosLen = 1;
                    }
                    assertEquals(expectedToken, termAtt.ToString());
                    assertEquals(atPos == 0 ? 1 : 0, posIncrAtt.PositionIncrement);
                    // start/end offset of all tokens at same pos should
                    // be the same:
                    assertEquals(startOffset, offsetAtt.StartOffset());
                    assertEquals(expectedEndOffset, offsetAtt.EndOffset());
                    assertEquals(expectedPosLen, posLenAtt.PositionLength);
                }
            }
            tokensOut.End();
            tokensOut.Dispose();
            if (VERBOSE)
            {
                Console.WriteLine("  incr: END");
            }
            assertEquals(expectedUpto, expected.Length);
        }