From a73a095c1d6aba53edb47cbb7375c81261772e43 Mon Sep 17 00:00:00 2001 From: Andreas Antener Date: Mon, 2 Feb 2015 16:53:12 +0100 Subject: added test and stub --- unittests/param_test.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 unittests/param_test.cpp (limited to 'unittests/param_test.cpp') diff --git a/unittests/param_test.cpp b/unittests/param_test.cpp new file mode 100644 index 000000000..d4c10acaf --- /dev/null +++ b/unittests/param_test.cpp @@ -0,0 +1,34 @@ +#include +#include + +#include "gtest/gtest.h" + +//#PARAM_DEFINE_INT32(TEST_A, 5); + +struct param_info_s test = { + "test", + PARAM_TYPE_INT32, + .val.i = 2 +}; + + + +extern param_info_s *__param_start, *__param_end; +const struct param_info_s *ib = __param_start; +const struct param_info_s *il = __param_end; + +TEST(ParamTest, ResetAll) { + printf("diff: %i\n", (unsigned)(il - ib)); + printf("start: %i\n", __param_start); + printf("end: %i\n", __param_end); + + param_t testparam = param_find("test"); + ASSERT_NE(PARAM_INVALID, testparam) << "param_find failed"; + + int32_t value; + int result = param_get(testparam, &value); + ASSERT_EQ(0, result) << "param_get failed"; + ASSERT_EQ(2, value) << "wrong param value"; + + ASSERT_TRUE(false) << "fail"; +} -- cgit v1.2.3