MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / TestProcessBinary

Function TestProcessBinary

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

Source from the content-addressed store, hash-verified

86}
87
88func TestProcessBinary(t *testing.T) {
89 tests := []struct {
90 in *mathTree
91 out types.Val
92 }{
93 {in: &mathTree{
94 Fn: "+",
95 Child: []*mathTree{
96 {Const: types.Val{Tid: types.IntID, Value: int64(2)}},
97 {Const: types.Val{Tid: types.IntID, Value: int64(2)}},
98 }},
99 out: types.Val{Tid: types.IntID, Value: int64(4)},
100 },
101 {in: &mathTree{
102 Fn: "+",
103 Child: []*mathTree{
104 {Const: types.Val{Tid: types.FloatID, Value: float64(2)}},
105 {Const: types.Val{Tid: types.IntID, Value: int64(2)}},
106 }},
107 out: types.Val{Tid: types.FloatID, Value: float64(4)},
108 },
109 {in: &mathTree{
110 Fn: "+",
111 Child: []*mathTree{
112 {Const: types.Val{Tid: types.FloatID, Value: float64(2)}},
113 {Const: types.Val{Tid: types.FloatID, Value: float64(2)}},
114 }},
115 out: types.Val{Tid: types.FloatID, Value: float64(4)},
116 },
117 {in: &mathTree{
118 Fn: "+",
119 Child: []*mathTree{
120 {Const: types.Val{Tid: types.IntID, Value: int64(48038396025285290)}},
121 {Const: types.Val{Tid: types.IntID, Value: int64(2)}},
122 }},
123 out: types.Val{Tid: types.IntID, Value: int64(48038396025285292)},
124 },
125 {in: &mathTree{
126 Fn: "-",
127 Child: []*mathTree{
128 {Const: types.Val{Tid: types.IntID, Value: int64(100)}},
129 {Const: types.Val{Tid: types.IntID, Value: int64(1)}},
130 }},
131 out: types.Val{Tid: types.IntID, Value: int64(99)},
132 },
133 {in: &mathTree{
134 Fn: "-",
135 Child: []*mathTree{
136 {Const: types.Val{Tid: types.FloatID, Value: float64(100)}},
137 {Const: types.Val{Tid: types.IntID, Value: int64(1)}},
138 }},
139 out: types.Val{Tid: types.FloatID, Value: float64(99)},
140 },
141 {in: &mathTree{
142 Fn: "-",
143 Child: []*mathTree{
144 {Const: types.Val{Tid: types.FloatID, Value: float64(100)}},
145 {Const: types.Val{Tid: types.FloatID, Value: float64(1)}},

Callers

nothing calls this directly

Calls 2

processBinaryFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…