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.
While working in related code, I noticed the existing tests related to voting could use some improvement since they are rather inconsistent with the rest of the code base and are otherwise rather difficult to follow given they use a bunch of magic numbers, reference inconsistent global definitions, and don't really explain what it is they're intending to test. I also noticed they have some off by ones such that they aren't actually testing the edge conditions as was likely intended.
This fully reworks the tests to address the aforementioned points and also takes the opportunity to make them more compact and improve their coverage in the process. They are also hopefully significantly easier to follow now as well both from the code structure itself and the new comments that describe what they actually intend to test.
Quantifying the improvement to compactness, this includes all of the aforementioned improvements and comes in just under 540 less lines of code. Since it adds 357 additional lines of comments, the overall absolute reduction in the diff size is 180 lines.
The following is an overview of the changes: