-
Notifications
You must be signed in to change notification settings - Fork 100
Update MaxEncodedLen derive macro #512
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
Changes from all commits
e3336d1
0af66c6
49d2bab
17c4cc8
8818af7
561960c
4b72be5
f14dcda
d652607
04f935a
f96b221
e8b44f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,12 +73,29 @@ struct CompactField { | |
|
||
#[test] | ||
fn compact_field_max_length() { | ||
assert_eq!(CompactField::max_encoded_len(), 17); | ||
assert_eq!( | ||
CompactField::max_encoded_len(), | ||
Compact::<u64>::max_encoded_len() + u64::max_encoded_len() | ||
); | ||
} | ||
|
||
|
||
#[derive(Encode, MaxEncodedLen)] | ||
struct CompactFieldGenerics<T: MaxEncodedLen> { | ||
#[codec(compact)] | ||
t: T, | ||
v: u64, | ||
} | ||
|
||
#[test] | ||
fn compact_field_generics_max_length() { | ||
assert_eq!( | ||
CompactFieldGenerics::<u64>::max_encoded_len(), | ||
CompactField::max_encoded_len() | ||
); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'd prefer to have a separate test for this, instead of modifying an existing one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done, this test would fail with
|
||
|
||
#[derive(Encode, MaxEncodedLen)] | ||
struct CompactStruct(#[codec(compact)] u64); | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.