Merge pull request #194 from mrd0ll4r/stringstore-smallfix
memory: clean up tests
This commit is contained in:
commit
250725179e
2 changed files with 64 additions and 63 deletions
|
@ -20,6 +20,7 @@ var (
|
|||
|
||||
ipStoreTester = store.PrepareIPStoreTester(&ipStoreDriver{})
|
||||
ipStoreBenchmarker = store.PrepareIPStoreBenchmarker(&ipStoreDriver{})
|
||||
ipStoreTestConfig = &store.DriverConfig{}
|
||||
)
|
||||
|
||||
func TestKey(t *testing.T) {
|
||||
|
@ -39,161 +40,161 @@ func TestKey(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestIPStore(t *testing.T) {
|
||||
ipStoreTester.TestIPStore(t, &store.DriverConfig{})
|
||||
ipStoreTester.TestIPStore(t, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func TestHasAllHasAny(t *testing.T) {
|
||||
ipStoreTester.TestHasAllHasAny(t, &store.DriverConfig{})
|
||||
ipStoreTester.TestHasAllHasAny(t, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func TestNetworks(t *testing.T) {
|
||||
ipStoreTester.TestNetworks(t, &store.DriverConfig{})
|
||||
ipStoreTester.TestNetworks(t, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func TestHasAllHasAnyNetworks(t *testing.T) {
|
||||
ipStoreTester.TestHasAllHasAnyNetworks(t, &store.DriverConfig{})
|
||||
ipStoreTester.TestHasAllHasAnyNetworks(t, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddV4(b *testing.B) {
|
||||
ipStoreBenchmarker.AddV4(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddV4(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddV6(b *testing.B) {
|
||||
ipStoreBenchmarker.AddV6(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddV6(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_LookupV4(b *testing.B) {
|
||||
ipStoreBenchmarker.LookupV4(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.LookupV4(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_LookupV6(b *testing.B) {
|
||||
ipStoreBenchmarker.LookupV6(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.LookupV6(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddRemoveV4(b *testing.B) {
|
||||
ipStoreBenchmarker.AddRemoveV4(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddRemoveV4(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddRemoveV6(b *testing.B) {
|
||||
ipStoreBenchmarker.AddRemoveV6(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddRemoveV6(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_LookupNonExistV4(b *testing.B) {
|
||||
ipStoreBenchmarker.LookupNonExistV4(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.LookupNonExistV4(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_LookupNonExistV6(b *testing.B) {
|
||||
ipStoreBenchmarker.LookupNonExistV6(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.LookupNonExistV6(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_RemoveNonExistV4(b *testing.B) {
|
||||
ipStoreBenchmarker.RemoveNonExistV4(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.RemoveNonExistV4(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_RemoveNonExistV6(b *testing.B) {
|
||||
ipStoreBenchmarker.RemoveNonExistV6(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.RemoveNonExistV6(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddV4Network(b *testing.B) {
|
||||
ipStoreBenchmarker.AddV4Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddV4Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddV6Network(b *testing.B) {
|
||||
ipStoreBenchmarker.AddV6Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddV6Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_LookupV4Network(b *testing.B) {
|
||||
ipStoreBenchmarker.LookupV4Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.LookupV4Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_LookupV6Network(b *testing.B) {
|
||||
ipStoreBenchmarker.LookupV6Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.LookupV6Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddRemoveV4Network(b *testing.B) {
|
||||
ipStoreBenchmarker.AddRemoveV4Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddRemoveV4Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddRemoveV6Network(b *testing.B) {
|
||||
ipStoreBenchmarker.AddRemoveV6Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddRemoveV6Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_RemoveNonExistV4Network(b *testing.B) {
|
||||
ipStoreBenchmarker.RemoveNonExistV4Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.RemoveNonExistV4Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_RemoveNonExistV6Network(b *testing.B) {
|
||||
ipStoreBenchmarker.RemoveNonExistV6Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.RemoveNonExistV6Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_Add1KV4(b *testing.B) {
|
||||
ipStoreBenchmarker.Add1KV4(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.Add1KV4(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_Add1KV6(b *testing.B) {
|
||||
ipStoreBenchmarker.Add1KV6(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.Add1KV6(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_Lookup1KV4(b *testing.B) {
|
||||
ipStoreBenchmarker.Lookup1KV4(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.Lookup1KV4(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_Lookup1KV6(b *testing.B) {
|
||||
ipStoreBenchmarker.Lookup1KV6(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.Lookup1KV6(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddRemove1KV4(b *testing.B) {
|
||||
ipStoreBenchmarker.AddRemove1KV4(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddRemove1KV4(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddRemove1KV6(b *testing.B) {
|
||||
ipStoreBenchmarker.AddRemove1KV6(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddRemove1KV6(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_LookupNonExist1KV4(b *testing.B) {
|
||||
ipStoreBenchmarker.LookupNonExist1KV4(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.LookupNonExist1KV4(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_LookupNonExist1KV6(b *testing.B) {
|
||||
ipStoreBenchmarker.LookupNonExist1KV6(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.LookupNonExist1KV6(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_RemoveNonExist1KV4(b *testing.B) {
|
||||
ipStoreBenchmarker.RemoveNonExist1KV4(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.RemoveNonExist1KV4(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_RemoveNonExist1KV6(b *testing.B) {
|
||||
ipStoreBenchmarker.RemoveNonExist1KV6(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.RemoveNonExist1KV6(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_Add1KV4Network(b *testing.B) {
|
||||
ipStoreBenchmarker.Add1KV4Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.Add1KV4Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_Add1KV6Network(b *testing.B) {
|
||||
ipStoreBenchmarker.Add1KV6Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.Add1KV6Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_Lookup1KV4Network(b *testing.B) {
|
||||
ipStoreBenchmarker.Lookup1KV4Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.Lookup1KV4Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_Lookup1KV6Network(b *testing.B) {
|
||||
ipStoreBenchmarker.Lookup1KV6Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.Lookup1KV6Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddRemove1KV4Network(b *testing.B) {
|
||||
ipStoreBenchmarker.AddRemove1KV4Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddRemove1KV4Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_AddRemove1KV6Network(b *testing.B) {
|
||||
ipStoreBenchmarker.AddRemove1KV6Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.AddRemove1KV6Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_RemoveNonExist1KV4Network(b *testing.B) {
|
||||
ipStoreBenchmarker.RemoveNonExist1KV4Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.RemoveNonExist1KV4Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkIPStore_RemoveNonExist1KV6Network(b *testing.B) {
|
||||
ipStoreBenchmarker.RemoveNonExist1KV6Network(b, &store.DriverConfig{})
|
||||
ipStoreBenchmarker.RemoveNonExist1KV6Network(b, ipStoreTestConfig)
|
||||
}
|
||||
|
|
|
@ -11,91 +11,91 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
driver = &stringStoreDriver{}
|
||||
stringStoreTester = store.PrepareStringStoreTester(driver)
|
||||
stringStoreTester = store.PrepareStringStoreTester(&stringStoreDriver{})
|
||||
stringStoreBenchmarker = store.PrepareStringStoreBenchmarker(&stringStoreDriver{})
|
||||
stringStoreTestConfig = &store.DriverConfig{}
|
||||
)
|
||||
|
||||
func TestStringStore(t *testing.T) {
|
||||
stringStoreTester.TestStringStore(t, &store.DriverConfig{})
|
||||
stringStoreTester.TestStringStore(t, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_AddShort(b *testing.B) {
|
||||
stringStoreBenchmarker.AddShort(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.AddShort(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_AddLong(b *testing.B) {
|
||||
stringStoreBenchmarker.AddLong(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.AddLong(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_LookupShort(b *testing.B) {
|
||||
stringStoreBenchmarker.LookupShort(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.LookupShort(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_LookupLong(b *testing.B) {
|
||||
stringStoreBenchmarker.LookupLong(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.LookupLong(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_AddRemoveShort(b *testing.B) {
|
||||
stringStoreBenchmarker.AddRemoveShort(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.AddRemoveShort(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_AddRemoveLong(b *testing.B) {
|
||||
stringStoreBenchmarker.AddRemoveLong(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.AddRemoveLong(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_LookupNonExistShort(b *testing.B) {
|
||||
stringStoreBenchmarker.LookupNonExistShort(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.LookupNonExistShort(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_LookupNonExistLong(b *testing.B) {
|
||||
stringStoreBenchmarker.LookupNonExistLong(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.LookupNonExistLong(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_RemoveNonExistShort(b *testing.B) {
|
||||
stringStoreBenchmarker.RemoveNonExistShort(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.RemoveNonExistShort(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_RemoveNonExistLong(b *testing.B) {
|
||||
stringStoreBenchmarker.RemoveNonExistLong(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.RemoveNonExistLong(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_Add1KShort(b *testing.B) {
|
||||
stringStoreBenchmarker.Add1KShort(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.Add1KShort(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_Add1KLong(b *testing.B) {
|
||||
stringStoreBenchmarker.Add1KLong(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.Add1KLong(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_Lookup1KShort(b *testing.B) {
|
||||
stringStoreBenchmarker.Lookup1KShort(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.Lookup1KShort(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_Lookup1KLong(b *testing.B) {
|
||||
stringStoreBenchmarker.Lookup1KLong(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.Lookup1KLong(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_AddRemove1KShort(b *testing.B) {
|
||||
stringStoreBenchmarker.AddRemove1KShort(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.AddRemove1KShort(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_AddRemove1KLong(b *testing.B) {
|
||||
stringStoreBenchmarker.AddRemove1KLong(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.AddRemove1KLong(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_LookupNonExist1KShort(b *testing.B) {
|
||||
stringStoreBenchmarker.LookupNonExist1KShort(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.LookupNonExist1KShort(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_LookupNonExist1KLong(b *testing.B) {
|
||||
stringStoreBenchmarker.LookupNonExist1KLong(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.LookupNonExist1KLong(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_RemoveNonExist1KShort(b *testing.B) {
|
||||
stringStoreBenchmarker.RemoveNonExist1KShort(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.RemoveNonExist1KShort(b, stringStoreTestConfig)
|
||||
}
|
||||
|
||||
func BenchmarkStringStore_RemoveNonExist1KLong(b *testing.B) {
|
||||
stringStoreBenchmarker.RemoveNonExist1KLong(b, &store.DriverConfig{})
|
||||
stringStoreBenchmarker.RemoveNonExist1KLong(b, stringStoreTestConfig)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue