Exemple #1
0
        public void EvenDistributionLRU()
        {
            var cache = CacheBuilder.SetAssociative_LRU <int, int>(3, 3);

            //add 1 to 12
            for (int i = 1; i <= 12; i++)
            {
                cache.Add(i, i);
            }

            //verify keys 1 to 3 are gone
            for (int i = 1; i <= 3; i++)
            {
                Assert.False(cache.ContainsKey(i));
            }
        }
Exemple #2
0
        public void HoldsCapacity()
        {
            var cache = CacheBuilder.SetAssociative_LRU <int, int>(3, 3);

            //add 1 to 9
            for (int i = 1; i <= 9; i++)
            {
                cache.Add(i, i);
            }

            //verify all keys are there
            for (int i = 1; i <= 9; i++)
            {
                Assert.IsTrue(cache.ContainsKey(i));
            }
        }