示例#1
0
        public void LFUCache_2()
        {
            _0460_LFUCache cache = new _0460_LFUCache(2);

            cache.Put(2, 1);
            Assert.AreEqual(1, cache.Get(2));
        }
示例#2
0
        public void LFUCache_3()
        {
            _0460_LFUCache cache = new _0460_LFUCache(2);

            cache.Put(3, 1);
            cache.Put(2, 1);
            cache.Put(2, 2);
            cache.Put(4, 4);
            Assert.AreEqual(2, cache.Get(2));
        }
示例#3
0
        public void LFUCache_1()
        {
            _0460_LFUCache cache = new _0460_LFUCache(2);

            cache.Put(1, 1);
            cache.Put(2, 2);
            Assert.AreEqual(1, cache.Get(1));
            cache.Put(3, 3);
            Assert.AreEqual(-1, cache.Get(2));
            Assert.AreEqual(3, cache.Get(3));
            cache.Put(4, 4);
            Assert.AreEqual(-1, cache.Get(1));
            Assert.AreEqual(3, cache.Get(3));
            Assert.AreEqual(4, cache.Get(4));
        }