Skip to content
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

Fix encode signed numbers. #6

Merged
merged 6 commits into from
Feb 6, 2024
Merged

Fix encode signed numbers. #6

merged 6 commits into from
Feb 6, 2024

Conversation

ramonalobont
Copy link
Contributor

No description provided.

Base automatically changed from fix-imports to main February 1, 2024 14:06
Copy link
Contributor

@andreibancioiu andreibancioiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

multiversx_sdk/core/constants.py Outdated Show resolved Hide resolved
multiversx_sdk/core/codec.py Outdated Show resolved Hide resolved
multiversx_sdk/core/codec_test.py Outdated Show resolved Hide resolved
from multiversx_sdk.core import codec

test_vectors_1 = [
[-1, 0XFF],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to keep it consistent use lowercase value for the hex prefix. 0xFF instead of 0XFF. Apply this change to all test vectors.

assert codec.encode_signed_number(127) == bytes([0x7F])
assert codec.encode_signed_number(0x11) == bytes([0x11])
assert codec.encode_signed_number(255) == bytes([0x00, 0xFF])
for [input_data, expected_data] in test_vectors_1:
Copy link
Collaborator

@popenta popenta Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for readability, maybe add an empty line between the last assert statement and the first for statement, but also between each for staments.

@ramonalobont ramonalobont merged commit dfcc3f4 into main Feb 6, 2024
3 checks passed
@ramonalobont ramonalobont deleted the encode-signed-numbers branch February 6, 2024 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants