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

Function TestProcessBinaryBoolean

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

Source from the content-addressed store, hash-verified

843}
844
845func TestProcessBinaryBoolean(t *testing.T) {
846 tests := []struct {
847 in *mathTree
848 out types.Val
849 }{
850 {in: &mathTree{
851 Fn: "<",
852 Child: []*mathTree{
853 {Val: createShardedMap(0, types.Val{Tid: types.IntID, Value: int64(1)})},
854 {Const: types.Val{Tid: types.IntID, Value: int64(2)}},
855 }},
856 out: types.Val{Tid: types.BoolID, Value: true},
857 },
858 {in: &mathTree{
859 Fn: ">",
860 Child: []*mathTree{
861 {Val: createShardedMap(0, types.Val{Tid: types.IntID, Value: int64(1)})},
862 {Const: types.Val{Tid: types.IntID, Value: int64(2)}},
863 }},
864 out: types.Val{Tid: types.BoolID, Value: false},
865 },
866 {in: &mathTree{
867 Fn: "<=",
868 Child: []*mathTree{
869 {Val: createShardedMap(0, types.Val{Tid: types.IntID, Value: int64(1)})},
870 {Const: types.Val{Tid: types.IntID, Value: int64(2)}},
871 }},
872 out: types.Val{Tid: types.BoolID, Value: true},
873 },
874 {in: &mathTree{
875 Fn: ">=",
876 Child: []*mathTree{
877 {Val: createShardedMap(0, types.Val{Tid: types.IntID, Value: int64(1)})},
878 {Const: types.Val{Tid: types.IntID, Value: int64(2)}},
879 }},
880 out: types.Val{Tid: types.BoolID, Value: false},
881 },
882 {in: &mathTree{
883 Fn: "==",
884 Child: []*mathTree{
885 {Val: createShardedMap(0, types.Val{Tid: types.IntID, Value: int64(1)})},
886 {Const: types.Val{Tid: types.IntID, Value: int64(2)}},
887 }},
888 out: types.Val{Tid: types.BoolID, Value: false},
889 },
890 {in: &mathTree{
891 Fn: "!=",
892 Child: []*mathTree{
893 {Val: createShardedMap(0, types.Val{Tid: types.IntID, Value: int64(1)})},
894 {Const: types.Val{Tid: types.IntID, Value: int64(2)}},
895 }},
896 out: types.Val{Tid: types.BoolID, Value: true},
897 },
898 }
899 for _, tc := range tests {
900 t.Logf("Test %s", tc.in.Fn)
901 require.NoError(t, processBinaryBoolean(tc.in))
902 val, ok := tc.in.Val.Get(0)

Callers

nothing calls this directly

Calls 3

createShardedMapFunction · 0.85
processBinaryBooleanFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…