Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
TestGoroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
YamiOdymel committed Sep 7, 2020
1 parent c5cb54c commit 575e79b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions trillium_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,40 @@ func TestTimeout(t *testing.T) {
}
}

func TestGoroutine(t *testing.T) {
assert := assert.New(t)
tri := New(DefaultConfig())

done := make(chan bool, 2)
go func() {
var i int
for {
if i > 512 {
done <- true
break
}
i++

_, err := tri.Generate()
assert.NoError(err)
}
}()
go func() {
var i int
for {
if i > 512 {
done <- true
break
}
i++

_, err := tri.Generate()
assert.NoError(err)
}
}()
<-done
}

func BenchmarkUint64(b *testing.B) {
t := New(DefaultConfig())
b.ReportAllocs()
Expand Down

0 comments on commit 575e79b

Please sign in to comment.