Browse Source

move sbus2 to gtest

sbg
Daniel Agar 10 years ago
parent
commit
d31b0cd5db
  1. 39
      unittests/sbus2_test.cpp

39
unittests/sbus2_test.cpp

@ -1,33 +1,23 @@ @@ -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"
int main(int argc, char *argv[]) {
warnx("SBUS2 test started");
char *filepath = 0;
#include <systemlib/err.h>
#include <systemlib/mixer/mixer.h>
if (argc < 2) {
warnx("Using default input file");
filepath = "testdata/sbus2_r7008SB.txt";
} else {
filepath = argv[1];
}
#include "gtest/gtest.h"
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[]) { @@ -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);
}

Loading…
Cancel
Save