Add sorting and comparison regression tests as dedicated Issue499 file - #500
Conversation
Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/6fb72610-4eb4-42eb-8aa7-d8e917c55961 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/6fb72610-4eb4-42eb-8aa7-d8e917c55961 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
|
@copilot Please move the tests to the separate Issue499_... file. Use 488 just for reference. |
dadhi
left a comment
There was a problem hiding this comment.
Aldo if the tests can be run in Net472 please add them to both .net 9 and .net472 TestRunner projects.
| { | ||
| Original_test(t); | ||
| Quicksort_partition_with_nested_loops(t); | ||
| Comparison_function_with_goto_labels(t); |
There was a problem hiding this comment.
Move the tests to the separate Issue499_... file. I mentioned Issue488 just for reference.
Each issue ideally should have a separate/dedicated test file.
There was a problem hiding this comment.
Done in e428c53. Tests are now in the dedicated Issue499_InvalidProgramException_for_Sorting_and_comparison_function.cs file, and Issue498 is back to its original state.
… TestRunners Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/36193359-0246-4a75-b418-805697677d24 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Done in e428c53. The
Tests are now in a dedicated |
dadhi
left a comment
There was a problem hiding this comment.
Let ensure we running the 498 on .net472 as well. Both for Fec and LightExpression
Compare the rest of TestX implementing tests, may be we forget to run something else.
… FEC and LightExpression Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/78fb9479-153c-493f-a470-f41c8c8225b1 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Done in 45ff92c. Added |
dadhi
left a comment
There was a problem hiding this comment.
Windows workflow issue - may be exposing some error. Please fix:
Run dotnet run --no-build -c:Release --project test/FastExpressionCompiler.TestsRunner.Net472
### TestX runs on FEC tests (UnitTests and IssueTests) and FEC.LightExpression tests in ||
FEC tests are passing in 262 ms.
Unexpected exception in test 'Issue498_InvalidProgramException_when_using_loop':
'System.ArgumentException: Expression of type 'System.Void' cannot be used for return type 'System.Int32'
at System.Linq.Expressions.Expression.ValidateLambdaArgs(Type delegateType, Expression& body, ReadOnlyCollection`1 parameters)
at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, String name, Boolean tailCall, IEnumerable`1 parameters)
at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, Boolean tailCall, IEnumerable`1 parameters)
at FastExpressionCompiler.LightExpression.Expression`1.ToLambdaExpression() in /_/src/FastExpressionCompiler.LightExpression/Expression.cs:line 5707
at FastExpressionCompiler.LightExpression.IssueTests.Issue498_InvalidProgramException_when_using_loop.Original_test(TestContext t) in D:\a\FastExpressionCompiler\FastExpressionCompiler\test\FastExpressionCompiler.IssueTests\Issue498_InvalidProgramException_when_using_loop.cs:line 51
at FastExpressionCompiler.LightExpression.TestRun.Run[T](T test, TestFlags flags) in /_/src/FastExpressionCompiler/TestTools.cs:line 1062'
Just LightExpression tests are passing in 398 ms.
LightExpression tests + Thread New, Start, Join: 402 ms.
--> waited for the LightExpression tests to finish after FEC tests complete for 139 ms.
ERROR: Some tests are FAILED!
…tching System.Linq.Expressions behavior Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/a43bd802-b944-48bc-8c8c-c0abc89bc6e6 Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>
Fixed in d6c559a. The root cause was |
Issue #499 reports
InvalidProgramExceptionat runtime (not compile time) for expression trees representing a quicksort partition and a comparison function when compiled withCompileFast.New file:
Issue499_InvalidProgramException_for_Sorting_and_comparison_functionTwo minimal, self-contained test methods that reproduce the patterns from the original
SortCompilerreport without requiringSortData/ColumnDatainfrastructure:Quicksort_partition_with_nested_loopsMirrors
SortCompiler.Compile— an outervoidLoopcontaining two innerLoops using themakeConditionpattern: conditionalContinue(continueN)+ fallthroughBreak(endSubN).Comparison_function_with_goto_labelsMirrors
SortCompiler.CompileComparisonFunction—Return(label, value)(GotoExpressionwithKind=Return) inside a conditional, followed by a fallthroughReturnand a typedLabeldefault.Each test runs the expression with
CompileSysto get a reference result, then assertsCompileFastproduces the same output. The tests passing confirms the fix from issue #498 covers these patterns.TestRunner registration
The
Issue499struct is registered in both TestRunner projects:TestRunner/Program.cs(net6/net8/net9) — viast.Run()andlt.Run()inMain()TestRunner.Net472/Program.cs— viafecTests.Run()and the LightExpression thread inRunTestsX()Issue498is also now registered inTestRunner.Net472/Program.csfor both FEC (fecTests.Run) and LightExpression (background thread), ensuring it runs on .NET 4.7.2. Additionally, other previously missingITestXtests were added to the Net472 runner:Issue398,Issue476,Issue480, andIssue495.