| 1 |
package memstore_test |
| 2 |
|
| 3 |
import ( |
| 4 |
"testing" |
| 5 |
|
| 6 |
"github.com/throttled/throttled/store/memstore" |
| 7 |
"github.com/throttled/throttled/store/storetest" |
| 8 |
) |
| 9 |
|
| 10 |
func TestMemStoreLRU(t *testing.T) { |
| 11 |
st, err := memstore.New(10) |
| 12 |
if err != nil { |
| 13 |
t.Fatal(err) |
| 14 |
} |
| 15 |
storetest.TestGCRAStore(t, st) |
| 16 |
} |
| 17 |
|
| 18 |
func TestMemStoreUnlimited(t *testing.T) { |
| 19 |
st, err := memstore.New(10) |
| 20 |
if err != nil { |
| 21 |
t.Fatal(err) |
| 22 |
} |
| 23 |
storetest.TestGCRAStore(t, st) |
| 24 |
} |
| 25 |
|
| 26 |
func BenchmarkMemStoreLRU(b *testing.B) { |
| 27 |
st, err := memstore.New(10) |
| 28 |
if err != nil { |
| 29 |
b.Fatal(err) |
| 30 |
} |
| 31 |
storetest.BenchmarkGCRAStore(b, st) |
| 32 |
} |
| 33 |
|
| 34 |
func BenchmarkMemStoreUnlimited(b *testing.B) { |
| 35 |
st, err := memstore.New(0) |
| 36 |
if err != nil { |
| 37 |
b.Fatal(err) |
| 38 |
} |
| 39 |
storetest.BenchmarkGCRAStore(b, st) |
| 40 |
} |