mirror of https://github.com/ArduPilot/ardupilot
autotest: allow assertion of mavlink message array elements
This commit is contained in:
parent
190c3aa7ab
commit
6abbefde12
|
@ -4364,6 +4364,12 @@ class TestSuite(ABC):
|
|||
|
||||
def message_has_field_values(self, m, fieldvalues, verbose=True, epsilon=None):
|
||||
for (fieldname, value) in fieldvalues.items():
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue