Example #1
0
 def test_reset(self):
     cache = LRUCache(2)
     cache.put(1, 'One')
     cache.put(2, 'Two')
     cache.reset()
     result = len(cache.cache)
     self.assertEqual(result, 0, 'Reset test Passed')
Example #2
0
File: main.py Project: rr8shah/LRU
from LRU import LRUCache
'''
This code creates the cache memory and executes 
some of the methods for demonstration purpose

'''

cache = LRUCache(2)
cache.put(1, 1)
cache.put(2, 2)
cache.get(1)
cache.put(3, 3)
cache._print()
cache.get(2)
cache.put(4, 4)
cache._print()
cache.get(3)
cache.get(4)
cache.get(2)
cache._del(4)
cache._print()
cache.get(4)
cache.reset()
cache._print()
cache.get(1)
Example #3
0
 def test_reset(self):
     lru = LRUCache(3)
     self._put(lru)
     lru.reset()
     assert lru.get(1) == -1
     assert lru.get(2) == -1