An attempt at catching race issues

This commit is contained in:
Bruce Marriner 2019-04-10 01:02:19 +00:00
parent 68117e6bbe
commit 1d51515945

View File

@ -6,6 +6,25 @@ import (
"testing" "testing"
) )
// I feel like there's probably a better way
func TestRace(t *testing.T) {
node, _ := NewNode(1)
go func() {
for i := 0; i < 1000000000; i++ {
NewNode(1)
}
}()
for i := 0; i < 4000; i++ {
node.Generate()
}
}
func TestMarshalJSON(t *testing.T) { func TestMarshalJSON(t *testing.T) {
id := ID(13587) id := ID(13587)
expected := "\"13587\"" expected := "\"13587\""
@ -112,6 +131,7 @@ func TestBase58(t *testing.T) {
} }
} }
} }
func BenchmarkParseBase58(b *testing.B) { func BenchmarkParseBase58(b *testing.B) {
node, _ := NewNode(1) node, _ := NewNode(1)