-
Notifications
You must be signed in to change notification settings - Fork 2
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
Property-based testing of matrix transposition #65
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rather than just testing the self-inverse property of matrix transposition, use property-based testing to check if transposition is correct and meets the self-inverse (involutory) property. Similarly test unraveling and reraveling of matrices. We still check that the transposition is performed in the Little Endian-sense with another test.
juanli16
requested changes
Dec 21, 2021
* Add `bitVectWidth` as a constant to use instead of 512 everywhere * Move `isBitSetUint64` to `bitvect_test.go` as it is only used for testing * Rename variables in tests
jvsg
reviewed
Dec 22, 2021
We take the default time-seeded randomness from Quick and use it when generating our matrices. In addition, matrices are generated with a random length such that the max size in 5 blocks of 512 by 512 bits.
Based on review comments on property-based on testing of matrix transposition, realized that the testing of the bit utils had similar flaws. Ensure the randomness from Quick (time-seeded) is passed to bitset generation and also create sets of truly random length.
xcapaldi
force-pushed
the
property-test-transpose
branch
from
December 22, 2021 21:43
1bde484
to
19857a3
Compare
juanli16
reviewed
Jan 3, 2022
internal/util/bitvect_test.go
Outdated
// 512 rows. | ||
func (tallMatrix) Generate(r *rand.Rand, unusedSizeHint int) reflect.Value { | ||
var tall tallMatrix | ||
size := 1 + r.Intn(31*bitVectWidth) // a max of 32 blocks |
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.
Suggested change
size := 1 + r.Intn(31*bitVectWidth) // a max of 32 blocks | |
size := r.Intn(unusedSizeHint*bitVectWidth) // a max of 32 blocks |
Generate up to 32 - 512x512 blocks for property-based testing.
xcapaldi
force-pushed
the
property-test-transpose
branch
from
January 3, 2022 15:39
c69e319
to
6c46692
Compare
juanli16
approved these changes
Jan 3, 2022
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.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rather than just testing the self-inverse property of matrix transposition, use property-based testing to check if transposition is correct and meets the self-inverse (involutory) property.
Similarly test unraveling and reraveling of matrices.
We still check that the transposition is performed in the Little Endian-sense with another test.