mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-22 11:37:35 +08:00
move sbus2 to gtest
This commit is contained in:
+11
-28
@@ -1,33 +1,23 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <systemlib/mixer/mixer.h>
|
||||
#include <systemlib/err.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../src/systemcmds/tests/tests.h"
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <px4iofirmware/px4io.h>
|
||||
#include "../../src/systemcmds/tests/tests.h"
|
||||
#include <systemlib/err.h>
|
||||
#include <systemlib/mixer/mixer.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
warnx("SBUS2 test started");
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
char *filepath = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
warnx("Using default input file");
|
||||
filepath = "testdata/sbus2_r7008SB.txt";
|
||||
} else {
|
||||
filepath = argv[1];
|
||||
}
|
||||
|
||||
warnx("loading data from: %s", filepath);
|
||||
TEST(SBUS2Test, SBUS2) {
|
||||
char *filepath = "testdata/sbus2_r7008SB.txt";
|
||||
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(filepath,"rt");
|
||||
|
||||
if (!fp)
|
||||
errx(1, "failed opening file");
|
||||
ASSERT_TRUE(fp);
|
||||
warnx("loading data from: %s", filepath);
|
||||
|
||||
float f;
|
||||
unsigned x;
|
||||
@@ -73,12 +63,5 @@ int main(int argc, char *argv[]) {
|
||||
//sbus_parse(now, frame, &partial_frame_count, rc_values, &num_values, &sbus_failsafe, &sbus_frame_drop, max_channels);
|
||||
}
|
||||
|
||||
if (ret == EOF) {
|
||||
warnx("Test finished, reached end of file");
|
||||
ret = 0;
|
||||
} else {
|
||||
warnx("Test aborted, errno: %d", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
ASSERT_EQ(ret, EOF);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user