File: escape_test.go

package info (click to toggle)
golang-github-zeebo-xxh3 1.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 780 kB
  • sloc: asm: 2,165; ansic: 32; makefile: 26
file content (53 lines) | stat: -rw-r--r-- 954 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package xxh3

import (
	"testing"

	"github.com/zeebo/assert"
)

func TestEscapes(t *testing.T) {
	cases := []struct {
		name string
		fn   func()
	}{
		{"Hash", func() {
			var buf [8]byte
			_ = Hash(buf[:])
		}},
		{"Hash128", func() {
			var buf [8]byte
			_ = Hash128(buf[:])
		}},
		{"HashString", func() {
			var buf [8]byte
			_ = HashString(string(buf[:]))
		}},
		{"HashString128", func() {
			var buf [8]byte
			_ = HashString128(string(buf[:]))
		}},
		{"HashSeed", func() {
			var buf [8]byte
			_ = HashSeed(buf[:], 1)
		}},
		{"Hash128Seed", func() {
			var buf [8]byte
			_ = Hash128Seed(buf[:], 1)
		}},
		{"HashStringSeed", func() {
			var buf [8]byte
			_ = HashStringSeed(string(buf[:]), 1)
		}},
		{"HashString128Seed", func() {
			var buf [8]byte
			_ = HashString128Seed(string(buf[:]), 1)
		}},
	}

	for _, c := range cases {
		t.Run(c.name, func(t *testing.T) {
			assert.Equal(t, testing.AllocsPerRun(100, c.fn), 0.0)
		})
	}
}