You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
398 B

package singleton
import "testing"
func TestGetLazyInstance(t *testing.T) {
if GetLazyInstance() != GetLazyInstance() {
t.Fatal("lazy instance failed")
} else {
t.Log("lazy instance succeeded")
}
}
func BenchmarkGetLazyInstance(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
if GetLazyInstance() != GetLazyInstance() {
b.Errorf("test fail")
}
}
})
}