-
Notifications
You must be signed in to change notification settings - Fork 90
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: add additional test for MarshalBitList #1463
test: add additional test for MarshalBitList #1463
Conversation
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant Tester
participant MarshalBitList
loop Test Cases
Tester->>MarshalBitList: Feed input data
MarshalBitList-->>Tester: Return marshalled data
Tester->>Tester: Validate output against expectation
end
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
…orbitorg/beacon-kit into tuan/test-marshal-bitlist-multiplebytes
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Files selected for processing (1)
- mod/primitives/pkg/ssz/serialization_test.go (1 hunks)
Additional comments not posted (1)
mod/primitives/pkg/ssz/serialization_test.go (1)
304-346
: Great work on implementing table-driven tests forTestMarshalBitList
. This approach not only improves maintainability but also makes it easier to add new test cases in the future.However, to enhance the debugging experience, consider adding a descriptive failure message in the
t.Errorf
call. This will provide immediate context in the test output, making it easier to understand the failure without needing to look up the test case details.- t.Errorf("Expected output %08b, got %08b", tc.expOutput, output) + t.Errorf("%s: Expected output %08b, got %08b", tc.name, tc.expOutput, output)
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. Thanks.
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!
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Files selected for processing (1)
- mod/primitives/pkg/ssz/serialization_test.go (1 hunks)
Additional comments not posted (1)
mod/primitives/pkg/ssz/serialization_test.go (1)
304-353
: The refactor to use table-driven tests inTestMarshalBitList
enhances maintainability and test coverage. However, consider enhancing the error messages for better debugging support.- t.Errorf("Expected output %08b, got %08b", tc.expOutput, output) + t.Errorf("%s: Expected output %08b, got %08b", tc.name, tc.expOutput, output)
Co-authored-by: itsdevbear <[email protected]> Co-authored-by: Iron | B-Harvest <[email protected]>
Description
Refactor TestMarshalBitList using table-driven tests to improve maintainability.
Add testcase for multiple bytes input.
Summary by CodeRabbit
TestMarshalBitList
to include multiple test cases with varying input lengths. This update improves test coverage by covering scenarios like empty input, single-element input, and various edge cases.