MCPcopy Index your code
hub / github.com/coder/hnsw / Test_binaryWrite_string

Function Test_binaryWrite_string

encode_test.go:35–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func Test_binaryWrite_string(t *testing.T) {
36 buf := bytes.NewBuffer(nil)
37 s := "hello"
38
39 n, err := binaryWrite(buf, s)
40 require.NoError(t, err)
41 // 5 bytes for the string, 1 byte for the length.
42 require.Equal(t, 5+1, n)
43
44 var s2 string
45 _, err = binaryRead(buf, &s2)
46 require.NoError(t, err)
47 require.Equal(t, "hello", s2)
48
49 require.Empty(t, buf.Bytes())
50}
51
52func verifyGraphNodes[K cmp.Ordered](t *testing.T, g *Graph[K]) {
53 for _, layer := range g.layers {

Callers

nothing calls this directly

Calls 2

binaryWriteFunction · 0.85
binaryReadFunction · 0.85

Tested by

no test coverage detected