-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mp3chop is so old that it didn't have very good tests. In the absence of exhaustive tests, let's add a few approval tests. The expected output files were generated using an older version of mp3chop and can be used to show that the behaviour hasn't changed. When we pass the mp3chop executable to our test script it is not passed as a full path (see mesonbuild/meson#2681 ) and the current directory won't be in our path so we need to take special action to ensure that we can run it.
- Loading branch information
Showing
14 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
approval_tests_script = find_program('run') | ||
test('approval-tests', approval_tests_script, | ||
args: [ meson.current_source_dir(), meson.current_build_dir(), mp3chop_exe ]) |
Binary file not shown.
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
src="$1" | ||
tmp="$2" | ||
exe="$3" | ||
|
||
# Meson will pass a relative path. We must convert it to an absolute | ||
# path before we change directory. | ||
mp3chop=$(realpath ${exe}) | ||
|
||
[ -z "${src}" ] || cd "${src}" | ||
[ -n "${tmp}" ] || tmp=tmp | ||
[ -n "${mp3chop}" ] || mp3chop=mp3chop | ||
|
||
pass=0 | ||
count=0 | ||
check() { | ||
name="$1" | ||
input="$2" | ||
expected="${name}.expected" | ||
shift | ||
shift | ||
count=$((${count}+1)) | ||
echo "TEST ${name} using ${mp3chop}" 1>&2 | ||
${mp3chop} "$@" < "${input}" > "${tmp}/${name}.out" | ||
if cmp "${expected}" "${tmp}/${name}.out"; then | ||
echo "PASS" 1>&2 | ||
rm "${tmp}/${name}.out" | ||
pass=$((${pass}+1)) | ||
else | ||
echo "FAIL" 1>&2 | ||
fi | ||
echo 1>&2 | ||
} | ||
|
||
check pass-through cbr-jstereo-32-48000.mp3 | ||
|
||
check strip-id3v1 cbr-jstereo-32-48000.mp3 --strip-id3=1 | ||
check strip-id3v2 cbr-jstereo-32-48000.mp3 --strip-id3=2 | ||
check strip-id3 cbr-jstereo-32-48000.mp3 --strip-id3=1 --strip-id3=2 | ||
|
||
dd if=/dev/zero of=${tmp}/1Mzero bs=1024 count=1024 | ||
check no-frames ${tmp}/1Mzero | ||
|
||
cat ${tmp}/1Mzero cbr-jstereo-32-48000.mp3 > ${tmp}/leading-zeros.mp3 | ||
cat cbr-jstereo-32-48000.mp3 ${tmp}/1Mzero > ${tmp}/trailing-zeros.mp3 | ||
|
||
check leading-zeros ${tmp}/leading-zeros.mp3 | ||
check trailing-zeros ${tmp}/trailing-zeros.mp3 | ||
|
||
check beginning cbr-jstereo-32-48000.mp3 --end=20:0.0 | ||
check end cbr-jstereo-32-48000.mp3 --begin=10:0.0 | ||
check middle cbr-jstereo-32-48000.mp3 --begin=5:0.0 --end=25:0.0 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters