MCPcopy
hub / github.com/redis/go-redis / TestHybridVectorBlob

Function TestHybridVectorBlob

search_commands_unit_test.go:29–118  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27}
28
29func TestHybridVectorBlob(t *testing.T) {
30 tests := []struct {
31 name string
32 vector Vector
33 want interface{}
34 wantErr string
35 }{
36 {
37 name: "fp32",
38 vector: &VectorFP32{Val: []byte{1, 2, 3, 4}},
39 want: []byte{1, 2, 3, 4},
40 },
41 {
42 name: "float16",
43 vector: &VectorFloat16{Val: []byte{1, 2, 3, 4}},
44 want: []byte{1, 2, 3, 4},
45 },
46 {
47 name: "bfloat16",
48 vector: &VectorBFloat16{Val: []byte{1, 2, 3, 4}},
49 want: []byte{1, 2, 3, 4},
50 },
51 {
52 name: "float64",
53 vector: &VectorFloat64{Val: []byte{1, 2, 3, 4}},
54 want: []byte{1, 2, 3, 4},
55 },
56 {
57 name: "int8",
58 vector: &VectorInt8{Val: []byte{1, 2, 3, 4}},
59 want: []byte{1, 2, 3, 4},
60 },
61 {
62 name: "uint8",
63 vector: &VectorUint8{Val: []byte{1, 2, 3, 4}},
64 want: []byte{1, 2, 3, 4},
65 },
66 {
67 name: "custom legacy vector",
68 vector: legacyHybridVector{value: []any{"CUSTOM", []byte{1, 2, 3, 4}}},
69 want: []byte{1, 2, 3, 4},
70 },
71 {
72 name: "nil",
73 vector: nil,
74 wantErr: "vector data is required",
75 },
76 {
77 name: "empty fp32",
78 vector: &VectorFP32{},
79 wantErr: "vector blob is required",
80 },
81 {
82 name: "values",
83 vector: &VectorValues{Val: []float64{1, 2}},
84 wantErr: "unsupported vector type *redis.VectorValues",
85 },
86 {

Callers

nothing calls this directly

Calls 4

hybridVectorBlobFunction · 0.85
RunMethod · 0.45
ContainsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected