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

Function TestBigFloatMathsBoolean

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

Source from the content-addressed store, hash-verified

906}
907
908func TestBigFloatMathsBoolean(t *testing.T) {
909 tests := []struct {
910 in *mathTree
911 out types.Val
912 }{
913 {in: &mathTree{
914 Fn: "==",
915 Child: []*mathTree{
916 {Val: createShardedMap(0, types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(2.123)})},
917 {Const: types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(2.123)}},
918 }},
919 out: types.Val{Tid: types.BoolID, Value: true},
920 },
921 {in: &mathTree{
922 Fn: "!=",
923 Child: []*mathTree{
924 {Val: createShardedMap(0, types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(2.4623)})},
925 {Const: types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(3.623)}},
926 }},
927 out: types.Val{Tid: types.BoolID, Value: true},
928 },
929 {in: &mathTree{
930 Fn: ">=",
931 Child: []*mathTree{
932 {Val: createShardedMap(0, types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(2.123)})},
933 {Val: createShardedMap(0, types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(4.123)})},
934 }},
935 out: types.Val{Tid: types.BoolID, Value: false},
936 },
937 {in: &mathTree{
938 Fn: "<=",
939 Child: []*mathTree{
940 {Val: createShardedMap(0, types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(2.123)})},
941 {Const: types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(3.992)}},
942 }},
943 out: types.Val{Tid: types.BoolID, Value: true},
944 },
945 {in: &mathTree{
946 Fn: ">",
947 Child: []*mathTree{
948 {Val: createShardedMap(0, types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(2.45)})},
949 {Const: types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(3.43)}},
950 }},
951 out: types.Val{Tid: types.BoolID, Value: false},
952 },
953 {in: &mathTree{
954 Fn: "<",
955 Child: []*mathTree{
956 {Val: createShardedMap(0, types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(2.1213)})},
957 {Const: types.Val{Tid: types.BigFloatID, Value: *big.NewFloat(2.1232)}},
958 }},
959 out: types.Val{Tid: types.BoolID, Value: true},
960 },
961 }
962 for _, tc := range tests {
963 t.Logf("Test %s", tc.in.Fn)
964 require.NoError(t, processBinaryBoolean(tc.in))
965 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…