MCPcopy
hub / github.com/dgraph-io/dgraph / TestParseQueryWithVarValAggNested2

Function TestParseQueryWithVarValAggNested2

dql/parser_test.go:504–529  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

502}
503
504func TestParseQueryWithVarValAggNested2(t *testing.T) {
505 query := `
506 {
507 me(func: uid(L), orderasc: val(d)) {
508 name
509 val(q)
510 }
511
512 var(func: uid(0x0a)) {
513 L as friends {
514 a as age
515 b as count(friends)
516 c as count(relatives)
517 d as math(exp(a + b + 1.0) - ln(c))
518 q as math(c*-1.0+-b+(-b*c))
519 }
520 }
521 }
522`
523 res, err := Parse(Request{Str: query})
524 require.NoError(t, err)
525 require.EqualValues(t, "(- (exp (+ (+ a b) 1E+00)) (ln c))",
526 res.Query[1].Children[0].Children[3].MathExp.debugString())
527 require.EqualValues(t, "(+ (+ (* c (u- 1E+00)) (u- b)) (* (u- b) c))",
528 res.Query[1].Children[0].Children[4].MathExp.debugString())
529}
530
531func TestParseQueryWithVarValAggNested4(t *testing.T) {
532 query := `

Callers

nothing calls this directly

Calls 2

ParseFunction · 0.70
debugStringMethod · 0.45

Tested by

no test coverage detected