Ejemplo n.º 1
0
        public virtual void TestEmpty()
        {
            PrefixCodedTerms.Builder b  = new PrefixCodedTerms.Builder();
            PrefixCodedTerms         pb = b.Finish();

            Assert.IsFalse(pb.GetEnumerator().MoveNext());
        }
Ejemplo n.º 2
0
        public virtual void TestOne()
        {
            Term term = new Term("foo", "bogus");

            PrefixCodedTerms.Builder b = new PrefixCodedTerms.Builder();
            b.Add(term);
            PrefixCodedTerms   pb       = b.Finish();
            IEnumerator <Term> iterator = pb.GetEnumerator();

            Assert.IsTrue(iterator.MoveNext());
            Assert.AreEqual(term, iterator.Current);
        }
Ejemplo n.º 3
0
        public virtual void TestMergeOne()
        {
            Term t1 = new Term("foo", "a");

            PrefixCodedTerms.Builder b1 = new PrefixCodedTerms.Builder();
            b1.Add(t1);
            PrefixCodedTerms pb1 = b1.Finish();

            Term t2 = new Term("foo", "b");

            PrefixCodedTerms.Builder b2 = new PrefixCodedTerms.Builder();
            b2.Add(t2);
            PrefixCodedTerms pb2 = b2.Finish();

            IEnumerator <Term> merged = new MergedEnumerator <Term>(pb1.GetEnumerator(), pb2.GetEnumerator());

            Assert.IsTrue(merged.MoveNext());
            Assert.AreEqual(t1, merged.Current);
            Assert.IsTrue(merged.MoveNext());
            Assert.AreEqual(t2, merged.Current);
        }