Merge remote-tracking branch 'upstream/master' into ros

This commit is contained in:
Thomas Gubler
2015-01-08 17:08:30 +01:00
61 changed files with 147 additions and 99 deletions

View File

@@ -64,16 +64,13 @@ add_executable(conversion_test conversion_test.cpp ${PX_SRC}/systemcmds/tests/te
add_gtest(conversion_test)
# sbus2_test
# TODO: move to gtest
add_executable(sbus2_test sbus2_test.cpp hrt.cpp)
add_gtest(sbus2_test)
# st24_test
# TODO: move to gtest
add_executable(st24_test st24_test.cpp hrt.cpp ${PX_SRC}/lib/rc/st24.c)
add_gtest(st24_test)
# sf0x_test
# TODO: move to gtest
add_executable(sf0x_test sf0x_test.cpp ${PX_SRC}/drivers/sf0x/sf0x_parser.cpp)
add_gtest(sf0x_test)

View File

@@ -4,6 +4,6 @@
#include "gtest/gtest.h"
TEST(ConversionTest, FMU_quad_w) {
TEST(ConversionTest, quad_w_main) {
ASSERT_EQ(test_conv(0, NULL), 0) << "Conversion test failed";
}

View File

@@ -6,6 +6,6 @@
TEST(MixerTest, Mixer) {
char* args[] = {"empty", "../ROMFS/px4fmu_common/mixers/IO_pass.mix", "../ROMFS/px4fmu_common/mixers/FMU_quad_w.mix"};
char* args[] = {"empty", "../ROMFS/px4fmu_common/mixers/IO_pass.mix", "../ROMFS/px4fmu_common/mixers/quad_w.main.mix"};
ASSERT_EQ(test_mixer(3, args), 0) << "IO_pass.mix failed";
}

View File

@@ -1,19 +1,15 @@
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <systemlib/err.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <drivers/drv_hrt.h>
#include <drivers/sf0x/sf0x_parser.h>
#include <systemlib/err.h>
int main(int argc, char *argv[])
{
warnx("SF0X test started");
int ret = 0;
#include "gtest/gtest.h"
TEST(SF0XTest, SF0X) {
const char LINE_MAX = 20;
char _linebuf[LINE_MAX];
_linebuf[0] = '\0';
@@ -60,6 +56,4 @@ int main(int argc, char *argv[])
}
warnx("test finished");
return ret;
}

View File

@@ -1,4 +1,3 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
@@ -7,30 +6,17 @@
#include <rc/st24.h>
#include "../../src/systemcmds/tests/tests.h"
int main(int argc, char *argv[])
{
warnx("ST24 test started");
#include "gtest/gtest.h"
char* defaultfile = "testdata/st24_data.txt";
char* filepath = 0;
if (argc < 2) {
warnx("Too few arguments. Using default file: %s", defaultfile);
filepath = defaultfile;
} else {
filepath = argv[1];
}
TEST(ST24Test, ST24) {
const char* filepath = "testdata/st24_data.txt";
warnx("loading data from: %s", filepath);
FILE *fp;
fp = fopen(filepath, "rt");
if (!fp) {
errx(1, "failed opening file");
}
//ASSERT_TRUE(fp);
float f;
unsigned x;
@@ -73,12 +59,5 @@ int main(int argc, char *argv[])
}
}
if (ret == EOF) {
warnx("Test finished, reached end of file");
ret = 0;
} else {
warnx("Test aborted, errno: %d", ret);
}
return ret;
ASSERT_EQ(EOF, ret);
}