1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
package cache
import (
"testing"
"time"
)
var newInMemoryCache = func(_ *testing.T, defaultExpiration time.Duration) Cache {
return NewInMemoryCache(defaultExpiration)
}
// Test typical cache interactions
func TestInMemoryCache_TypicalGetSet(t *testing.T) {
typicalGetSet(t, newInMemoryCache)
}
// Test the increment-decrement cases
func TestInMemoryCache_IncrDecr(t *testing.T) {
incrDecr(t, newInMemoryCache)
}
func TestInMemoryCache_Expiration(t *testing.T) {
expiration(t, newInMemoryCache)
}
func TestInMemoryCache_EmptyCache(t *testing.T) {
emptyCache(t, newInMemoryCache)
}
func TestInMemoryCache_Replace(t *testing.T) {
testReplace(t, newInMemoryCache)
}
func TestInMemoryCache_Add(t *testing.T) {
testAdd(t, newInMemoryCache)
}
func TestInMemoryCache_GetMulti(t *testing.T) {
testGetMulti(t, newInMemoryCache)
}
|