xxhash_unsafe_test.go 402 字节
Newer Older
Y
Your Name 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
// +build !appengine

package xxhash

import (
	"strings"
	"testing"
)

func TestStringAllocs(t *testing.T) {
	longStr := strings.Repeat("a", 1000)
	t.Run("Sum64String", func(t *testing.T) {
		testAllocs(t, func() {
			sink = Sum64String(longStr)
		})
	})
	t.Run("Digest.WriteString", func(t *testing.T) {
		testAllocs(t, func() {
			d := New()
			d.WriteString(longStr)
			sink = d.Sum64()
		})
	})
}