Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-bc committed Jan 30, 2025
1 parent 72734f3 commit e0e2d75
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,38 @@
"dictionarySpecVersion" : "1.0.0"
},
"typeDefinitions" : [
{
"kind" : "struct",
"qualifiedName" : "Ref.TestMisorderedStructIndexes",
"members" : {
"ThisIsOne" : {
"type" : {
"name" : "U32",
"kind" : "integer",
"size" : 32,
"signed" : false
},
"index" : 1
},
"ThisIsZero" : {
"type" : {
"name" : "U32",
"kind" : "integer",
"size" : 32,
"signed" : false
},
"index" : 0
},
"ThisIsTwo" : {
"type" : {
"name" : "Ref.PacketRecvStatus",
"kind" : "qualifiedIdentifier"
},
"index" : 2
}
},
"annotation" : "This type does not exist in Ref and is only used for GDS internal testing"
},
{
"kind" : "struct",
"qualifiedName" : "Ref.PacketStat",
Expand Down
10 changes: 10 additions & 0 deletions test/fprime_gds/common/loaders/test_json_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ def test_construct_serializable_type(loader):
assert ref_choice_pair.MEMBER_LIST[1][2] == "{}"


def test_struct_with_unordered_members(loader):
misordered_member = loader.parse_type(

Check failure on line 104 in test/fprime_gds/common/loaders/test_json_loader.py

View workflow job for this annotation

GitHub Actions / Spell checking

`misordered` is not a recognized word. (unrecognized-spelling)
{"name": "Ref.TestMisorderedStructIndexes", "kind": "qualifiedIdentifier"}

Check failure on line 105 in test/fprime_gds/common/loaders/test_json_loader.py

View workflow job for this annotation

GitHub Actions / Spell checking

`Misordered` is not a recognized word. (unrecognized-spelling)
)
assert issubclass(misordered_member, SerializableType)

Check failure on line 107 in test/fprime_gds/common/loaders/test_json_loader.py

View workflow job for this annotation

GitHub Actions / Spell checking

`misordered` is not a recognized word. (unrecognized-spelling)
assert misordered_member.MEMBER_LIST[0][0] == "ThisIsZero"

Check failure on line 108 in test/fprime_gds/common/loaders/test_json_loader.py

View workflow job for this annotation

GitHub Actions / Spell checking

`misordered` is not a recognized word. (unrecognized-spelling)
assert misordered_member.MEMBER_LIST[1][0] == "ThisIsOne"

Check failure on line 109 in test/fprime_gds/common/loaders/test_json_loader.py

View workflow job for this annotation

GitHub Actions / Spell checking

`misordered` is not a recognized word. (unrecognized-spelling)
assert misordered_member.MEMBER_LIST[2][0] == "ThisIsTwo"

Check failure on line 110 in test/fprime_gds/common/loaders/test_json_loader.py

View workflow job for this annotation

GitHub Actions / Spell checking

`misordered` is not a recognized word. (unrecognized-spelling)


def test_construct_primitive_types(loader):
i32_type = loader.parse_type(
{"name": "I32", "kind": "integer", "size": 32, "signed": True}
Expand Down

0 comments on commit e0e2d75

Please sign in to comment.