aboutsummaryrefslogtreecommitdiff
path: root/testsuite/xxd.tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/xxd.tests')
-rwxr-xr-xtestsuite/xxd.tests34
1 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/xxd.tests b/testsuite/xxd.tests
new file mode 100755
index 000000000..2e80be5fe
--- /dev/null
+++ b/testsuite/xxd.tests
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# Copyright 2020 by Denys Vlasenko <vda.linux@googlemail.com>
+# Licensed under GPLv2, see file LICENSE in this source tree.
+
+. ./testing.sh
+
+# testing "description" "command" "result" "infile" "stdin"
+testing 'xxd -p with one NUL' \
+ 'xxd -p' \
+ "\
+00
+" \
+ '' \
+ '\0'
+
+testing 'xxd -p with 30 NULs' \
+ 'xxd -p' \
+ "\
+000000000000000000000000000000000000000000000000000000000000
+" \
+ '' \
+ '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'
+
+testing 'xxd -p with 31 NULs' \
+ 'xxd -p' \
+ "\
+000000000000000000000000000000000000000000000000000000000000
+00
+" \
+ '' \
+ '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'
+
+exit $FAILCOUNT