MCPcopy
hub / github.com/gorilla/websocket / TestMaskBytes

Function TestMaskBytes

mask_test.go:31–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func TestMaskBytes(t *testing.T) {
32 key := [4]byte{1, 2, 3, 4}
33 for size := 1; size <= 1024; size++ {
34 for align := 0; align < wordSize; align++ {
35 for pos := 0; pos < 4; pos++ {
36 b := make([]byte, size+align)[align:]
37 maskBytes(key, pos, b)
38 maskBytesByByte(key, pos, b)
39 if i := notzero(b); i >= 0 {
40 t.Errorf("size:%d, align:%d, pos:%d, offset:%d", size, align, pos, i)
41 }
42 }
43 }
44 }
45}
46
47func BenchmarkMaskBytes(b *testing.B) {
48 for _, size := range []int{2, 4, 8, 16, 32, 512, 1024} {

Callers

nothing calls this directly

Calls 3

maskBytesByByteFunction · 0.85
notzeroFunction · 0.85
maskBytesFunction · 0.70

Tested by

no test coverage detected