MCPcopy
hub / github.com/coder/websocket / Test_slidingWindow

Function Test_slidingWindow

compress_test.go:20–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18)
19
20func Test_slidingWindow(t *testing.T) {
21 t.Parallel()
22
23 const testCount = 99
24 const maxWindow = 99999
25 for range testCount {
26 t.Run("", func(t *testing.T) {
27 t.Parallel()
28
29 input := xrand.String(maxWindow)
30 windowLength := xrand.Int(maxWindow)
31 var sw slidingWindow
32 sw.init(windowLength)
33 sw.write([]byte(input))
34
35 assert.Equal(t, "window length", windowLength, cap(sw.buf))
36 if !strings.HasSuffix(input, string(sw.buf)) {
37 t.Fatalf("r.buf is not a suffix of input: %q and %q", input, sw.buf)
38 }
39 })
40 }
41}
42
43func BenchmarkFlateWriter(b *testing.B) {
44 b.ReportAllocs()

Callers

nothing calls this directly

Calls 5

initMethod · 0.95
writeMethod · 0.95
StringFunction · 0.92
IntFunction · 0.92
EqualFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…