Skip to content

Fix flaky LambdaSyntaxTest#460

Closed
braguex10 wants to merge 1 commit into
mpostol:masterfrom
braguex10:fix-lambda-syntax-test
Closed

Fix flaky LambdaSyntaxTest#460
braguex10 wants to merge 1 commit into
mpostol:masterfrom
braguex10:fix-lambda-syntax-test

Conversation

@braguex10

Copy link
Copy Markdown
Contributor

This pull request fixes issue #443.

The LambdaSyntaxTest previously used Random to generate test data. Because of that, the number of values greater than or equal to 50 could occasionally fall outside the expected tolerance, causing the test to fail randomly.

The test data is now deterministic. The buffer contains exactly half values below 50 and half values greater than or equal to 50. This keeps the purpose of the test, which is to verify the lambda expression used by Count, while removing the random behavior.

@braguex10

Copy link
Copy Markdown
Contributor Author

Fixes #443.

@mpostol mpostol added question In progress In waiting Remaining inactive until something happen. labels Jun 10, 2026
@mpostol mpostol added this to the External Data Management milestone Jun 10, 2026
@mpostol

mpostol commented Jun 10, 2026

Copy link
Copy Markdown
Owner

I am not sure if the main goal for this example is preserved. Since it affects the master branch, it has to wait for the next tag.

@mpostol mpostol marked this pull request as draft June 10, 2026 09:25
@braguex10 braguex10 marked this pull request as ready for review June 13, 2026 09:32
@braguex10

Copy link
Copy Markdown
Contributor Author

Personal identifier: GUID: {B62EA543-97CE-4E8B-8167-8C4D97A71094}

@mpostol

mpostol commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Many thanks, @braguex10, for your contribution. I will appreciate.

@mpostol

mpostol commented Jul 1, 2026

Copy link
Copy Markdown
Owner

The most important thing in this test (LambdaSyntaxTest) is to apply a custom anonymous method expressed using lambda syntax to count items in an array based on a statistic, for example, `(int x) => { return x >= 50; }. But now it has been removed, making this example useless as an example of applying an anonymous function using a delegate. I am closing this pr because it cannot be applied.

You are right that the previous solution is not deterministic because it uses statistics, but it seems to me that it is too complicated and doesn't present the idea in question. I must consider removing this test altogether.

I am using test methods to explain selected ideas, but not to validate the correctness of a program.

@mpostol mpostol closed this Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

In progress In waiting Remaining inactive until something happen. question

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants