public virtual void TestToString() { char[] b = new char[]{'a', 'l', 'o', 'h', 'a'}; Token t = new Token("", 0, 5); t.SetTermBuffer(b, 0, 5); Assert.AreEqual("(aloha,0,5)", t.ToString()); t.SetTermText("hi there"); Assert.AreEqual("(hi there,0,5)", t.ToString()); }
public override Token Next() { Token t = input.Next(); if (t != null) { t.SetTermText(RemoveAccents(t.TermText())); } return(t); }
public virtual void TestToString() { char[] b = new char[] { 'a', 'l', 'o', 'h', 'a' }; Token t = new Token("", 0, 5); t.SetTermBuffer(b, 0, 5); Assert.AreEqual("(aloha,0,5)", t.ToString()); t.SetTermText("hi there"); Assert.AreEqual("(hi there,0,5)", t.ToString()); }
public virtual void TestMixedStringArray() { Token t = new Token("hello", 0, 5); Assert.AreEqual(t.TermText(), "hello"); Assert.AreEqual(t.TermLength(), 5); Assert.AreEqual(new System.String(t.TermBuffer(), 0, 5), "hello"); t.SetTermText("hello2"); Assert.AreEqual(t.TermLength(), 6); Assert.AreEqual(new System.String(t.TermBuffer(), 0, 6), "hello2"); t.SetTermBuffer("hello3".ToCharArray(), 0, 6); Assert.AreEqual(t.TermText(), "hello3"); // Make sure if we get the buffer and change a character // that termText() reflects the change char[] buffer = t.TermBuffer(); buffer[1] = 'o'; Assert.AreEqual(t.TermText(), "hollo3"); }
public virtual void TestMixedStringArray() { Token t = new Token("hello", 0, 5); Assert.AreEqual(t.TermText(), "hello"); Assert.AreEqual(t.TermLength(), 5); Assert.AreEqual(t.Term(), "hello"); t.SetTermText("hello2"); Assert.AreEqual(t.TermLength(), 6); Assert.AreEqual(t.Term(), "hello2"); t.SetTermBuffer("hello3".ToCharArray(), 0, 6); Assert.AreEqual(t.TermText(), "hello3"); // Make sure if we get the buffer and change a character // that termText() reflects the change char[] buffer = t.TermBuffer(); buffer[1] = 'o'; Assert.AreEqual(t.TermText(), "hollo3"); }