Skip to content

Refactor - Placeholders #42

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

DaMatrix
Copy link

@DaMatrix DaMatrix commented Aug 2, 2024

Description

This adds a pair of traits intended for generating placeholder values, intended for use in tests.

A dedicated trait for placeholder values is preferable to using the standard Default trait for two reasons:

  • It allows us to generate multiple unique placeholder values, which are nonetheless consistent across test runs (this is a problem for much of the existing test code, which e.g. extensively uses crypto::gen_keypair() to generate a totally random keypair every time)
  • It enables obtaining placeholder values for types for which it would not make sense to allow a default value: e.g. SecretKey clearly should not implement Default, as that would assume the existence of some kind of "default" secret key (which doesn't make sense)

These traits will be extensively used in subsequent PRs.

Changelog

  • Added two test-only traits for generating placeholder values:
    • One for generating completely arbitrary placeholder values, with no guarantees made
    • One for generating placeholder values based on a given seed, which guarantees that it will return consistent values across runs

Type of Change

Please mark the appropriate option by putting an "x" inside the brackets:

  • Bug fix
  • New feature
  • Enhancement or optimization
  • Documentation update
  • Other (please specify)

Checklist

Put an "x" in the boxes that apply. If you're unsure about any of these, don't hesitate to ask. We're here to help!

  • I have tested the changes locally and they work as expected.
  • I have added necessary documentation or updated existing documentation.
  • My code follows the project's coding standards and style guidelines.
  • I have added/updated relevant tests to ensure the changes are properly covered.
  • I have checked for and resolved any merge conflicts.
  • My commits have clear and descriptive messages.

Screenshots (if applicable)

If the changes affect the UI or have visual effects, please provide screenshots or GIFs showcasing the changes.

Additional Context (if applicable)

Add any additional context or information about the changes that may be helpful in understanding the pull request.

Related Issues (if applicable)

If this pull request is related to any existing issues, please list them here.

Requested Reviewers

Mention any specific individuals or teams you would like to request a review from.

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