Blame view

RIOT/tests/od/main.c 1010 Bytes
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
  /*
   * Copyright (C) 2016 Freie Universitรคt Berlin
   *
   * 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.
   */
  
  /**
   * @ingroup     tests
   * @{
   *
   * @file
   * @brief       Tests od module.
   *
   * @author      Martine Lenders <mlenders@inf.fu-berlin.de>
   *
   * @}
   */
  
  #include <stdio.h>
  
  #include "od.h"
  
  #define CALL(fn)    puts(#fn); fn
  
  static const char short_str[] = "AB";
  static const char long_str[] = "\xff,a\xff.bcdefghijklmnop";
  
  int main(void)
  {
      /* test data width vs. output width discrepency */
      CALL(od_hex_dump(short_str, sizeof(short_str), OD_WIDTH_DEFAULT));
  
      /* Test different output width in default configuration*/
      CALL(od_hex_dump(long_str, sizeof(long_str), OD_WIDTH_DEFAULT));
      CALL(od_hex_dump(long_str, sizeof(long_str), 4));
      CALL(od_hex_dump(long_str, sizeof(long_str), 3));
      CALL(od_hex_dump(long_str, sizeof(long_str), 8));
  
      return 0;
  }