github.com/timandy/routine@v1.1.4-0.20240507073150-e4a3e1fe2ba5/api_goid_test.go (about) 1 package routine 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestGoid(t *testing.T) { 10 assert.NotEqual(t, 0, Goid()) 11 assert.Equal(t, Goid(), Goid()) 12 } 13 14 //=== 15 16 // BenchmarkGoid-8 331324310 3.589 ns/op 0 B/op 0 allocs/op 17 func BenchmarkGoid(b *testing.B) { 18 b.ReportAllocs() 19 b.ResetTimer() 20 for i := 0; i < b.N; i++ { 21 _ = Goid() 22 } 23 }