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