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") } } }) }