summaryrefslogtreecommitdiff
path: root/utils/gen-compression-tests.bash
blob: 70fa631d8f2a23f62bf6ef7800fc828d7924eaaa (plain)
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
#!/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_