Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend randomize seed tests #805

Merged
merged 3 commits into from
Oct 23, 2024

Conversation

brontolosone
Copy link
Contributor

@brontolosone brontolosone commented Oct 22, 2024

Tests in #804 could serendipitously fail succeed while they shouldn't since randomization took place over only 2 items (thus randomize(x, y) would result in the same shuffled order with probability 0.5 when varying y).

This expands tests to use a larger collection so that entropy is 8! rather than 2 when the total ordering rather than just the identity of the first element of the shuffled list is tested (reducing the "lucky factor" to 1/40320 if I'm not mistaken).

Update: Preserved classic behaviour for the special case of zero-length strings as seed input, and added/modified tests for that behaviour.

lognaturel
lognaturel previously approved these changes Oct 22, 2024
Copy link
Member

@lognaturel lognaturel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love these, thank you!

@lognaturel
Copy link
Member

Do you want to add on the empty case here as well?

@brontolosone
Copy link
Contributor Author

Yes, that, I want.

@lognaturel lognaturel changed the title Follow-up to #804: extend tests Extend randomize seed tests Oct 23, 2024
@lognaturel lognaturel merged commit 0d6c2ea into getodk:master Oct 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants