package singleton import ( "testing" ) func TestHunger(t *testing.T) { s1 := GetHungerInstance() s2 := GetHungerInstance() if s1 == s2 { t.Log("success") } else { t.Fatal("failure") } } func BenchmarkHunger(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { if GetHungerInstance() != GetHungerInstance() { b.Errorf("test fail") } } }) }