-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbfish-test.sh
More file actions
75 lines (62 loc) · 1.55 KB
/
bfish-test.sh
File metadata and controls
75 lines (62 loc) · 1.55 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# Check for executable files.
if [ ! -f bfish -o ! -x bfish ]; then
echo "Error: can't locate executable file 'bfish'"
exit 1
fi
if [ ! -f bfishmt -o ! -x bfishmt ]; then
echo "Error: can't locate executable file 'bfishmt'"
exit 1
fi
# Check for test files.
if [ -f afile.txt -o -f afile.enc -o -f afile.out ]; then
echo "Warning: Test file: afile.txt, afile.enc, or afile.out exists"
echo "Overwrite? "
read RESPONSE junk
if [ $RESPONSE = 'n' ]; then
exit 1
fi
rm -f afile.txt afile.enc afile.out
fi
# Should search the path for makebig. Maybe later
# Perform tests.
ERROR=0
for SIZE in 2048 4096 6144 8192 10250; do
echo "Size = $SIZE"
makebig -b$SIZE > afile.txt 2> /dev/null
echo "bfish..."
bfish -e afile.txt afile.enc "Hello, World"
bfish -d afile.enc afile.out "Hello, World"
cmp afile.txt afile.out
if [ $? -ne 0 ]; then
ERROR=1
fi
echo "bfishmt..."
bfishmt -e afile.txt afile.enc "Hello, World"
bfishmt -d afile.enc afile.out "Hello, World"
cmp afile.txt afile.out
if [ $? -ne 0 ]; then
ERROR=1
fi
echo "bfish to bfishmt..."
bfish -e afile.txt afile.enc "Hello, World"
bfishmt -d afile.enc afile.out "Hello, World"
cmp afile.txt afile.out
if [ $? -ne 0 ]; then
ERROR=1
fi
echo "bfishmt to bfish..."
bfishmt -e afile.txt afile.enc "Hello, World"
bfish -d afile.enc afile.out "Hello, World"
cmp afile.txt afile.out
if [ $? -ne 0 ]; then
ERROR=1
fi
done
# Clean up.
rm -f afile.txt afile.enc afile.out
if [ $ERROR -eq 1 ]; then
echo 'FAIL!'
else
echo 'PASS!'
fi