2016-03-03 09:39:19 +01:00
|
|
|
// Copyright 2016 The Chihaya Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by the BSD 2-Clause license,
|
|
|
|
// which can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package memory
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2016-05-01 23:56:07 +02:00
|
|
|
|
|
|
|
"github.com/chihaya/chihaya/server/store"
|
2016-03-03 09:39:19 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2016-06-19 18:50:21 +02:00
|
|
|
driver = &stringStoreDriver{}
|
|
|
|
stringStoreTester = store.PrepareStringStoreTester(driver)
|
|
|
|
stringStoreBenchmarker = store.PrepareStringStoreBenchmarker(&stringStoreDriver{})
|
2016-03-03 09:39:19 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestStringStore(t *testing.T) {
|
2016-06-19 18:49:43 +02:00
|
|
|
stringStoreTester.TestStringStore(t, &store.DriverConfig{})
|
2016-03-03 09:39:19 +01:00
|
|
|
}
|
2016-06-19 18:50:21 +02:00
|
|
|
|
|
|
|
func BenchmarkStringStore_AddShort(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.AddShort(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_AddLong(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.AddLong(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_LookupShort(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.LookupShort(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_LookupLong(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.LookupLong(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_AddRemoveShort(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.AddRemoveShort(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_AddRemoveLong(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.AddRemoveLong(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_LookupNonExistShort(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.LookupNonExistShort(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_LookupNonExistLong(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.LookupNonExistLong(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_RemoveNonExistShort(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.RemoveNonExistShort(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_RemoveNonExistLong(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.RemoveNonExistLong(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_Add1KShort(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.Add1KShort(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_Add1KLong(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.Add1KLong(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_Lookup1KShort(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.Lookup1KShort(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_Lookup1KLong(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.Lookup1KLong(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_AddRemove1KShort(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.AddRemove1KShort(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_AddRemove1KLong(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.AddRemove1KLong(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_LookupNonExist1KShort(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.LookupNonExist1KShort(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_LookupNonExist1KLong(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.LookupNonExist1KLong(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_RemoveNonExist1KShort(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.RemoveNonExist1KShort(b, &store.DriverConfig{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func BenchmarkStringStore_RemoveNonExist1KLong(b *testing.B) {
|
|
|
|
stringStoreBenchmarker.RemoveNonExist1KLong(b, &store.DriverConfig{})
|
|
|
|
}
|