...

Source file src/github.com/zeebo/xxh3/escape_test.go

Documentation: github.com/zeebo/xxh3

     1  package xxh3
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/zeebo/assert"
     7  )
     8  
     9  func TestEscapes(t *testing.T) {
    10  	cases := []struct {
    11  		name string
    12  		fn   func()
    13  	}{
    14  		{"Hash", func() {
    15  			var buf [8]byte
    16  			_ = Hash(buf[:])
    17  		}},
    18  		{"Hash128", func() {
    19  			var buf [8]byte
    20  			_ = Hash128(buf[:])
    21  		}},
    22  		{"HashString", func() {
    23  			var buf [8]byte
    24  			_ = HashString(string(buf[:]))
    25  		}},
    26  		{"HashString128", func() {
    27  			var buf [8]byte
    28  			_ = HashString128(string(buf[:]))
    29  		}},
    30  		{"HashSeed", func() {
    31  			var buf [8]byte
    32  			_ = HashSeed(buf[:], 1)
    33  		}},
    34  		{"Hash128Seed", func() {
    35  			var buf [8]byte
    36  			_ = Hash128Seed(buf[:], 1)
    37  		}},
    38  		{"HashStringSeed", func() {
    39  			var buf [8]byte
    40  			_ = HashStringSeed(string(buf[:]), 1)
    41  		}},
    42  		{"HashString128Seed", func() {
    43  			var buf [8]byte
    44  			_ = HashString128Seed(string(buf[:]), 1)
    45  		}},
    46  	}
    47  
    48  	for _, c := range cases {
    49  		t.Run(c.name, func(t *testing.T) {
    50  			assert.Equal(t, testing.AllocsPerRun(100, c.fn), 0.0)
    51  		})
    52  	}
    53  }
    54  

View as plain text