diff --git a/tests/unittests/tests-zptr/Makefile b/tests/unittests/tests-zptr/Makefile new file mode 100644 index 0000000000..48422e909a --- /dev/null +++ b/tests/unittests/tests-zptr/Makefile @@ -0,0 +1 @@ +include $(RIOTBASE)/Makefile.base diff --git a/tests/unittests/tests-zptr/Makefile.include b/tests/unittests/tests-zptr/Makefile.include new file mode 100644 index 0000000000..ab8b0ccf19 --- /dev/null +++ b/tests/unittests/tests-zptr/Makefile.include @@ -0,0 +1 @@ +USEMODULE += zptr diff --git a/tests/unittests/tests-zptr/tests-zptr.c b/tests/unittests/tests-zptr/tests-zptr.c new file mode 100644 index 0000000000..e08c3e520d --- /dev/null +++ b/tests/unittests/tests-zptr/tests-zptr.c @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2017 Kaspar Schleiser + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @{ + * + * @file + */ +#include +#include +#include + +#include "embUnit/embUnit.h" + +#include "zptr.h" +#include "tests-zptr.h" + +static void test_zptr_basic(void) +{ + uint32_t val; + TEST_ASSERT(&val == zptrd(zptrc(&val))); +} + +Test *tests_zptr_tests(void) +{ + EMB_UNIT_TESTFIXTURES(fixtures) { + new_TestFixture(test_zptr_basic), + }; + + EMB_UNIT_TESTCALLER(zptr_tests, NULL, NULL, fixtures); + + return (Test *)&zptr_tests; +} + +void tests_zptr(void) +{ + TESTS_RUN(tests_zptr_tests()); +} +/** @} */ diff --git a/tests/unittests/tests-zptr/tests-zptr.h b/tests/unittests/tests-zptr/tests-zptr.h new file mode 100644 index 0000000000..4e429fb0aa --- /dev/null +++ b/tests/unittests/tests-zptr/tests-zptr.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2017 Kaspar Schleiser + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @addtogroup unittests + * @{ + * + * @file + * @brief Unittests for the ``zptr`` module + * + * @author Kaspar Schleiser + */ +#ifndef TESTS_ZPTR_H +#define TESTS_ZPTR_H + +#include "embUnit.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief The entry point of this test suite. + */ +void tests_zptr(void); + +#ifdef __cplusplus +} +#endif + +#endif /* TESTS_ZPTR_H */ +/** @} */