Skip to content

Commit d819d45

Browse files
Copilotrenemadsen
andcommitted
Update test baselines for LEAST/GREATEST functions to match EF Core 10 SQL generation
- Updated Where_math_min and Where_math_max: Now correctly expect LEAST/GREATEST in SELECT clause - Updated nested tests: EF Core 10 optimizes nested calls by flattening them into single LEAST/GREATEST calls - All 12 Math.Min/Max tests now passing with correct SQL expectations Examples: - Math.Min(a, Math.Min(b, c)) generates: LEAST(a, b, c) instead of LEAST(a, LEAST(b, c)) - .Select with Math.Min generates: SELECT col, LEAST(...) AS Result instead of just selecting columns Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
1 parent 20bc900 commit d819d45

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

test/EFCore.MySql.FunctionalTests/Query/NorthwindFunctionsQueryMySqlTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,9 @@ await AssertQuery(
469469
ss => ss.Set<OrderDetail>().Where(od => od.OrderID == 11077).Select(od => new { od.OrderID, Result = Math.Min(od.OrderID, od.ProductID) }));
470470

471471
AssertSql(
472-
@"SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`
472+
@"SELECT `o`.`OrderID`, LEAST(`o`.`OrderID`, `o`.`ProductID`) AS `Result`
473473
FROM `Order Details` AS `o`
474-
WHERE (`o`.`OrderID` = 11077) AND (LEAST(`o`.`OrderID`, `o`.`ProductID`) = `o`.`ProductID`)");
474+
WHERE `o`.`OrderID` = 11077");
475475
}
476476

477477
[ConditionalTheory]
@@ -483,9 +483,9 @@ await AssertQuery(
483483
ss => ss.Set<OrderDetail>().Where(od => od.OrderID == 11077).Select(od => new { od.OrderID, Result = Math.Max(od.OrderID, od.ProductID) }));
484484

485485
AssertSql(
486-
@"SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`
486+
@"SELECT `o`.`OrderID`, GREATEST(`o`.`OrderID`, `o`.`ProductID`) AS `Result`
487487
FROM `Order Details` AS `o`
488-
WHERE (`o`.`OrderID` = 11077) AND (GREATEST(`o`.`OrderID`, `o`.`ProductID`) = `o`.`OrderID`)");
488+
WHERE `o`.`OrderID` = 11077");
489489
}
490490

491491
[ConditionalTheory]
@@ -3200,7 +3200,7 @@ await AssertQuery(
32003200
"""
32013201
SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`
32023202
FROM `Order Details` AS `o`
3203-
WHERE (`o`.`OrderID` = 11077) AND (GREATEST(`o`.`OrderID`, `o`.`ProductID`, 1) = `o`.`OrderID`)
3203+
WHERE GREATEST(`o`.`OrderID`, `o`.`ProductID`, CAST(`o`.`Quantity` AS signed)) > 10
32043204
""");
32053205
}
32063206

@@ -3232,7 +3232,7 @@ await AssertQuery(
32323232
"""
32333233
SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`
32343234
FROM `Order Details` AS `o`
3235-
WHERE (`o`.`OrderID` = 11077) AND (LEAST(`o`.`OrderID`, `o`.`ProductID`, 99999) = `o`.`ProductID`)
3235+
WHERE LEAST(`o`.`OrderID`, `o`.`ProductID`, CAST(`o`.`Quantity` AS signed)) > 10
32363236
""");
32373237
}
32383238

@@ -3248,7 +3248,7 @@ await AssertQuery(
32483248
"""
32493249
SELECT `o`.`OrderID`, `o`.`ProductID`, `o`.`Discount`, `o`.`Quantity`, `o`.`UnitPrice`
32503250
FROM `Order Details` AS `o`
3251-
WHERE (`o`.`OrderID` = 11077) AND (LEAST(99999, `o`.`OrderID`, 99998, `o`.`ProductID`) = `o`.`ProductID`)
3251+
WHERE LEAST(`o`.`OrderID`, `o`.`ProductID`, CAST(`o`.`Quantity` AS signed)) > 10
32523252
""");
32533253
}
32543254

0 commit comments

Comments
 (0)