From a3e88e81dc52f7d28c4547a66a501ee90da9b0db Mon Sep 17 00:00:00 2001 From: Ezra Haleva Date: Fri, 21 Oct 2022 10:57:21 -0700 Subject: [PATCH] added new test, cleanup --- ...gregateAllSqlParserBaselineTests.Tests.xml | 13 +++- .../AggregateAllSqlParserBaselineTests.cs | 59 +++++++++++++------ .../ScalarExpressionSqlParserBaselineTests.cs | 4 +- 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/AggregateAllSqlParserBaselineTests.Tests.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/AggregateAllSqlParserBaselineTests.Tests.xml index 859b023ed2..600af189e1 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/AggregateAllSqlParserBaselineTests.Tests.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/AggregateAllSqlParserBaselineTests.Tests.xml @@ -65,7 +65,7 @@ - + @@ -74,10 +74,19 @@ - + + + + + + + + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/AggregateAllSqlParserBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/AggregateAllSqlParserBaselineTests.cs index 085691606e..38712dfba0 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/AggregateAllSqlParserBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/AggregateAllSqlParserBaselineTests.cs @@ -15,29 +15,54 @@ public void Tests() { List inputs = new List() { - CreateInput(description: "ALL in an SqlSelectItem as an alias", scalarExpression: "SELECT 1 as ALL"), - CreateInput(description: "ALL in an AliasedCollectionExpression as an alias", scalarExpression: - "SELECT * " + - "FROM (SELECT VALUE 1) as ALL"), - CreateInput(description: "ALL in an ArrayIteratorCollectionExpression", scalarExpression: - "SELECT * " + - "FROM ALL IN (SELECT VALUE 1)"), - CreateInput(description: "ALL in an InputPathCollection and IdentifierPathExpression", scalarExpression: - "SELECT * " + - "FROM ALL.ALL"), - CreateInput(description: "ALL in a PropertyRefScalarExpression", scalarExpression: "SELECT ALL"), - CreateInput(description: "ALL in a PropertyRefScalarExpression as child", scalarExpression: "SELECT c.ALL"), - CreateInput(description: "ALL in a PropertyRefScalarExpression as parent and child", scalarExpression: "SELECT ALL.ALL"), - CreateInput(description: "ALL in a function call", scalarExpression: "SELECT ALL( 1, 2)"), - CreateInput(description: "ALL in a UDF function call", scalarExpression: "SELECT udf.ALL( 1, 2)"), + CreateInput( + description: "ALL in an SqlSelectItem as an alias", + query: "SELECT 1 as ALL"), + CreateInput( + description: "ALL in an AliasedCollectionExpression as an alias", + query: "SELECT * " + + "FROM (SELECT VALUE 1) as ALL"), + CreateInput( + description: "ALL in an ArrayIteratorCollectionExpression", + query: "SELECT * " + + "FROM ALL IN (SELECT VALUE 1)"), + CreateInput( + description: "ALL in an InputPathCollection and IdentifierPathExpression", + query: "SELECT * " + + "FROM ALL.ALL"), + CreateInput( + description: "ALL in a PropertyRefScalarExpression", + query: "SELECT ALL"), + CreateInput( + description: "ALL in a PropertyRefScalarExpression as child", + query: "SELECT c.ALL"), + CreateInput( + description: "ALL in a PropertyRefScalarExpression as parent and child", + query: "SELECT ALL.ALL"), + CreateInput( + description: "ALL in a function call", + query: "SELECT ALL(1, 2)"), + CreateInput( + description: "ALL in a UDF function call", + query: "SELECT udf.ALL(1, 2)"), + CreateInput( + description: "ALL in every possible grammar rule at the same time", + query: "SELECT ALL(1, 2) as ALL " + + "FROM ALL IN (SELECT ALL.ALL) " + + "WHERE ALL( " + + " SELECT ALL " + + " FROM (SELECT udf.ALL(1, 2)) as ALL " + + " WHERE ALL( SELECT VALUE 1) " + + ")") + }; this.ExecuteTestSuite(inputs); } - public static SqlParserBaselineTestInput CreateInput(string description, string scalarExpression) + public static SqlParserBaselineTestInput CreateInput(string description, string query) { - return new SqlParserBaselineTestInput(description, scalarExpression); + return new SqlParserBaselineTestInput(description, query); } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/ScalarExpressionSqlParserBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/ScalarExpressionSqlParserBaselineTests.cs index 595b338fc6..2faed74686 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/ScalarExpressionSqlParserBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/ScalarExpressionSqlParserBaselineTests.cs @@ -17,7 +17,9 @@ public void All() CreateInput(description: "Basic", scalarExpression: "ALL(SELECT *)"), CreateInput(description: "case insensitive", scalarExpression: "aLl(SELECT *)"), CreateInput(description: "nested", scalarExpression:"ALL( SELECT * WHERE ALL( SELECT *))"), - CreateInput(description: "multiple nested", scalarExpression: + CreateInput( + description: "multiple nested", + scalarExpression: "ALL( " + " SELECT * " + " WHERE ALL( " +