move sbus2 to gtest

This commit is contained in:
Daniel Agar
2015-01-05 22:12:25 -05:00
parent bd130ec397
commit d31b0cd5db
+11 -28
View File
@@ -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);
}