MCPcopy
hub / github.com/austingebauer/go-leetcode / TestLRUCache_6

Function TestLRUCache_6

lru_cache_146/solution_test.go:78–86  ·  view source on GitHub ↗

* ["LRUCache","put","put","get","put","put","get"] [[2],[2,1],[2,2],[2],[1,1],[4,1],[2]] Output: [null,null,null,null,null,1,-1] Expected: [null,null,null,null,null,-1,3] */

(t *testing.T)

Source from the content-addressed store, hash-verified

76Expected: [null,null,null,null,null,-1,3]
77*/
78func TestLRUCache_6(t *testing.T) {
79 cache := Constructor(2)
80 cache.Put(2, 1)
81 cache.Put(2, 2)
82 assert.Equal(t, 2, cache.Get(2))
83 cache.Put(1, 1)
84 cache.Put(4, 1)
85 assert.Equal(t, -1, cache.Get(2))
86}
87
88/*
89["LRUCache","get","put","get","put","put","get","get"]

Callers

nothing calls this directly

Calls 3

PutMethod · 0.80
ConstructorFunction · 0.70
GetMethod · 0.45

Tested by

no test coverage detected