aboutsummaryrefslogtreecommitdiffstats
path: root/tests/utils/utils_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils/utils_test.c')
-rw-r--r--tests/utils/utils_test.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/utils/utils_test.c b/tests/utils/utils_test.c
new file mode 100644
index 00000000..b21b074b
--- /dev/null
+++ b/tests/utils/utils_test.c
@@ -0,0 +1,47 @@
+/* tests for utilities of libmsomcore */
+/*
+ * (C) 2014 Holger Hans Peter Freyther
+ *
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include <osmocom/core/utils.h>
+
+#include <stdio.h>
+
+static void hexdump_test(void)
+{
+ uint8_t data[4098];
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(data); ++i)
+ data[i] = i & 0xff;
+
+ printf("Plain dump\n");
+ printf("%s\n", osmo_hexdump(data, 4));
+
+ printf("Corner case\n");
+ printf("%s\n", osmo_hexdump(data, ARRAY_SIZE(data)));
+ printf("%s\n", osmo_hexdump_nospc(data, ARRAY_SIZE(data)));
+}
+
+int main(int argc, char **argv)
+{
+ hexdump_test();
+ return 0;
+}