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

Properly parse hex and binary ID items #1896

Merged
merged 2 commits into from
Feb 13, 2025
Merged

Properly parse hex and binary ID items #1896

merged 2 commits into from
Feb 13, 2025

Conversation

jmthomas
Copy link
Member

closes #1895

Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.40%. Comparing base (3638071) to head (ad188ad).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1896      +/-   ##
==========================================
+ Coverage   79.38%   79.40%   +0.01%     
==========================================
  Files         523      523              
  Lines       40905    40910       +5     
==========================================
+ Hits        32474    32484      +10     
+ Misses       8431     8426       -5     
Flag Coverage Δ
python 83.97% <ø> (+0.03%) ⬆️
ruby-api 48.45% <ø> (ø)
ruby-backend 82.51% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

tf.puts ' APPEND_ITEM ITEM5 32 BLOCK'
tf.puts ' APPEND_ARRAY_ITEM ITEM6 32 BLOCK 64'
tf.puts ' APPEND_ID_ITEM ITEM4 32 STRING "0xABCD"'
tf.puts ' APPEND_ID_ITEM ITEM5 32 BLOCK 0xABCD'
Copy link
Member Author

Choose a reason for hiding this comment

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

Ruby didn't support block ID items as binary

# For PARAMETERS the default value is the ID value
if @parser.keyword.include?("PARAMETER")
return item.default
end
Copy link
Member Author

Choose a reason for hiding this comment

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

No need to reparse the ID value in commands ... just use the default

return self.parser.parameters[index]
# For PARAMETERS the default value is the ID value
if "PARAMETER" in self.parser.keyword:
return item.default
Copy link
Member Author

Choose a reason for hiding this comment

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

No need to reparse the ID value in commands ... just use the default

@@ -129,22 +129,27 @@ def test_only_allows_derived_items_with_offset_0_and_size_0(self):
def test_accepts_types_int_uint_float_string_block(self):
tf = tempfile.NamedTemporaryFile(mode="w")
tf.write('TELEMETRY tgt1 pkt1 LITTLE_ENDIAN "Description"\n')
tf.write(" ID_ITEM ITEM1 0 32 INT 0\n")
tf.write(" ID_ITEM ITEM1 0 32 INT 0x42\n")
Copy link
Member Author

Choose a reason for hiding this comment

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

This case currently fails in Python (but not Ruby) because Ruby calls Integer(value) which works ... the Python conversion code did not handle it.

@jmthomas jmthomas merged commit 4fa9281 into main Feb 13, 2025
29 of 30 checks passed
@jmthomas jmthomas deleted the py_id_param branch February 13, 2025 03:56
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.

Parameter default value does not work for hexadecimal values
2 participants