Skip to content
Snippets Groups Projects
Commit fa5046cd authored by Kaspar Schleiser's avatar Kaspar Schleiser
Browse files

tests: unittests: add netopt module unit tests

parent d18cb7a9
No related branches found
No related tags found
No related merge requests found
include $(RIOTBASE)/Makefile.base
USEMODULE += netopt
/*
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
*
* 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 <string.h>
#include "embUnit.h"
#include "net/netopt.h"
#include "unittests-constants.h"
#include "tests-netopt.h"
void test_netopt2str(void)
{
/* here we just test if netopt2str has a value defined for any given
* NETOPT option code */
for (int i = 0; i < NETOPT_NUMOF; i++) {
TEST_ASSERT(strcmp(netopt2str(i), "unknown"));
}
}
void test_netopt2str_unknown(void)
{
TEST_ASSERT_EQUAL_INT(0, strcmp(netopt2str(NETOPT_NUMOF), "unknown"));
}
Test *tests_netopt_tests(void)
{
EMB_UNIT_TESTFIXTURES(fixtures) {
new_TestFixture(test_netopt2str),
new_TestFixture(test_netopt2str_unknown),
};
EMB_UNIT_TESTCALLER(netopt_tests, NULL, NULL, fixtures);
return (Test *)&netopt_tests;
}
void tests_netopt(void)
{
TESTS_RUN(tests_netopt_tests());
}
/** @} */
/*
* Copyright (C) 2015 Kaspar Schleiser <kaspar@schleiser.de>
*
* 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 ``netopt`` module
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
*/
#ifndef TESTS_NETOPT_H_
#define TESTS_NETOPT_H_
#include "embUnit.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief The entry point of this test suite.
*/
void tests_netopt(void);
#ifdef __cplusplus
}
#endif
#endif /* TESTS_NETOPT_H_ */
/** @} */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment