github.com/liangmanlin/routine@v1.1.0/api_goid_test.go (about)

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