fix bench tests (#47)
This commit is contained in:
parent
f50e09f2ad
commit
f7f8c28148
15
db_test.go
15
db_test.go
|
@ -233,9 +233,16 @@ func BenchmarkSliceInterfaceQuery(b *testing.B) {
|
||||||
b.Error(err)
|
b.Error(err)
|
||||||
}
|
}
|
||||||
b.Log(slice)
|
b.Log(slice)
|
||||||
|
switch slice[1].(type) {
|
||||||
|
case *string:
|
||||||
if *slice[1].(*string) != "xlw" {
|
if *slice[1].(*string) != "xlw" {
|
||||||
b.Error(errors.New("name should be xlw"))
|
b.Error(errors.New("name should be xlw"))
|
||||||
}
|
}
|
||||||
|
case []byte:
|
||||||
|
if string(slice[1].([]byte)) != "xlw" {
|
||||||
|
b.Error(errors.New("name should be xlw"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rows.Close()
|
rows.Close()
|
||||||
|
@ -380,10 +387,18 @@ func BenchmarkMapInterfaceQuery(b *testing.B) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Error(err)
|
b.Error(err)
|
||||||
}
|
}
|
||||||
|
switch m["name"].(type) {
|
||||||
|
case string:
|
||||||
if m["name"].(string) != "xlw" {
|
if m["name"].(string) != "xlw" {
|
||||||
b.Log(m)
|
b.Log(m)
|
||||||
b.Error(errors.New("name should be xlw"))
|
b.Error(errors.New("name should be xlw"))
|
||||||
}
|
}
|
||||||
|
case []byte:
|
||||||
|
if string(m["name"].([]byte)) != "xlw" {
|
||||||
|
b.Log(m)
|
||||||
|
b.Error(errors.New("name should be xlw"))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rows.Close()
|
rows.Close()
|
||||||
|
|
Loading…
Reference in New Issue