-
-
Notifications
You must be signed in to change notification settings - Fork 919
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
test: rewrite mersenne tests #480
Conversation
Codecov Report
@@ Coverage Diff @@
## main #480 +/- ##
=======================================
Coverage 99.34% 99.34%
=======================================
Files 1919 1919
Lines 176291 176291
Branches 902 904 +2
=======================================
+ Hits 175135 175136 +1
+ Misses 1100 1099 -1
Partials 56 56
|
Co-authored-by: Shinigami <[email protected]>
Co-authored-by: Shinigami <[email protected]>
Co-authored-by: Shinigami <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are a little hard to read, but IMO its good enough for now and way better than the previous tests.
Maybe change the seededRuns
to
type SeededRun = {
seed: number | number[];
expectations: SeededRunExpectation[];
};
type SeededRunExpectations = {
args: any[], // not sure about the type here
expected: number,
skip?: boolean,
};
Then you can use it like this:
const actual = mersenne.rand(...args);
expect(actual).toEqual(expected);
@Shinigami92 What do you think?
Also, IMO we should use .toBe()
instead of .toEqual()
as we are dealing with primitive values anyway.
That's many suggestions / ideas and I think not directly related to this PR |
Mersenne tests extracted from
random.spec.ts
.