-
Notifications
You must be signed in to change notification settings - Fork 11
Issues/47 support xtce unitset #258
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
Open
blakedehaas
wants to merge
3
commits into
main
Choose a base branch
from
issues/47-support-xtce-unitset
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,6 +168,22 @@ def test_string_parameter_type(elmaker, xtce_parser, xml_string: str, expectatio | |
| ), | ||
| ), | ||
| ), | ||
| ( | ||
| f""" | ||
| <xtce:IntegerParameterType xmlns:xtce="{XTCE_1_2_XMLNS}" name="TEST_INT_Type"> | ||
| <xtce:UnitSet> | ||
| <xtce:Unit>m</xtce:Unit> | ||
| <xtce:Unit>s</xtce:Unit> | ||
| </xtce:UnitSet> | ||
| <xtce:IntegerDataEncoding sizeInBits="16" encoding="unsigned"/> | ||
| </xtce:IntegerParameterType> | ||
| """, | ||
| parameter_types.IntegerParameterType( | ||
| name="TEST_INT_Type", | ||
| unit=("m", "s"), | ||
| encoding=encodings.IntegerDataEncoding(size_in_bits=16, encoding="unsigned"), | ||
| ), | ||
| ), | ||
| ], | ||
| ) | ||
| def test_integer_parameter_type(elmaker, xtce_parser, xml_string: str, expectation): | ||
|
|
@@ -289,6 +305,22 @@ def test_integer_parameter_type(elmaker, xtce_parser, xml_string: str, expectati | |
| ), | ||
| ), | ||
| ), | ||
| ( | ||
| f""" | ||
| <xtce:FloatParameterType xmlns:xtce="{XTCE_1_2_XMLNS}" name="TEST_INT_Type"> | ||
| <xtce:UnitSet> | ||
| <xtce:Unit>m</xtce:Unit> | ||
| <xtce:Unit>s</xtce:Unit> | ||
| </xtce:UnitSet> | ||
| <xtce:FloatDataEncoding sizeInBits="16"/> | ||
| </xtce:FloatParameterType> | ||
| """, | ||
| parameter_types.FloatParameterType( | ||
| name="TEST_INT_Type", | ||
| unit=("m", "s"), | ||
| encoding=encodings.FloatDataEncoding(size_in_bits=16, encoding="IEEE754"), | ||
| ), | ||
| ), | ||
| ], | ||
| ) | ||
| def test_float_parameter_type(elmaker, xtce_parser, xml_string: str, expectation): | ||
|
|
@@ -420,6 +452,47 @@ def test_float_parameter_type(elmaker, xtce_parser, xml_string: str, expectation | |
| }, | ||
| ), | ||
| ), | ||
| ( | ||
| f""" | ||
| <xtce:EnumeratedParameterType xmlns:xtce="{XTCE_1_2_XMLNS}" name="TEST_ENUM_Type"> | ||
| <xtce:UnitSet> | ||
| <xtce:Unit>m</xtce:Unit> | ||
| <xtce:Unit>s</xtce:Unit> | ||
| </xtce:UnitSet> | ||
| <xtce:IntegerDataEncoding sizeInBits="2" encoding="unsigned"/> | ||
| <xtce:EnumerationList> | ||
| <xtce:Enumeration label="BOOT_POR" value="0"/> | ||
| <xtce:Enumeration label="BOOT_RETURN" value="1"/> | ||
| </xtce:EnumerationList> | ||
| </xtce:EnumeratedParameterType> | ||
| """, | ||
| parameter_types.EnumeratedParameterType( | ||
| name="TEST_ENUM_Type", | ||
| unit=("m", "s"), | ||
| encoding=encodings.IntegerDataEncoding(size_in_bits=2, encoding="unsigned"), | ||
| enumeration={0: "BOOT_POR", 1: "BOOT_RETURN"}, | ||
| ), | ||
| ), | ||
| ( | ||
| f""" | ||
| <xtce:EnumeratedParameterType xmlns:xtce="{XTCE_1_2_XMLNS}" name="TEST_ENUM_Type"> | ||
| <xtce:UnitSet> | ||
| <xtce:Unit>meters</xtce:Unit> | ||
| </xtce:UnitSet> | ||
| <xtce:IntegerDataEncoding sizeInBits="2" encoding="unsigned"/> | ||
| <xtce:EnumerationList> | ||
| <xtce:Enumeration label="BOOT_POR" value="0"/> | ||
| <xtce:Enumeration label="BOOT_RETURN" value="1"/> | ||
| </xtce:EnumerationList> | ||
| </xtce:EnumeratedParameterType> | ||
| """, | ||
| parameter_types.EnumeratedParameterType( | ||
| name="TEST_ENUM_Type", | ||
| unit="meters", | ||
| encoding=encodings.IntegerDataEncoding(size_in_bits=2, encoding="unsigned"), | ||
| enumeration={0: "BOOT_POR", 1: "BOOT_RETURN"}, | ||
| ), | ||
| ), | ||
| ], | ||
| ) | ||
| def test_enumerated_parameter_type(elmaker, xtce_parser, xml_string: str, expectation): | ||
|
|
@@ -517,6 +590,26 @@ def test_enumerated_parameter_type(elmaker, xtce_parser, xml_string: str, expect | |
| encoding=encodings.BinaryDataEncoding(size_reference_parameter="SizeFromThisParameter"), | ||
| ), | ||
| ), | ||
| ( | ||
| f""" | ||
| <xtce:BinaryParameterType xmlns:xtce="{XTCE_1_2_XMLNS}" name="TEST_PARAM_Type"> | ||
| <xtce:UnitSet> | ||
| <xtce:Unit>m</xtce:Unit> | ||
| <xtce:Unit>s</xtce:Unit> | ||
| </xtce:UnitSet> | ||
| <xtce:BinaryDataEncoding> | ||
| <xtce:SizeInBits> | ||
| <xtce:FixedValue>128</xtce:FixedValue> | ||
| </xtce:SizeInBits> | ||
| </xtce:BinaryDataEncoding> | ||
| </xtce:BinaryParameterType> | ||
| """, | ||
| parameter_types.BinaryParameterType( | ||
| name="TEST_PARAM_Type", | ||
| unit=("m", "s"), | ||
| encoding=encodings.BinaryDataEncoding(fixed_size_in_bits=128), | ||
| ), | ||
| ), | ||
|
Comment on lines
+593
to
+612
Member
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. Yep! Good catch. @blakedehaas Let's get the round tripping of the unit set tested. Both parsing from XML and serialization to XML. You addressed the parsing side above but we should also have a serialization test to prove that we serialize multiple unit elements correctly. |
||
| ], | ||
| ) | ||
| def test_binary_parameter_type(elmaker, xtce_parser, xml_string: str, expectation): | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.