MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / TestVector

Function TestVector

query/math_test.go:49–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestVector(t *testing.T) {
50 tree := &mathTree{
51 Fn: "sqrt",
52 Child: []*mathTree{{
53 Fn: "dot",
54 Child: []*mathTree{
55 {
56 Fn: "-",
57 Child: []*mathTree{
58 {
59 Var: "v1",
60 Val: createShardedMap(0, types.Val{Tid: types.VFloatID, Value: []float32{1.0, 2.0}}),
61 },
62 {
63 Var: "v2",
64 Val: createShardedMap(123, types.Val{Tid: types.VFloatID, Value: []float32{1.0, 2.0}}),
65 },
66 },
67 },
68 {
69 Fn: "-",
70 Child: []*mathTree{
71 {
72 Var: "v1",
73 Val: createShardedMap(0, types.Val{Tid: types.VFloatID, Value: []float32{1.0, 2.0}}),
74 },
75 {
76 Var: "v2",
77 Val: createShardedMap(123, types.Val{Tid: types.VFloatID, Value: []float32{1.0, 2.0}}),
78 },
79 },
80 },
81 },
82 }},
83 }
84
85 require.NoError(t, evalMathTree(tree))
86}
87
88func TestProcessBinary(t *testing.T) {
89 tests := []struct {

Callers

nothing calls this directly

Calls 2

createShardedMapFunction · 0.85
evalMathTreeFunction · 0.85

Tested by

no test coverage detected