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

Add a pseudorandom generator for move tests #7554

Merged
merged 17 commits into from
Jan 24, 2023
Merged

Add a pseudorandom generator for move tests #7554

merged 17 commits into from
Jan 24, 2023

Conversation

jonas-lj
Copy link
Contributor

Closing #7544

@vercel
Copy link

vercel bot commented Jan 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Ignored Deployments
Name Status Preview Comments Updated
explorer ⬜️ Ignored (Inspect) Jan 24, 2023 at 9:03AM (UTC)
explorer-storybook ⬜️ Ignored (Inspect) Jan 24, 2023 at 9:03AM (UTC)
frenemies ⬜️ Ignored (Inspect) Jan 24, 2023 at 9:03AM (UTC)
wallet-adapter ⬜️ Ignored (Inspect) Jan 24, 2023 at 9:03AM (UTC)

@jonas-lj jonas-lj marked this pull request as ready for review January 21, 2023 08:14
@jonas-lj jonas-lj requested a review from sblackshear January 21, 2023 08:14
Copy link
Collaborator

@sblackshear sblackshear left a comment

Choose a reason for hiding this comment

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

Thank you Jonas, this will be super useful to Move devs!

  • Would you mind also adding API's for other integer types (u16, u32, u128, u156)?
  • Because bcs won't have peel_ functions for some of these, you may just want to roll your own version of that functionality. We will eventually have from_bytes constructors for all integer types, but in the meantime we'll have to make do.

Co-authored-by: Sam Blackshear <sam.blackshear@gmail.com>
@jonas-lj jonas-lj requested a review from emmazzz January 23, 2023 12:24
@jonas-lj
Copy link
Contributor Author

Thank you Jonas, this will be super useful to Move devs!

  • Would you mind also adding API's for other integer types (u16, u32, u128, u156)?
  • Because bcs won't have peel_ functions for some of these, you may just want to roll your own version of that functionality. We will eventually have from_bytes constructors for all integer types, but in the meantime we'll have to make do.

Those are added now, and I've written my own "from bytes" functions for all types, and I'm using @emmazzz suggestion on generating values in range from modulus instead of rejection sampling. Let me know if anything is missing.

@jonas-lj jonas-lj merged commit b4ea500 into main Jan 24, 2023
@jonas-lj jonas-lj deleted the test_randomness branch January 24, 2023 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants