summaryrefslogtreecommitdiff
path: root/flacdec/test-bitexact-decode.sh
diff options
context:
space:
mode:
Diffstat (limited to 'flacdec/test-bitexact-decode.sh')
-rwxr-xr-xflacdec/test-bitexact-decode.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/flacdec/test-bitexact-decode.sh b/flacdec/test-bitexact-decode.sh
new file mode 100755
index 0000000..ce3fd6f
--- /dev/null
+++ b/flacdec/test-bitexact-decode.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# release compile
+mkdir -p bin
+cc -o bin/flacdec_r -Wall -Wextra -Wpedantic -O3 -g ./flacdec.c
+
+mkdir -p tmp
+
+for f in "$@"; do
+ #echo "decoding $f to bits1.raw"
+ ./bin/flacdec_r --dry --dump-samples=tmp/bits1.raw "$f" 2>/dev/null
+
+ #echo "decoding $f to bits2.raw with reference decoder"
+ flac -d -s -f --force-raw-format --endian=little --sign=signed -o tmp/bits2.raw "$f"
+
+ out=$(cmp tmp/bits1.raw tmp/bits2.raw 2>&1)
+ if [ $? -eq 0 ]; then
+ echo "PASS: $f"
+ continue
+ fi
+
+ echo "FAIL: $f"
+ echo "$out"
+done