formats: clarify setting of reverse_bytes
[sox.git] / src / test-comments
blob291ffa134cb5734af10688905412b3ebac632e43
1 #!/bin/sh
3 tmp=/tmp/`basename $0`-$$
4 input=$tmp.wav # no comment support
6 check_file () {
7 ./sox --i -a $1 > $tmp.comments
8 cmp $tmp.comments $2 || exit 1
11 check () {
12 f=$1; shift
13 : > $tmp.expected
14 while [ $# != 0 ]; do
15 echo "$1" >> $tmp.expected
16 shift
17 done
18 check_file $f $tmp.expected
21 com0="Processed by SoX"
22 com1="foo bar"
23 com2="bar foo"
25 ./sox -n $input trim 0 .1
27 ./sox $input $tmp.au # Apply default comment
28 check $tmp.au "$com0"
30 cp $tmp.au $tmp.comment.au
32 cat > $tmp.i << .
33 TITLE=First Track
34 ARTIST=A Band
35 ALBUM=A Collection Of Songs
36 TRACKNUMBER=01
39 ./sox $input --comment-file $tmp.i $tmp.comments.au
40 check_file $tmp.comments.au $tmp.i
42 ./sox $input --comment= $tmp.au # Don't apply default comment
43 check $tmp.au
45 ./sox $input --add-comment "$com1" $tmp.au
46 check $tmp.au "$com1"
48 ./sox $tmp.comment.au --add-comment "$com1" $tmp.au
49 check $tmp.au "$com0" "$com1"
51 ./sox $input --add-comment "$com1" --add-comment "$com2" $tmp.au
52 check $tmp.au "$com1" "$com2"
54 ./sox $tmp.comment.au --add-comment "$com1" --add-comment "$com2" $tmp.au
55 check $tmp.au "$com0" "$com1" "$com2"
57 ./sox $tmp.comments.au --comment= $tmp.au
58 check $tmp.au
60 ./sox $tmp.comments.au --comment "$com1" $tmp.au
61 check $tmp.au "$com1"
63 ./sox $tmp.comments.au --add-comment "$com1" $tmp.au
64 cp $tmp.i $tmp.j
65 echo "$com1" >> $tmp.j
66 check_file $tmp.au $tmp.j
68 ./sox $tmp.comments.au --add-comment "$com1" --add-comment "$com2" $tmp.au
69 echo "$com2" >> $tmp.j
70 check_file $tmp.au $tmp.j
72 # FIXME: smp mp3
73 ./sox $tmp.comments.au $tmp.aiff
74 ./sox $tmp.aiff $tmp.flac
75 ./sox $tmp.flac $tmp.sf
76 ./sox $tmp.sf $tmp.ogg
77 ./sox $tmp.ogg $tmp.sndt
78 ./sox $tmp.sndt $tmp.sox
79 ./sox $tmp.sox $tmp.au
80 check_file $tmp.au $tmp.i
82 rm -f $tmp.*
83 exit 0