-
Notifications
You must be signed in to change notification settings - Fork 36
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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' |
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.
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 |
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.
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 |
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.
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") |
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.
This case currently fails in Python (but not Ruby) because Ruby calls Integer(value)
which works ... the Python conversion code did not handle it.
|
closes #1895