1#!/bin/bash
2
3[ -f testing.sh ] && . testing.sh
4
5#testing "name" "command" "result" "infile" "stdin"
6
7testing "uudecode uu empty file" "uudecode -o /dev/stdout && echo yes" \
8	"yes\n" "" "begin 744 test\n\`\nend\n"
9testing "uudecode uu 1-char" "uudecode -o /dev/stdout" "a" "" \
10	"begin 744 test\n!80  \n\`\nend\n"
11testing "uudecode uu 2-char" "uudecode -o /dev/stdout" "ab" "" \
12	"begin 744 test\n\"86( \n\`\nend\n"
13testing "uudecode uu 3-char" "uudecode -o /dev/stdout" "abc" "" \
14	"begin 744 test\n#86)C\n\`\nend\n"
15
16testing "uudecode b64 empty file" "uudecode -o /dev/stdout && echo yes" \
17        "yes\n" "" "begin-base64 744 test\n====\n"
18testing "uudecode b64 1-char" "uudecode -o /dev/stdout" "a" "" \
19	"begin-base64 744 test\nYQ==\n====\n"
20testing "uudecode b64 2-char" "uudecode -o /dev/stdout" "ab" "" \
21	"begin-base64 744 test\nYWI=\n====\n"
22testing "uudecode b64 3-char" "uudecode -o /dev/stdout" "abc" "" \
23	"begin-base64 744 test\nYWJj\n====\n"
24
25testing "uudecode filename" "uudecode && echo -ne 'abc' | cmp uudecode-fn-test /dev/stdin && echo -ne yes && rm uudecode-fn-test" \
26	"yes" "" "begin-base64 744 uudecode-fn-test\nYWJj\n====\n"
27
28