comparison tests/include.sh @ 196:082c3f21f49e

Simple MIDI writer test
author Chris Cannam
date Tue, 01 Sep 2015 15:51:07 +0100
parents 4ef452f5fefc
children 1f8fef5c6ea2
comparison
equal deleted inserted replaced
195:3f7c65f26559 196:082c3f21f49e
46 # a bit like the above, but ignoring first column (and without temp files) 46 # a bit like the above, but ignoring first column (and without temp files)
47 out=`cat "$1" "$2" | cut -d, -f2- | perl -p -e 's/(\d+\.\d{6})\d+/$1/' | sort | uniq -c | grep -v ' 2 '` 47 out=`cat "$1" "$2" | cut -d, -f2- | perl -p -e 's/(\d+\.\d{6})\d+/$1/' | sort | uniq -c | grep -v ' 2 '`
48 return `[ -z "$out" ]` 48 return `[ -z "$out" ]`
49 } 49 }
50 50
51 midicompare() {
52 a="$1"
53 b="$2"
54 od -c "$a" > "${a}__"
55 od -c "$b" > "${b}__"
56 cmp -s "${a}__" "${b}__"
57 rv=$?
58 rm "${a}__" "${b}__"
59 return $rv
60 }
61
51 faildiff() { 62 faildiff() {
52 echo "Test failed: $1" 63 echo "Test failed: $1"
53 if [ -n "$2" -a -n "$3" ]; then 64 if [ -n "$2" -a -n "$3" ]; then
54 echo "Output follows:" 65 echo "Output follows:"
55 echo "--" 66 echo "--"
56 cat $2 67 cat "$2"
57 echo "--" 68 echo "--"
58 echo "Expected output follows:" 69 echo "Expected output follows:"
59 echo "--" 70 echo "--"
60 cat $3 71 cat "$3"
61 echo "--" 72 echo "--"
62 echo "Diff:" 73 echo "Diff:"
63 echo "--" 74 echo "--"
64 sdiff -w78 $2 $3 75 sdiff -w78 "$2" "$3"
76 echo "--"
77 fi
78 exit 1
79 }
80
81 faildiff_od() {
82 echo "Test failed: $1"
83 if [ -n "$2" -a -n "$3" ]; then
84 echo "Output follows:"
85 echo "--"
86 od -c "$2"
87 echo "--"
88 echo "Expected output follows:"
89 echo "--"
90 od -c "$3"
91 echo "--"
92 echo "Diff:"
93 echo "--"
94 od -w8 -c "$3" > "${3}__"
95 od -w8 -c "$2" | sdiff -w78 - "${3}__"
96 rm "${3}__"
65 echo "--" 97 echo "--"
66 fi 98 fi
67 exit 1 99 exit 1
68 } 100 }
69 101