Example #1
0
        public void UnitRb_IndexOf()
        {
            var rb0 = new RankedBag <int>();
            var rb  = new RankedBag <int> {
                Capacity = 4
            };

            foreach (int x in new int[] { 3, 5, 5, 7, 7 })
            {
                rb.Add(x);
            }

            Assert.AreEqual(~0, rb0.IndexOf(9));

            Assert.AreEqual(~0, rb.IndexOf(2));
            Assert.AreEqual(0, rb.IndexOf(3));
            Assert.AreEqual(~1, rb.IndexOf(4));
            Assert.AreEqual(1, rb.IndexOf(5));
            Assert.AreEqual(~3, rb.IndexOf(6));
            Assert.AreEqual(3, rb.IndexOf(7));
            Assert.AreEqual(~5, rb.IndexOf(8));
        }