Inheritance: Lucene.Net.Util.LuceneTestCase
コード例 #1
0
        public virtual void  TestClone()
        {
            TermAttribute t = new TermAttribute();

            char[] content = "hello".ToCharArray();
            t.SetTermBuffer(content, 0, 5);
            char[]        buf  = t.TermBuffer();
            TermAttribute copy = (TermAttribute)TestSimpleAttributeImpls.AssertCloneIsEqual(t);

            Assert.AreEqual(t.Term, copy.Term);
            Assert.AreNotSame(buf, copy.TermBuffer());
        }
コード例 #2
0
        public virtual void  TestCopyTo()
        {
            TermAttributeImpl t    = new TermAttributeImpl();
            TermAttributeImpl copy = (TermAttributeImpl)TestSimpleAttributeImpls.AssertCopyIsEqual(t);

            Assert.AreEqual("", t.Term());
            Assert.AreEqual("", copy.Term());

            t = new TermAttributeImpl();
            char[] content = "hello".ToCharArray();
            t.SetTermBuffer(content, 0, 5);
            char[] buf = t.TermBuffer();
            copy = (TermAttributeImpl)TestSimpleAttributeImpls.AssertCopyIsEqual(t);
            Assert.AreEqual(t.Term(), copy.Term());
            Assert.AreNotSame(buf, copy.TermBuffer());
        }
コード例 #3
0
ファイル: TestToken.cs プロジェクト: maximburyak/lucenenet
        public virtual void  TestClone()
        {
            Token t = new Token(0, 5);

            char[] content = "hello".ToCharArray();
            t.SetTermBuffer(content, 0, 5);
            char[] buf  = t.TermBuffer();
            Token  copy = (Token)TestSimpleAttributeImpls.AssertCloneIsEqual(t);

            Assert.AreEqual(t.Term, copy.Term);
            Assert.AreNotSame(buf, copy.TermBuffer());

            Payload pl = new Payload(new byte[] { 1, 2, 3, 4 });

            t.Payload = pl;
            copy      = (Token)TestSimpleAttributeImpls.AssertCloneIsEqual(t);
            Assert.AreEqual(pl, copy.Payload);
            Assert.AreNotSame(pl, copy.Payload);
        }