-
Notifications
You must be signed in to change notification settings - Fork 206
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
added unit tests for data transformer types #2876
Conversation
Hi @Nityam573 👋, |
Hi @Nityam573 😄, Also, please fix formatting and lint, by running |
@franciszekjob i am on it will ready for review by tonight |
@franciszekjob please review |
@franciszekjob I am getting some issues while testing u384.rs can i configure u384.rs file from my end and then test it |
@Nityam573 What do you mean by "configure u384.rs file from my end"? 😅 |
@franciszekjob The error is happening when trying to convert slices to arrays in the from_bytes function in u384 |
@Nityam573 yes, you're correct 👍 impl CairoU384 {
#[must_use]
pub fn from_bytes(bytes: &[u8; 48]) -> Self {
fn to_u128(slice: &[u8]) -> u128 {
let mut padded = [0u8; 16];
padded[4..].copy_from_slice(slice);
u128::from_be_bytes(padded)
}
Self {
limb_0: to_u128(&bytes[36..48]),
limb_1: to_u128(&bytes[24..36]),
limb_2: to_u128(&bytes[12..24]),
limb_3: to_u128(&bytes[0..12]),
}
}
} I've added extra 4 bytes in size for each slice, should be fine now. |
@franciszekjob please review |
@franciszekjob please review |
@franciszekjob please review |
@franciszekjob review the changes |
@franciszekjob review please |
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.
Otherwise looks fine, @cptartur @ddoktorski could one of you also take a look?
@cptartur @ddoktorski @kkawula please review |
Closes #2575
Introduced changes
Added u384 tests, u96 tests and bytes31 tests
Checklist
CHANGELOG.md