(t *testing.T)
| 646 | } |
| 647 | |
| 648 | func TestParseQueryWithVarValAggNestedConditional(t *testing.T) { |
| 649 | query := ` |
| 650 | { |
| 651 | me(func: uid(L), orderasc: val(d) ) { |
| 652 | name |
| 653 | val(f) |
| 654 | } |
| 655 | |
| 656 | var(func: uid(0x0a)) { |
| 657 | L as friends { |
| 658 | a as age |
| 659 | b as count(friends) |
| 660 | c as count(relatives) |
| 661 | d as math(cond(a <= 10.0, exp(a + b + 1.0), ln(c)) + 10*a) |
| 662 | e as math(cond(a!=10.0, exp(a + b + 1.0), ln(d))) |
| 663 | f as math(cond(a==10.0, exp(a + b + 1.0), ln(e))) |
| 664 | } |
| 665 | } |
| 666 | } |
| 667 | ` |
| 668 | res, err := Parse(Request{Str: query}) |
| 669 | require.NoError(t, err) |
| 670 | require.EqualValues(t, "(+ (cond (<= a 1E+01) (exp (+ (+ a b) 1E+00)) (ln c)) (* 10 a))", |
| 671 | res.Query[1].Children[0].Children[3].MathExp.debugString()) |
| 672 | require.EqualValues(t, "(cond (!= a 1E+01) (exp (+ (+ a b) 1E+00)) (ln d))", |
| 673 | res.Query[1].Children[0].Children[4].MathExp.debugString()) |
| 674 | require.EqualValues(t, "(cond (== a 1E+01) (exp (+ (+ a b) 1E+00)) (ln e))", |
| 675 | res.Query[1].Children[0].Children[5].MathExp.debugString()) |
| 676 | } |
| 677 | |
| 678 | func TestParseQueryWithVarValAggNested3(t *testing.T) { |
| 679 | query := ` |
nothing calls this directly
no test coverage detected