6
bytes=`./length --hex --encode $1`
9
if test "$bytes" != "$expected"; then
10
failed=`expr $failed + 1`
11
echo "Got '$bytes' but expected '$expected'"
16
bytes=`./length --encode $value`
17
result=`./length --decode $bytes`
18
if test $result -ne $value; then
19
failed=`expr $failed + 1`
20
echo "Got $result but expected $value"
24
# check that the encoding is correct
27
check_encode 256 0x0 0x0 0x1
28
check_encode 65535 0x0 0xff 0xff
30
# Check that we can decode what we have encoded
31
for value in 2 255 256 65535 65536 \
33
`expr 16 "*" 65536 + 255`
35
check_invertible $value
38
exit `test $failed -gt 0`