Blame view

RIOT/tests/unittests/tests-netopt/tests-netopt.c 1.07 KB
a752c7ab   elopes   add first test an...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  /*
   * 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());
  }
  /** @} */