summaryrefslogtreecommitdiff
path: root/utils/gen-compression-tests.bash
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-10-25 19:37:19 +0200
committerMichał Górny <mgorny@gentoo.org>2017-10-25 19:37:19 +0200
commitf91a5a4d62de9b1d31c2263fab168165e1765830 (patch)
tree03ae5cc7bdff00c215cae46607c4ddf2bac10b98 /utils/gen-compression-tests.bash
parentbd1022e46a1933f634a27b1ed7632054f7f89a4f (diff)
downloadgemato-f91a5a4d62de9b1d31c2263fab168165e1765830.tar.gz
Provide compression abstraction
Diffstat (limited to 'utils/gen-compression-tests.bash')
-rwxr-xr-xutils/gen-compression-tests.bash31
1 files changed, 31 insertions, 0 deletions
diff --git a/utils/gen-compression-tests.bash b/utils/gen-compression-tests.bash
new file mode 100755
index 0000000..70fa631
--- /dev/null
+++ b/utils/gen-compression-tests.bash
@@ -0,0 +1,31 @@
+#!/bin/bash
+test_string='The quick brown fox jumps over the lazy dog'
+
+if [[ ${#} -lt 1 ]]; then
+ echo "Usage: ${0} <program-to-use>"
+ exit 1
+fi
+
+program=${1}
+
+empty=$(printf '' | ${program} | base64)
+str=$(printf '%s' "${test_string}" | ${program} | base64)
+split=$(
+ ( printf '%s' "${test_string::20}" | ${program}
+ printf '%s' "${test_string:20}" | ${program} ) | base64)
+
+cat <<_EOF_
+
+ BASE64 = b'''
+${str}
+'''
+
+ EMPTY_BASE64 = b'''
+${empty}
+'''
+
+ SPLIT_BASE64 = b'''
+${split}
+'''
+
+_EOF_