Expose random seed and make static test nullable #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description & Motivation
This PR refactors some parts of the
Test
API.Test.instance
, includingTest.random
, are now nullable instead oflate
. This highlights the need for aTest
to be constructed before using those variables, and avoids confusing late initialization errors.randomSeed
forTest
s so that it can be queried, printed, etc. to make it easier to reproduce issues.Test.instance
null
out after a test has run, so that it doesn't stick around afterwards, which could cause some confusion.Test.reset()
to reset theTest.instance
.Related Issue(s)
Fix #24
Fix #23
Testing
Added tests around these changes
Backwards-compatibility
YES!
Test.instance
andTest.random
are now nullableTest.instance
is now aget
ter only.Test.instance
is now null after a test is finished running.Test
will fail to construct (exception) if there's already an instance running.Test.reset()
(which includesSimulator.reset()
)Documentation
API docs are updated