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

Expose random seed and make static test nullable #53

Merged
merged 5 commits into from
Sep 26, 2023

Conversation

mkorbel1
Copy link
Contributor

@mkorbel1 mkorbel1 commented Sep 26, 2023

Description & Motivation

This PR refactors some parts of the Test API.

  • Static members related to Test.instance, including Test.random, are now nullable instead of late. This highlights the need for a Test to be constructed before using those variables, and avoids confusing late initialization errors.
  • Expose the randomSeed for Tests so that it can be queried, printed, etc. to make it easier to reproduce issues.
  • Make the Test.instance null out after a test has run, so that it doesn't stick around afterwards, which could cause some confusion.
  • Adds Test.reset() to reset the Test.instance.

Related Issue(s)

Fix #24
Fix #23

Testing

Added tests around these changes

Backwards-compatibility

Is this a breaking change that will not be backwards-compatible? If yes, how so?

YES!

  • Test.instance and Test.random are now nullable
  • Test.instance is now a getter only.
  • Test.instance is now null after a test is finished running.
  • A Test will fail to construct (exception) if there's already an instance running.
  • Should now use Test.reset() (which includes Simulator.reset())

Documentation

Does the change require any updates to documentation? If so, where? Are they included?

API docs are updated

@mkorbel1 mkorbel1 merged commit 3404b1f into intel:main Sep 26, 2023
2 checks passed
@mkorbel1 mkorbel1 deleted the seed_and_nulltest branch September 26, 2023 20:02
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.

Expose the randomSeed Provide Test.random even if there is no Test running.
1 participant