From 08062e6546f02cb2e819f690d35b485425788cc4 Mon Sep 17 00:00:00 2001 From: Anton Matosov Date: Wed, 7 Jan 2015 00:25:06 +0200 Subject: Changed naming of the mixers to get rid of umbiguity as outputs are actually going to be driven by io, not fmu Implemented automatic lookup for the .aux.mix file if it exists --- unittests/conversion_test.cpp | 2 +- unittests/mixer_test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'unittests') diff --git a/unittests/conversion_test.cpp b/unittests/conversion_test.cpp index 99e1c7721..12d2213e2 100644 --- a/unittests/conversion_test.cpp +++ b/unittests/conversion_test.cpp @@ -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"; } diff --git a/unittests/mixer_test.cpp b/unittests/mixer_test.cpp index fd3ece7f8..1271dab5e 100644 --- a/unittests/mixer_test.cpp +++ b/unittests/mixer_test.cpp @@ -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"; } -- cgit v1.2.3 From a4db73dad894e7b6f6920fcd1184127f9c997201 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Wed, 7 Jan 2015 23:15:12 -0500 Subject: move st24_test to gtest --- unittests/CMakeLists.txt | 2 -- unittests/st24_test.cpp | 31 +++++-------------------------- 2 files changed, 5 insertions(+), 28 deletions(-) (limited to 'unittests') diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index c2990c59f..247ddbb3d 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -61,12 +61,10 @@ 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) diff --git a/unittests/st24_test.cpp b/unittests/st24_test.cpp index 0c56df173..89c7ffb1c 100644 --- a/unittests/st24_test.cpp +++ b/unittests/st24_test.cpp @@ -1,4 +1,3 @@ - #include #include #include @@ -7,30 +6,17 @@ #include #include "../../src/systemcmds/tests/tests.h" -int main(int argc, char *argv[]) -{ - warnx("ST24 test started"); - - char* defaultfile = "testdata/st24_data.txt"; +#include "gtest/gtest.h" - 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); } -- cgit v1.2.3 From cc2d0f00d6826d050c1f9e852970dd409946ee0d Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Wed, 7 Jan 2015 23:17:31 -0500 Subject: move sf0x_test to gtest --- unittests/CMakeLists.txt | 1 - unittests/sf0x_test.cpp | 20 +++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'unittests') diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 247ddbb3d..666570a71 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -69,6 +69,5 @@ 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) diff --git a/unittests/sf0x_test.cpp b/unittests/sf0x_test.cpp index 1af128bbe..ffaaaf04a 100644 --- a/unittests/sf0x_test.cpp +++ b/unittests/sf0x_test.cpp @@ -1,19 +1,15 @@ - -#include -#include -#include #include -#include -#include +#include +#include +#include +#include #include +#include -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; } -- cgit v1.2.3