Lucene.Net.Analysis.TestStopFilter.DoTestStopPositons C# (CSharp) Method

DoTestStopPositons() private method

private DoTestStopPositons ( StopFilter stpf, bool enableIcrements ) : void
stpf StopFilter
enableIcrements bool
return void
		private void  DoTestStopPositons(StopFilter stpf, bool enableIcrements)
		{
			Log("---> test with enable-increments-" + (enableIcrements?"enabled":"disabled"));
			stpf.EnablePositionIncrements = enableIcrements;
            ITermAttribute termAtt = stpf.GetAttribute<ITermAttribute>();
            IPositionIncrementAttribute posIncrAtt = stpf.GetAttribute<IPositionIncrementAttribute>();
			for (int i = 0; i < 20; i += 3)
			{
				Assert.IsTrue(stpf.IncrementToken());
				Log("Token " + i + ": " + stpf);
				System.String w = English.IntToEnglish(i).Trim();
				Assert.AreEqual(w, termAtt.Term, "expecting token " + i + " to be " + w);
				Assert.AreEqual(enableIcrements?(i == 0?1:3):1, posIncrAtt.PositionIncrement, "all but first token must have position increment of 3");
			}
			Assert.IsFalse(stpf.IncrementToken());
		}