-
Notifications
You must be signed in to change notification settings - Fork 210
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 TestGetArrayDimensionality test #1495
test: add TestGetArrayDimensionality test #1495
Conversation
WalkthroughThe update enhances the Changes
Poem
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.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Files selected for processing (2)
- mod/primitives/pkg/ssz/v2/lib/determine_size.go (1 hunks)
- mod/primitives/pkg/ssz/v2/lib/determine_size_test.go (1 hunks)
Additional comments not posted (2)
mod/primitives/pkg/ssz/v2/lib/determine_size_test.go (1)
37-45
: The structure and implementation of the test function are correct and follow best practices for table-driven tests in Go.mod/primitives/pkg/ssz/v2/lib/determine_size.go (1)
342-367
: The logic and performance of the updatedGetArrayDimensionality
function are sound and efficient.
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: 1
Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Files selected for processing (1)
- mod/primitives/pkg/ssz/v2/lib/serializer_test.go (2 hunks)
Additional comments not posted (1)
mod/primitives/pkg/ssz/v2/lib/serializer_test.go (1)
24-24
: The import of thereflect
package is crucial for the new test function to work correctly.
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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1495 +/- ##
===========================================
+ Coverage 24.75% 70.45% +45.70%
===========================================
Files 249 8 -241
Lines 11228 88 -11140
Branches 18 18
===========================================
- Hits 2779 62 -2717
+ Misses 8281 22 -8259
+ Partials 168 4 -164 |
@@ -67,3 +68,40 @@ func TestMarshalUnmarshalBoolSerializer(t *testing.T) { | |||
unmarshaled := ssz.UnmarshalBool[bool](marshaled) | |||
require.Equal(t, original, unmarshaled, "Marshal/Unmarshal Bool failed") | |||
} | |||
|
|||
func TestGetArrayDimensionality(t *testing.T) { |
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.
Can we separate/group the tests according to their dimensionality to make it readable.
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.
Description
Add
TestGetArrayDimensionality
and refactorGetArrayDimensionality
to correctly handle the empty n-dimension array(old implemetation fail with input like([0][0]int32{}
,[][]byte{}
) which I believe is not desirable.Summary by CodeRabbit
Bug Fixes
Tests