Exemplo n.º 1
0
        public void UnitRdx_RemoveWhereB()
        {
            int n  = 2000;
            var rd = new RankedDictionary <int, int> {
                Capacity = 7
            };

            for (int ix = 0; ix < n; ++ix)
            {
                rd.Add(ix, -ix);
            }

            int removed = rd.RemoveWhere(IsAlways);

            Assert.AreEqual(n, removed);
            Assert.AreEqual(0, rd.Count);
        }
Exemplo n.º 2
0
        public void UnitRdx_RemoveWhereA()
        {
            var rd = new RankedDictionary <int, int>();

            for (int ix = 0; ix < 1000; ++ix)
            {
                rd.Add(ix, ix + 1000);
            }

            int c0      = rd.Count;
            int removed = rd.RemoveWhere(IsEven);

            Assert.AreEqual(500, removed);
            foreach (int key in rd.Keys)
            {
                Assert.IsTrue(key % 2 != 0);
            }
        }
Exemplo n.º 3
0
        public void CrashRd_RemoveWhere_ArgumentNull()
        {
            var rd = new RankedDictionary <int, int>();

            rd.RemoveWhere(null);
        }