fix bug with asserts
[platform/upstream/flac.git] / test / test_streams.sh
1 #!/bin/sh
2
3 LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/lib:$LD_LIBRARY_PATH
4 export LD_LIBRARY_PATH
5 PATH=../src/flac:../src/test_streams:../obj/bin:$PATH
6
7 if test_streams ; then : ; else
8         echo "ERROR during test_streams" 1>&2
9         exit 1
10 fi
11
12 test_file ()
13 {
14         name=$1
15         channels=$2
16         bps=$3
17         encode_options="$4"
18
19         echo "### ENCODE $name ########################################" >> ./encode.log
20         echo -n "$name: encode..."
21         if flac -s -fb -fs 44100 -fp $bps -fc $channels -0 -l 8 -m -e $encode_options $name.raw $name.flac 2>>./encode.log ; then : ; else
22                 echo "ERROR during encode of $name" 1>&2
23                 exit 1
24         fi
25         echo "### DECODE $name ########################################" >> ./decode.log
26         echo -n "decode..."
27         if flac -s -fb -d -fr $name.flac $name.cmp 2>>./decode.log ; then : ; else
28                 echo "ERROR during decode of $name" 1>&2
29                 exit 1
30         fi
31         echo -n "compare..."
32         if cmp $name.raw $name.cmp ; then : ; else
33                 echo "ERROR during compare of $name" 1>&2
34                 exit 1
35         fi
36         echo OK
37 }
38
39 echo "Testing small files..."
40 test_file test01 1 16
41 test_file test02 2 16
42 test_file test03 1 16
43 test_file test04 2 16
44
45 echo "Testing 8-bit full-scale deflection streams..."
46 for b in 01 02 03 04 05 06 07 ; do
47         test_file fsd8-$b 1 8 "-q 15"
48 done
49
50 echo "Testing 16-bit full-scale deflection streams..."
51 for b in 01 02 03 04 05 06 07 ; do
52         test_file fsd16-$b 1 16 "-q 15"
53 done
54
55 echo "Testing sine wave streams..."
56 for b in 01 02 03 04 05 ; do
57         test_file sine-$b 1 16 ""
58 done
59
60 echo "Testing some frame header variations..."
61 test_file sine-02 1 16 "--lax -b 16"
62 test_file sine-02 1 16 "--lax -b 65535"
63 test_file sine-02 1 16 "-b 16"
64 test_file sine-02 1 16 "-b 65535"
65 test_file sine-02 1 16 "--lax -fs 9"
66 test_file sine-02 1 16 "--lax -fs 90"
67 test_file sine-02 1 16 "--lax -fs 90000"
68 test_file sine-02 1 16 "-fs 9"
69 test_file sine-02 1 16 "-fs 90"
70 test_file sine-02 1 16 "-fs 90000"