Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
nikkicoon committed Jun 25, 2024
1 parent 3fecbe5 commit 2e5c1a4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkg/hashing_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package pkg_test

import (
"github.com/nikkicoon/utility-go/pkg"
"github.com/stretchr/testify/assert"
"testing"
)

func TestCalculateHash(t *testing.T) {
res := pkg.CalculateHashBin("test")
assert.Equal(t, []byte{0xa9, 0x4a, 0x8f, 0xe5, 0xcc, 0xb1, 0x9b, 0xa6, 0x1c, 0x4c, 0x8, 0x73, 0xd3, 0x91, 0xe9, 0x87, 0x98, 0x2f, 0xbb, 0xd3}, res)
}

func BenchmarkCalculateHash(b *testing.B) {
for n := 0; n < 6000000; n++ {
pkg.CalculateHashBin("test")
}
b.Elapsed()
}

func BenchmarkCalculateHashGoRoutines(b *testing.B) {
for n := 0; n < 6000000; n++ {
go pkg.CalculateHashBin("test")
}
b.Elapsed()
}

0 comments on commit 2e5c1a4

Please sign in to comment.