blob: b21b074b1f8d5fab7d537f98961eb53d2db97cd1 [file] [log] [blame]
Holger Hans Peter Freytherb79a1482014-01-02 13:55:00 +01001/* tests for utilities of libmsomcore */
2/*
3 * (C) 2014 Holger Hans Peter Freyther
4 *
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 */
22
23#include <osmocom/core/utils.h>
24
25#include <stdio.h>
26
27static void hexdump_test(void)
28{
29 uint8_t data[4098];
30 int i;
31
32 for (i = 0; i < ARRAY_SIZE(data); ++i)
33 data[i] = i & 0xff;
34
35 printf("Plain dump\n");
36 printf("%s\n", osmo_hexdump(data, 4));
37
38 printf("Corner case\n");
39 printf("%s\n", osmo_hexdump(data, ARRAY_SIZE(data)));
40 printf("%s\n", osmo_hexdump_nospc(data, ARRAY_SIZE(data)));
41}
42
43int main(int argc, char **argv)
44{
45 hexdump_test();
46 return 0;
47}