danny wang a136536ff5 watchrobot first commit 2 years ago
..
MAVLink a136536ff5 watchrobot first commit 2 years ago
MAVLink.xcodeproj a136536ff5 watchrobot first commit 2 years ago
MAVLinkTests a136536ff5 watchrobot first commit 2 years ago
.gitignore a136536ff5 watchrobot first commit 2 years ago
README.md a136536ff5 watchrobot first commit 2 years ago
ardugen.sh a136536ff5 watchrobot first commit 2 years ago

README.md

Swift MAVLink library test project

MAVLinkTests target covers DataExtensions with unit tests (conversion between raw data and typed values). Also it contains some integration tests for MAVLink class.

To quickly generate MAVLink classes and enums for Swift you can use following script:

./ardugen.sh

It will generate Swift files for ardupilotmega.xml definitions into MAVLink/MAVLink/Swift folder and C headers for the same xml file into MAVLinkTest/MAVLink/C folder. C headers are used to check Swift library compatibility with C/C++ implementations.

Please keep in mind that you will probably need to re-add generated MAVLink swift files to the project as complete list of files depends on specific declarations in xml file. C headers will be compiled as Clang module, so there is no need to add them into Xcode project.

Test suite consists of:

  • DataExtensionsTests.swift contains unit tests that cover raw-to-typed values transformations and vise versa (with informative erroring)
  • MAVLinkTests.swift covers some edge cases of parsing state machine
  • CompareWithCImpTests.swift tests which compare output of Swift library with C on the same raw data input (attached tlog file)

Test tlog file was downloaded from DroneKit LA testdata repository.