-
Notifications
You must be signed in to change notification settings - Fork 589
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc8b454
commit 93b9fc5
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/python | ||
|
||
|
||
""" | ||
test for trimming under Python 3 | ||
""" | ||
|
||
from __future__ import absolute_import, print_function | ||
import unittest | ||
import os | ||
import pkg_resources | ||
import sys | ||
from pymavlink import mavutil | ||
|
||
class PayLoadTrimZeros(unittest.TestCase): | ||
'''Trivial test for trimming zeros from end of messages''' | ||
|
||
def test_dump_length(self): | ||
mavutil.mavlink.WIRE_PROTOCOL_VERSION = 2 | ||
mav = mavutil.mavudp(":12345") | ||
|
||
ts = [ ((1, 1), 10), | ||
((1, 0), 9), | ||
((0, 0), 9) | ||
] | ||
for t in ts: | ||
((sysid, compid), result) = t | ||
m = mavutil.mavlink.MAVLink_param_request_list_message(sysid, compid) | ||
packed = m.pack(mav.mav) | ||
print("(%u/%u should be %u" % (sysid,compid, result)) | ||
self.assertEqual(len(packed), result) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |