Skip to content

Commit

Permalink
autotest: allow assertion of mavlink message array elements
Browse files Browse the repository at this point in the history
  • Loading branch information
tpwrules committed Nov 30, 2024
1 parent 8106195 commit 7b6d1ba
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Tools/autotest/vehicle_test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -4364,7 +4364,13 @@ def message_has_field_values_field_values_equal(self, fieldname, value, got, eps

def message_has_field_values(self, m, fieldvalues, verbose=True, epsilon=None):
for (fieldname, value) in fieldvalues.items():
got = getattr(m, fieldname)
if "[" in fieldname: # fieldname == "arrayname[index]"
assert fieldname[-1] == "]", fieldname
arrayname, index = fieldname.split("[", 1)
index = int(index[:-1])
got = getattr(m, arrayname)[index]
else:
got = getattr(m, fieldname)

value_string = value
got_string = got
Expand Down

0 comments on commit 7b6d1ba

Please sign in to comment.