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.
26 lines
384 B
26 lines
384 B
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")
|
|
}
|
|
}
|
|
})
|
|
}
|