public void TestTermIntListAddCorrectOrder()
        {
            TermIntList tsl1 = new TermIntList("000");

            tsl1.Add(null);
            tsl1.Add("0");
            try
            {
                tsl1.Add("1");
                tsl1.Add("2");
                tsl1.Add("3");
            }
            catch (Exception e)
            {
                Assert.False(e.Message.Contains("ascending order"), "There should NOT be an exception and the message contains ascending order");
                return;
            }
            tsl1.Seal();
            Assert.AreEqual(1, tsl1.IndexOf(0), "Should skip index 0 which is used for dummy null");
        }
        public void TestDefaultIntFacetIterator()
        {
            string format = "00";
            List <IntFacetIterator> list = new List <IntFacetIterator>();

            for (int seg = 0; seg < 5; seg++)
            {
                TermIntList tsl1  = new TermIntList(format);
                int         limit = 25;
                BigIntArray count = new BigIntArray(limit);
                string[]    terms = new string[limit];
                for (int i = limit - 1; i >= 0; i--)
                {
                    terms[i] = i.ToString(format);
                }
                Array.Sort(terms);
                for (int i = 0; i < limit; i++)
                {
                    tsl1.Add(terms[i]);
                    count.Add(i, i);
                }
                tsl1.Seal();
                DefaultIntFacetIterator itr1 = new DefaultIntFacetIterator(tsl1, count, limit, true);
                list.Add(itr1);
            }
            CombinedIntFacetIterator ctr = new CombinedIntFacetIterator(list);
            string result = "";

            while (ctr.HasNext())
            {
                ctr.Next();
                result += (ctr.Facet + ":" + ctr.Count + " ");
            }
            string expected = "1:5 2:10 3:15 4:20 5:25 6:30 7:35 8:40 9:45 10:50 11:55 12:60 13:65 14:70 15:75 16:80 17:85 18:90 19:95 20:100 21:105 22:110 23:115 24:120 ";

            Assert.AreEqual(expected, result);
        }