3
if [ -z "$srcdir" ] ; then
7
# echo -n is not portable
9
if [ "`echo -n ''`" = "" ]; then
11
elif [ "`echo '\c'`" = "" ]; then
14
echo >&2 'Neither echo -n nor echo \c seems to work.'
18
# Doesn't work if $1 contains
23
# Using a here-document seems more robust. However, I don't know how
24
# to get rid of the final newline, so we can't use it exclusively.
32
print_raw "$1" test.in
33
if ../tools/sexp-conv -s advanced <test.in >test1.out ; then
38
print_nl "$2" test2.out
40
if cmp test1.out test2.out ; then
47
test_advanced_hex () {
48
print_raw "$1" test.in
49
if ../tools/sexp-conv -s hex <test.in >test1.out ; then
54
print_nl "$2" test2.out
56
if cmp test1.out test2.out ; then
64
print_raw "$1" test.in
65
if ../tools/sexp-conv -s transport <test.in >test1.out ; then
70
print_nl "$2" test2.out
72
if cmp test1.out test2.out ; then
80
print_raw "$1" test.in
81
if ../tools/sexp-conv -s canonical <test.in >test1.out ; then
86
print_raw "$2" test2.out
88
if cmp test1.out test2.out ; then
95
test_advanced '0:' '""'
96
test_advanced '3:foo' 'foo'
97
test_advanced '12:fooooooooooo' 'fooooooooooo'
98
test_advanced '10:fooooooooo' 'fooooooooo'
99
test_advanced '4:3des' '"3des"'
100
test_advanced '"foo"' 'foo'
103
# Having the string end with a \ breaks with sysv echo. \x seems harmless.
104
test_advanced '3:"\x' '"\"\\x"'
105
test_advanced '()' '()'
106
test_advanced '(foo bar baz)' '(foo bar
108
test_advanced '; comment
111
test_advanced '(foo[bar]foo)' '(foo [bar]foo)'
113
test_advanced '(#aabb#)' '(|qrs=|)'
114
test_advanced '(|qrs=|)' '(|qrs=|)'
115
test_advanced_hex '(|qrs=|)' '(#aabb#)'
116
test_advanced_hex '(#aabb#)' '(#aabb#)'
117
test_advanced_hex '{MToR}' '#11#'
118
test_advanced_hex '|EQ==|' '#11#'
120
test_transport '0:' '{MDo=}'
121
test_transport '()' '{KCk=}'
122
test_transport '1:A' '{MTpB}'
123
test_transport 'foo' '{Mzpmb28=}'
124
test_transport '(foo bar baz)' '{KDM6Zm9vMzpiYXIzOmJheik=}'
126
test_canonical '""' '0:'
127
test_canonical '{MDo=}' '0:'
128
test_canonical '{KCk=}' '()'
129
test_canonical '{MTpB}' '1:A'
130
test_canonical 'foo' '3:foo'
131
test_canonical 'fooooooooooo' '12:fooooooooooo'
132
test_canonical 'fooooooooo' '10:fooooooooo'
133
test_canonical '(foo bar baz)' '(3:foo3:bar3:baz)'
134
test_canonical '{KDM6Zm9vMzpiYXIzOmJheik=}' '(3:foo3:bar3:baz)'