utils_test.go 425 B

123456789101112131415161718
  1. package resolvconf
  2. import "testing"
  3. func TestHashData(t *testing.T) {
  4. const expected = "sha256:4d11186aed035cc624d553e10db358492c84a7cd6b9670d92123c144930450aa"
  5. if actual := hashData([]byte("hash-me")); actual != expected {
  6. t.Fatalf("Expecting %s, got %s", expected, actual)
  7. }
  8. }
  9. func BenchmarkHashData(b *testing.B) {
  10. b.ReportAllocs()
  11. data := []byte("hash-me")
  12. for i := 0; i < b.N; i++ {
  13. _ = hashData(data)
  14. }
  15. }