Skip to content

Commit 87788bf

Browse files
committed
Added unit test for BASE64 script.
1 parent beb48a7 commit 87788bf

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

test/BASE64/BASE64.LUA

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../util/BASE64.LUA

test/BASE64/test.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env sh
2+
set -e
3+
INTERP=${INTERP:-lua}
4+
TEST="BASE64 ENCODE"
5+
SCRIPT="BASE64.LUA"
6+
7+
GNU=$(base64 $SCRIPT)
8+
LUA=$($INTERP $SCRIPT $SCRIPT)
9+
10+
if [ "$GNU" = "$LUA" ]; then
11+
echo "$TEST: PASS"
12+
else
13+
echo "$TEST: FAIL"
14+
exit 1
15+
fi
16+
17+
TEST="BASE64 DECODE"
18+
19+
LUA=$(echo $GNU | $INTERP $SCRIPT -d)
20+
GNU=$(cat $SCRIPT)
21+
22+
if [ "$GNU" = "$LUA" ]; then
23+
echo "$TEST: PASS"
24+
exit 0
25+
else
26+
echo "$TEST: FAIL"
27+
exit 1
28+
fi

0 commit comments

Comments
 (0)