Exemplo n.º 1
0
def test_get():
    """Get an item => size remains the same"""
    lru = LRUCache(10)

    for i in range(0, 10):
        lru.put(i, str(i))

    val = lru.get(1)

    assert lru.currentsize == 10
Exemplo n.º 2
0
    lru = LRUCache(3)
    
    for i in range(0,3):
        lru.put(i, str(i)) 
    
    print(lru._printForward())

    lru.reset()

    lru.put(0, 'a')
    lru.put(1, 'b')
    lru.put(2, 'c')

    print(lru._printForward())

    lru.get(1)
    #lru.reset()

    lru.put(1, 'a')
    
    print(lru._printForward())
    print("-")

    lru.delete(2)

    print(lru._printForward())
    print("-")

    lru.delete(3)

    print(lru._printForward())