switch metaflac test over to comparing output against "golden" files
authorJosh Coalson <jcoalson@users.sourceforce.net>
Mon, 28 Aug 2006 03:39:45 +0000 (03:39 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Mon, 28 Aug 2006 03:39:45 +0000 (03:39 +0000)
48 files changed:
test/metaflac-test-files/Makefile.am [new file with mode: 0644]
test/metaflac-test-files/case00-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case01-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case02-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case03-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case04-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case05-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case06-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case07-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case08-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case09-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case10-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case11-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case12-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case13-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case14-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case15-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case16-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case17-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case18-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case19-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case20-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case21-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case22-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case23-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case24-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case25-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case26-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case27-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case28-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case29-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case30-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case31-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case32-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case33-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case34-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case35-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case36-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case37-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case38-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case39-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case40-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case41-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case42-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case43-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case44-expect.meta [new file with mode: 0644]
test/metaflac-test-files/case45-expect.meta [new file with mode: 0644]
test/test_metaflac.sh

diff --git a/test/metaflac-test-files/Makefile.am b/test/metaflac-test-files/Makefile.am
new file mode 100644 (file)
index 0000000..f9ead22
--- /dev/null
@@ -0,0 +1,67 @@
+#  FLAC - Free Lossless Audio Codec
+#  Copyright (C) 2006  Josh Coalson
+#
+#  This file is part the FLAC project.  FLAC is comprised of several
+#  components distributed under difference licenses.  The codec libraries
+#  are distributed under Xiph.Org's BSD-like license (see the file
+#  COPYING.Xiph in this distribution).  All other programs, libraries, and
+#  plugins are distributed under the GPL (see COPYING.GPL).  The documentation
+#  is distributed under the Gnu FDL (see COPYING.FDL).  Each file in the
+#  FLAC distribution contains at the top the terms under which it may be
+#  distributed.
+#
+#  Since this particular file is relevant to all components of FLAC,
+#  it may be distributed under the Xiph.Org license, which is the least
+#  restrictive of those mentioned above.  See the file COPYING.Xiph in this
+#  distribution.
+
+EXTRA_DIST = \
+       case00-expect.meta \
+       case01-expect.meta \
+       case02-expect.meta \
+       case03-expect.meta \
+       case04-expect.meta \
+       case05-expect.meta \
+       case06-expect.meta \
+       case07-expect.meta \
+       case08-expect.meta \
+       case09-expect.meta \
+       case10-expect.meta \
+       case11-expect.meta \
+       case12-expect.meta \
+       case13-expect.meta \
+       case14-expect.meta \
+       case15-expect.meta \
+       case16-expect.meta \
+       case17-expect.meta \
+       case18-expect.meta \
+       case19-expect.meta \
+       case20-expect.meta \
+       case21-expect.meta \
+       case22-expect.meta \
+       case23-expect.meta \
+       case24-expect.meta \
+       case25-expect.meta \
+       case26-expect.meta \
+       case27-expect.meta \
+       case28-expect.meta \
+       case29-expect.meta \
+       case30-expect.meta \
+       case31-expect.meta \
+       case32-expect.meta \
+       case33-expect.meta \
+       case34-expect.meta \
+       case35-expect.meta \
+       case36-expect.meta \
+       case37-expect.meta \
+       case38-expect.meta \
+       case39-expect.meta \
+       case40-expect.meta \
+       case41-expect.meta \
+       case42-expect.meta \
+       case43-expect.meta \
+       case44-expect.meta \
+       case45-expect.meta
+
+CLEANFILES = \
+       $(wildcard out.*)
diff --git a/test/metaflac-test-files/case00-expect.meta b/test/metaflac-test-files/case00-expect.meta
new file mode 100644 (file)
index 0000000..e6d0599
--- /dev/null
@@ -0,0 +1,24 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 40
+  comments: 0
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 4096
diff --git a/test/metaflac-test-files/case01-expect.meta b/test/metaflac-test-files/case01-expect.meta
new file mode 100644 (file)
index 0000000..bae8f49
--- /dev/null
@@ -0,0 +1,9 @@
+a042237c5493fdb9656b94a83608d11a
+1152
+1152
+10
+10
+8000
+1
+8
+80000
diff --git a/test/metaflac-test-files/case02-expect.meta b/test/metaflac-test-files/case02-expect.meta
new file mode 100644 (file)
index 0000000..e10e95f
--- /dev/null
@@ -0,0 +1,28 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 40
+  comments: 0
+METADATA block #3
+  type: 1 (PADDING)
+  is last: false
+  length: 4096
+METADATA block #4
+  type: 1 (PADDING)
+  is last: true
+  length: 12345
diff --git a/test/metaflac-test-files/case03-expect.meta b/test/metaflac-test-files/case03-expect.meta
new file mode 100644 (file)
index 0000000..d1e1fca
--- /dev/null
@@ -0,0 +1,25 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 93
+  comments: 1
+    comment[0]: ARTIST=The_artist_formerly_known_as_the_artist...
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 16392
diff --git a/test/metaflac-test-files/case04-expect.meta b/test/metaflac-test-files/case04-expect.meta
new file mode 100644 (file)
index 0000000..8bf68cd
--- /dev/null
@@ -0,0 +1,26 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 117
+  comments: 2
+    comment[0]: ARTIST=The_artist_formerly_known_as_the_artist...
+    comment[1]: ARTIST=Chuck_Woolery
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 16368
diff --git a/test/metaflac-test-files/case05-expect.meta b/test/metaflac-test-files/case05-expect.meta
new file mode 100644 (file)
index 0000000..601519a
--- /dev/null
@@ -0,0 +1,27 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 132
+  comments: 3
+    comment[0]: ARTIST=The_artist_formerly_known_as_the_artist...
+    comment[1]: ARTIST=Chuck_Woolery
+    comment[2]: ARTIST=Vern
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 16353
diff --git a/test/metaflac-test-files/case06-expect.meta b/test/metaflac-test-files/case06-expect.meta
new file mode 100644 (file)
index 0000000..afeb503
--- /dev/null
@@ -0,0 +1,28 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 166
+  comments: 4
+    comment[0]: ARTIST=The_artist_formerly_known_as_the_artist...
+    comment[1]: ARTIST=Chuck_Woolery
+    comment[2]: ARTIST=Vern
+    comment[3]: TITLE=He_who_smelt_it_dealt_it
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 16319
diff --git a/test/metaflac-test-files/case07-expect.meta b/test/metaflac-test-files/case07-expect.meta
new file mode 100644 (file)
index 0000000..2e95303
--- /dev/null
@@ -0,0 +1,4 @@
+reference libFLAC 1.1.3 20060805
+ARTIST=The_artist_formerly_known_as_the_artist...
+ARTIST=Chuck_Woolery
+ARTIST=Vern
diff --git a/test/metaflac-test-files/case08-expect.meta b/test/metaflac-test-files/case08-expect.meta
new file mode 100644 (file)
index 0000000..3cc35e4
--- /dev/null
@@ -0,0 +1,27 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 113
+  comments: 3
+    comment[0]: ARTIST=Chuck_Woolery
+    comment[1]: ARTIST=Vern
+    comment[2]: TITLE=He_who_smelt_it_dealt_it
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 16372
diff --git a/test/metaflac-test-files/case09-expect.meta b/test/metaflac-test-files/case09-expect.meta
new file mode 100644 (file)
index 0000000..1277bb9
--- /dev/null
@@ -0,0 +1,25 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 74
+  comments: 1
+    comment[0]: TITLE=He_who_smelt_it_dealt_it
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 16411
diff --git a/test/metaflac-test-files/case10-expect.meta b/test/metaflac-test-files/case10-expect.meta
new file mode 100644 (file)
index 0000000..c5986ab
--- /dev/null
@@ -0,0 +1,6 @@
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 74
+  comments: 1
+    comment[0]: TITLE=He_who_smelt_it_dealt_it
diff --git a/test/metaflac-test-files/case11-expect.meta b/test/metaflac-test-files/case11-expect.meta
new file mode 100644 (file)
index 0000000..f42d320
--- /dev/null
@@ -0,0 +1,9 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
diff --git a/test/metaflac-test-files/case12-expect.meta b/test/metaflac-test-files/case12-expect.meta
new file mode 100644 (file)
index 0000000..19ed454
--- /dev/null
@@ -0,0 +1,12 @@
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 74
+  comments: 1
+    comment[0]: TITLE=He_who_smelt_it_dealt_it
diff --git a/test/metaflac-test-files/case13-expect.meta b/test/metaflac-test-files/case13-expect.meta
new file mode 100644 (file)
index 0000000..adcd086
--- /dev/null
@@ -0,0 +1,10 @@
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 74
+  comments: 1
+    comment[0]: TITLE=He_who_smelt_it_dealt_it
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 16411
diff --git a/test/metaflac-test-files/case14-expect.meta b/test/metaflac-test-files/case14-expect.meta
new file mode 100644 (file)
index 0000000..03d93f2
--- /dev/null
@@ -0,0 +1,13 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 16411
diff --git a/test/metaflac-test-files/case15-expect.meta b/test/metaflac-test-files/case15-expect.meta
new file mode 100644 (file)
index 0000000..e5a1154
--- /dev/null
@@ -0,0 +1,16 @@
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 74
+  comments: 1
+    comment[0]: TITLE=He_who_smelt_it_dealt_it
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 16411
diff --git a/test/metaflac-test-files/case16-expect.meta b/test/metaflac-test-files/case16-expect.meta
new file mode 100644 (file)
index 0000000..b6b33f0
--- /dev/null
@@ -0,0 +1,33 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 74
+  comments: 1
+    comment[0]: TITLE=He_who_smelt_it_dealt_it
+METADATA block #3
+  type: 1 (PADDING)
+  is last: false
+  length: 16411
+METADATA block #4
+  type: 1 (PADDING)
+  is last: false
+  length: 4321
+METADATA block #5
+  type: 1 (PADDING)
+  is last: true
+  length: 4321
diff --git a/test/metaflac-test-files/case17-expect.meta b/test/metaflac-test-files/case17-expect.meta
new file mode 100644 (file)
index 0000000..0a53fc8
--- /dev/null
@@ -0,0 +1,25 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 74
+  comments: 1
+    comment[0]: TITLE=He_who_smelt_it_dealt_it
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 25061
diff --git a/test/metaflac-test-files/case18-expect.meta b/test/metaflac-test-files/case18-expect.meta
new file mode 100644 (file)
index 0000000..e6f064a
--- /dev/null
@@ -0,0 +1,29 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 74
+  comments: 1
+    comment[0]: TITLE=He_who_smelt_it_dealt_it
+METADATA block #3
+  type: 1 (PADDING)
+  is last: false
+  length: 25061
+METADATA block #4
+  type: 1 (PADDING)
+  is last: true
+  length: 0
diff --git a/test/metaflac-test-files/case19-expect.meta b/test/metaflac-test-files/case19-expect.meta
new file mode 100644 (file)
index 0000000..059e3ef
--- /dev/null
@@ -0,0 +1,25 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 74
+  comments: 1
+    comment[0]: TITLE=He_who_smelt_it_dealt_it
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 25065
diff --git a/test/metaflac-test-files/case20-expect.meta b/test/metaflac-test-files/case20-expect.meta
new file mode 100644 (file)
index 0000000..c76e728
--- /dev/null
@@ -0,0 +1,29 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 74
+  comments: 1
+    comment[0]: TITLE=He_who_smelt_it_dealt_it
+METADATA block #3
+  type: 1 (PADDING)
+  is last: false
+  length: 25065
+METADATA block #4
+  type: 1 (PADDING)
+  is last: true
+  length: 0
diff --git a/test/metaflac-test-files/case21-expect.meta b/test/metaflac-test-files/case21-expect.meta
new file mode 100644 (file)
index 0000000..97fe0ac
--- /dev/null
@@ -0,0 +1,24 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 40
+  comments: 0
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 25103
diff --git a/test/metaflac-test-files/case22-expect.meta b/test/metaflac-test-files/case22-expect.meta
new file mode 100644 (file)
index 0000000..64ec68d
--- /dev/null
@@ -0,0 +1,18 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 40
+  comments: 0
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 25103
diff --git a/test/metaflac-test-files/case23-expect.meta b/test/metaflac-test-files/case23-expect.meta
new file mode 100644 (file)
index 0000000..64ec68d
--- /dev/null
@@ -0,0 +1,18 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 40
+  comments: 0
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 25103
diff --git a/test/metaflac-test-files/case24-expect.meta b/test/metaflac-test-files/case24-expect.meta
new file mode 100644 (file)
index 0000000..64ec68d
--- /dev/null
@@ -0,0 +1,18 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 40
+  comments: 0
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 25103
diff --git a/test/metaflac-test-files/case25-expect.meta b/test/metaflac-test-files/case25-expect.meta
new file mode 100644 (file)
index 0000000..8986a70
--- /dev/null
@@ -0,0 +1,14 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: true
+  length: 40
+  comments: 0
diff --git a/test/metaflac-test-files/case26-expect.meta b/test/metaflac-test-files/case26-expect.meta
new file mode 100644 (file)
index 0000000..eaf6c27
--- /dev/null
@@ -0,0 +1,22 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 40
+  comments: 0
+METADATA block #2
+  type: 1 (PADDING)
+  is last: false
+  length: 0
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 0
diff --git a/test/metaflac-test-files/case27-expect.meta b/test/metaflac-test-files/case27-expect.meta
new file mode 100644 (file)
index 0000000..eac969c
--- /dev/null
@@ -0,0 +1,13 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 1 (PADDING)
+  is last: true
+  length: 48
diff --git a/test/metaflac-test-files/case28-expect.meta b/test/metaflac-test-files/case28-expect.meta
new file mode 100644 (file)
index 0000000..eac969c
--- /dev/null
@@ -0,0 +1,13 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 1 (PADDING)
+  is last: true
+  length: 48
diff --git a/test/metaflac-test-files/case29-expect.meta b/test/metaflac-test-files/case29-expect.meta
new file mode 100644 (file)
index 0000000..cd0ad27
--- /dev/null
@@ -0,0 +1,9 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: true
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
diff --git a/test/metaflac-test-files/case30-expect.meta b/test/metaflac-test-files/case30-expect.meta
new file mode 100644 (file)
index 0000000..cd0ad27
--- /dev/null
@@ -0,0 +1,9 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: true
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
diff --git a/test/metaflac-test-files/case31-expect.meta b/test/metaflac-test-files/case31-expect.meta
new file mode 100644 (file)
index 0000000..a8fb438
--- /dev/null
@@ -0,0 +1,15 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: true
+  length: 66
+  comments: 1
+    comment[0]: f=0123456789abcdefghij
diff --git a/test/metaflac-test-files/case32-expect.meta b/test/metaflac-test-files/case32-expect.meta
new file mode 100644 (file)
index 0000000..9d1a184
--- /dev/null
@@ -0,0 +1,15 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: true
+  length: 65
+  comments: 1
+    comment[0]: f=0123456789abcdefghi
diff --git a/test/metaflac-test-files/case33-expect.meta b/test/metaflac-test-files/case33-expect.meta
new file mode 100644 (file)
index 0000000..0c883c3
--- /dev/null
@@ -0,0 +1,19 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 61
+  comments: 1
+    comment[0]: f=0123456789abcde
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 0
diff --git a/test/metaflac-test-files/case34-expect.meta b/test/metaflac-test-files/case34-expect.meta
new file mode 100644 (file)
index 0000000..b59ccb8
--- /dev/null
@@ -0,0 +1,19 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 47
+  comments: 1
+    comment[0]: f=0
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 14
diff --git a/test/metaflac-test-files/case35-expect.meta b/test/metaflac-test-files/case35-expect.meta
new file mode 100644 (file)
index 0000000..7f48452
--- /dev/null
@@ -0,0 +1,19 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 56
+  comments: 1
+    comment[0]: f=0123456789
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 5
diff --git a/test/metaflac-test-files/case36-expect.meta b/test/metaflac-test-files/case36-expect.meta
new file mode 100644 (file)
index 0000000..9d1a184
--- /dev/null
@@ -0,0 +1,15 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: true
+  length: 65
+  comments: 1
+    comment[0]: f=0123456789abcdefghi
diff --git a/test/metaflac-test-files/case37-expect.meta b/test/metaflac-test-files/case37-expect.meta
new file mode 100644 (file)
index 0000000..7f48452
--- /dev/null
@@ -0,0 +1,19 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 56
+  comments: 1
+    comment[0]: f=0123456789
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 5
diff --git a/test/metaflac-test-files/case38-expect.meta b/test/metaflac-test-files/case38-expect.meta
new file mode 100644 (file)
index 0000000..93d1e32
--- /dev/null
@@ -0,0 +1,19 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 66
+  comments: 1
+    comment[0]: f=0123456789abcdefghij
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 5
diff --git a/test/metaflac-test-files/case39-expect.meta b/test/metaflac-test-files/case39-expect.meta
new file mode 100644 (file)
index 0000000..700caff
--- /dev/null
@@ -0,0 +1,20 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 82
+  comments: 2
+    comment[0]: f=0123456789abcdefghij
+    comment[1]: TITLE=Tittle
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 5
diff --git a/test/metaflac-test-files/case40-expect.meta b/test/metaflac-test-files/case40-expect.meta
new file mode 100644 (file)
index 0000000..125eedc
--- /dev/null
@@ -0,0 +1,22 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 117
+  comments: 4
+    comment[0]: f=0123456789abcdefghij
+    comment[1]: TITLE=Tittle
+    comment[2]: artist=Fartist
+    comment[3]: artist=artits
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 5
diff --git a/test/metaflac-test-files/case41-expect.meta b/test/metaflac-test-files/case41-expect.meta
new file mode 100644 (file)
index 0000000..3e2fcf0
--- /dev/null
@@ -0,0 +1,26 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 259
+  comments: 8
+    comment[0]: f=0123456789abcdefghij
+    comment[1]: TITLE=Tittle
+    comment[2]: artist=Fartist
+    comment[3]: artist=artits
+    comment[4]: REPLAYGAIN_TRACK_PEAK=0.00000000
+    comment[5]: REPLAYGAIN_TRACK_GAIN=+64.82 dB
+    comment[6]: REPLAYGAIN_ALBUM_PEAK=0.00000000
+    comment[7]: REPLAYGAIN_ALBUM_GAIN=+64.82 dB
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 5
diff --git a/test/metaflac-test-files/case42-expect.meta b/test/metaflac-test-files/case42-expect.meta
new file mode 100644 (file)
index 0000000..bdc02ea
--- /dev/null
@@ -0,0 +1,22 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 117
+  comments: 4
+    comment[0]: f=0123456789abcdefghij
+    comment[1]: TITLE=Tittle
+    comment[2]: artist=Fartist
+    comment[3]: artist=artits
+METADATA block #2
+  type: 1 (PADDING)
+  is last: true
+  length: 147
diff --git a/test/metaflac-test-files/case43-expect.meta b/test/metaflac-test-files/case43-expect.meta
new file mode 100644 (file)
index 0000000..7e2957d
--- /dev/null
@@ -0,0 +1,49 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 117
+  comments: 4
+    comment[0]: f=0123456789abcdefghij
+    comment[1]: TITLE=Tittle
+    comment[2]: artist=Fartist
+    comment[3]: artist=artits
+METADATA block #3
+  type: 5 (CUESHEET)
+  is last: false
+  length: 480
+  media catalog number: 1234567890123
+  lead-in: 0
+  is CD: false
+  number of tracks: 2
+    track[0]
+      offset: 0
+      number: 1
+      ISRC: 
+      type: AUDIO
+      pre-emphasis: false
+      number of index points: 1
+        index[0]
+          offset: 0
+          number: 1
+    track[1]
+      offset: 80000
+      number: 1 (LEAD-OUT)
+METADATA block #4
+  type: 1 (PADDING)
+  is last: true
+  length: 147
diff --git a/test/metaflac-test-files/case44-expect.meta b/test/metaflac-test-files/case44-expect.meta
new file mode 100644 (file)
index 0000000..49ca8e5
--- /dev/null
@@ -0,0 +1,28 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 117
+  comments: 4
+    comment[0]: f=0123456789abcdefghij
+    comment[1]: TITLE=Tittle
+    comment[2]: artist=Fartist
+    comment[3]: artist=artits
+METADATA block #3
+  type: 1 (PADDING)
+  is last: true
+  length: 631
diff --git a/test/metaflac-test-files/case45-expect.meta b/test/metaflac-test-files/case45-expect.meta
new file mode 100644 (file)
index 0000000..7e2957d
--- /dev/null
@@ -0,0 +1,49 @@
+METADATA block #0
+  type: 0 (STREAMINFO)
+  is last: false
+  length: 34
+  sample_rate: 8000 Hz
+  channels: 1
+  bits-per-sample: 8
+  total samples: 80000
+  MD5 signature: a042237c5493fdb9656b94a83608d11a
+METADATA block #1
+  type: 3 (SEEKTABLE)
+  is last: false
+  length: 18
+  seek points: 1
+    point 0: sample_number=0
+METADATA block #2
+  type: 4 (VORBIS_COMMENT)
+  is last: false
+  length: 117
+  comments: 4
+    comment[0]: f=0123456789abcdefghij
+    comment[1]: TITLE=Tittle
+    comment[2]: artist=Fartist
+    comment[3]: artist=artits
+METADATA block #3
+  type: 5 (CUESHEET)
+  is last: false
+  length: 480
+  media catalog number: 1234567890123
+  lead-in: 0
+  is CD: false
+  number of tracks: 2
+    track[0]
+      offset: 0
+      number: 1
+      ISRC: 
+      type: AUDIO
+      pre-emphasis: false
+      number of index points: 1
+        index[0]
+          offset: 0
+          number: 1
+    track[1]
+      offset: 80000
+      number: 1 (LEAD-OUT)
+METADATA block #4
+  type: 1 (PADDING)
+  is last: true
+  length: 147
index 1022ef3..13860f3 100755 (executable)
@@ -23,26 +23,36 @@ die ()
        exit 1
 }
 
-if [ x = x"$1" ] ; then 
+if [ x = x"$1" ] ; then
        BUILD=debug
 else
        BUILD="$1"
 fi
 
-LD_LIBRARY_PATH=../src/libFLAC/.libs:$LD_LIBRARY_PATH
-LD_LIBRARY_PATH=../src/libOggFLAC/.libs:$LD_LIBRARY_PATH
-LD_LIBRARY_PATH=../src/share/grabbag/.libs:$LD_LIBRARY_PATH
-LD_LIBRARY_PATH=../src/share/getopt/.libs:$LD_LIBRARY_PATH
-LD_LIBRARY_PATH=../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH
-LD_LIBRARY_PATH=../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH
-LD_LIBRARY_PATH=../src/share/utf8/.libs:$LD_LIBRARY_PATH
-LD_LIBRARY_PATH=../obj/$BUILD/lib:$LD_LIBRARY_PATH
+# change to 'false' to show all flac/metaflac output (useful for debugging)
+if true ; then
+       SILENT='--silent'
+       TOTALLY_SILENT='--totally-silent'
+else
+       SILENT=''
+       TOTALLY_SILENT=''
+fi
+
+LD_LIBRARY_PATH=`pwd`/../src/libFLAC/.libs:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=`pwd`/../src/libOggFLAC/.libs:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=`pwd`/../src/share/grabbag/.libs:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=`pwd`/../src/share/getopt/.libs:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=`pwd`/../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=`pwd`/../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=`pwd`/../src/share/utf8/.libs:$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=`pwd`/../obj/$BUILD/lib:$LD_LIBRARY_PATH
 export LD_LIBRARY_PATH
-PATH=../src/flac:$PATH
-PATH=../src/metaflac:$PATH
-PATH=../obj/$BUILD/bin:$PATH
+PATH=`pwd`/../src/flac:$PATH
+PATH=`pwd`/../src/metaflac:$PATH
+PATH=`pwd`/../obj/$BUILD/bin:$PATH
 
-flacfile=metaflac.flac
+testdir="metaflac-test-files"
+flacfile="metaflac.flac"
 
 flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
 metaflac --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac executable"
@@ -65,276 +75,240 @@ run_metaflac ()
        fi
 }
 
+run_metaflac_silent ()
+{
+       if [ -z "$SILENT" ] ; then
+               run_metaflac $*
+       else
+               if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then
+                       valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 metaflac $* 2>/dev/null 4>>test_metaflac.valgrind.log
+               else
+                       metaflac $* 2>/dev/null
+               fi
+       fi
+}
+
+check_flac ()
+{
+       run_flac --silent --test $flacfile || die "ERROR in $flacfile" 1>&2
+}
+
 echo "Generating stream..."
-if [ -f /bin/sh.exe ] ; then
-       inputfile=/bin/sh.exe
-elif [ -f /bin/sh ] ; then
-       inputfile=/bin/sh
-else
-       inputfile="$0"
-fi
-if run_flac --force --verify -0 --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=44100 $inputfile ; then
+bytes=80000
+if dd if=/dev/zero ibs=1 count=$bytes | flac --force --verify -0 --input-size=$bytes --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=8000 - ; then
        chmod +w $flacfile
 else
        die "ERROR during generation"
 fi
 
-check_exit ()
+check_flac
+
+echo
+
+filter ()
 {
-       exit_code=$?
-       [ $exit_code = 0 ] || die "ERROR, exit code = $exit_code"
+       # minor danger, changing vendor strings will change the length of the
+       # VORBIS_COMMENT block, but if we add "^  length: " to the patterns,
+       # we lose info about PADDING size that we need
+       grep -Ev '^  vendor string: |^  m..imum .....size: ' | sed -e 's/, stream_offset.*//'
 }
-
-check_flac ()
+metaflac_test ()
 {
-       run_flac --silent --test $flacfile || die "ERROR in $flacfile" 1>&2
+       case="$1"
+       desc="$2"
+       args="$3"
+       expect="$testdir/$case-expect.meta"
+       echo -n "test $case: $desc... "
+       run_metaflac $args $flacfile | filter > $testdir/out.meta || die "ERROR running metaflac"
+       diff -q -w $expect $testdir/out.meta 2>/dev/null || die "ERROR: metadata does not match expected $expect"
+       echo OK
 }
 
-check_flac
-
-(set -x && run_metaflac --list $flacfile)
-check_exit
+metaflac_test case00 "--list" "--list"
 
-(set -x &&
-run_metaflac \
-       --show-md5sum \
-       --show-min-blocksize \
-       --show-max-blocksize \
-       --show-min-framesize \
-       --show-max-framesize \
-       --show-sample-rate \
-       --show-channels \
-       --show-bps \
-       --show-total-samples \
-       $flacfile
-)
-check_exit
+metaflac_test case01 "STREAMINFO --show-* shortcuts" "
+       --show-md5sum
+       --show-min-blocksize
+       --show-max-blocksize
+       --show-min-framesize
+       --show-max-framesize
+       --show-sample-rate
+       --show-channels
+       --show-bps
+       --show-total-samples"
 
-(set -x && run_metaflac --preserve-modtime --add-padding=12345 $flacfile)
-check_exit
+run_metaflac --preserve-modtime --add-padding=12345 $flacfile
 check_flac
+metaflac_test case02 "--add-padding" "--list"
 
 # some flavors of /bin/sh (e.g. Darwin's) won't even handle quoted spaces, so we underscore:
-(set -x && run_metaflac --set-tag="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile)
-check_exit
+run_metaflac --set-tag="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile
 check_flac
+metaflac_test case03 "--set-tag=ARTIST" "--list"
 
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
-check_exit
-
-(set -x && run_metaflac --set-tag="ARTIST=Chuck_Woolery" $flacfile)
-check_exit
+run_metaflac --set-tag="ARTIST=Chuck_Woolery" $flacfile
 check_flac
+metaflac_test case04 "--set-tag=ARTIST" "--list"
 
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
-check_exit
-
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
-check_exit
-
-(set -x && run_metaflac --set-tag="ARTIST=Vern" $flacfile)
-check_exit
+run_metaflac --set-tag="ARTIST=Vern" $flacfile
 check_flac
+metaflac_test case05 "--set-tag=ARTIST" "--list"
 
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
-check_exit
-
-(set -x && run_metaflac --set-tag="TITLE=He_who_smelt_it_dealt_it" $flacfile)
-check_exit
+run_metaflac --set-tag="TITLE=He_who_smelt_it_dealt_it" $flacfile
 check_flac
+metaflac_test case06 "--set-tag=TITLE" "--list"
 
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
-check_exit
+metaflac_test case07 "--show-vendor-tag --show-tag=ARTIST" "--show-vendor-tag --show-tag=ARTIST"
 
-(set -x && run_metaflac --show-vendor-tag --show-tag=ARTIST $flacfile)
-check_exit
-
-(set -x && run_metaflac --remove-first-tag=ARTIST $flacfile)
-check_exit
+run_metaflac --remove-first-tag=ARTIST $flacfile
 check_flac
+metaflac_test case08 "--remove-first-tag=ARTIST" "--list"
 
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
-check_exit
-
-(set -x && run_metaflac --remove-tag=ARTIST $flacfile)
-check_exit
+run_metaflac --remove-tag=ARTIST $flacfile
 check_flac
+metaflac_test case09 "--remove-tag=ARTIST" "--list"
 
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
-check_exit
-
-(set -x && run_metaflac --list --block-number=0 $flacfile)
-check_exit
-
-(set -x && run_metaflac --list --block-number=1,2,999 $flacfile)
-check_exit
-
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT,PADDING $flacfile)
-check_exit
+metaflac_test case10 "--list --block-type=VORBIS_COMMENT" "--list --block-type=VORBIS_COMMENT"
+metaflac_test case11 "--list --block-number=0" "--list --block-number=0"
+metaflac_test case12 "--list --block-number=1,2,999" "--list --block-number=1,2,999"
+metaflac_test case13 "--list --block-type=VORBIS_COMMENT,PADDING" "--list --block-type=VORBIS_COMMENT,PADDING"
+metaflac_test case14 "--list --except-block-type=SEEKTABLE,VORBIS_COMMENT" "--list --except-block-type=SEEKTABLE,VORBIS_COMMENT"
+metaflac_test case15 "--list --except-block-type=STREAMINFO" "--list --except-block-type=STREAMINFO"
 
-(set -x && run_metaflac --list --except-block-type=SEEKTABLE,VORBIS_COMMENT $flacfile)
-check_exit
-
-(set -x && run_metaflac --add-padding=4321 $flacfile $flacfile)
-check_exit
+run_metaflac --add-padding=4321 $flacfile $flacfile
 check_flac
+metaflac_test case16 "--add-padding=4321 * 2" "--list"
 
-(set -x && run_metaflac --merge-padding $flacfile)
-check_exit
+run_metaflac --merge-padding $flacfile
 check_flac
+metaflac_test case17 "--merge-padding" "--list"
 
-(set -x && run_metaflac --add-padding=0 $flacfile)
-check_exit
+run_metaflac --add-padding=0 $flacfile
 check_flac
+metaflac_test case18 "--add-padding=0" "--list"
 
-(set -x && run_metaflac --sort-padding $flacfile)
-check_exit
+run_metaflac --sort-padding $flacfile
 check_flac
+metaflac_test case19 "--sort-padding" "--list"
 
-(set -x && run_metaflac --add-padding=0 $flacfile)
-check_exit
+run_metaflac --add-padding=0 $flacfile
 check_flac
+metaflac_test case20 "--add-padding=0" "--list"
 
-(set -x && run_metaflac --remove-all-tags $flacfile)
-check_exit
+run_metaflac --remove-all-tags $flacfile
 check_flac
+metaflac_test case21 "--remove-all-tags" "--list"
 
-(set -x && run_metaflac --remove --block-number=1,99 --dont-use-padding $flacfile)
-check_exit
+run_metaflac --remove --block-number=1,99 --dont-use-padding $flacfile
 check_flac
+metaflac_test case22 "--remove --block-number=1,99 --dont-use-padding" "--list"
 
-(set -x && run_metaflac --remove --block-number=99 --dont-use-padding $flacfile)
-check_exit
+run_metaflac --remove --block-number=99 --dont-use-padding $flacfile
 check_flac
+metaflac_test case23 "--remove --block-number=99 --dont-use-padding" "--list"
 
-(set -x && run_metaflac --remove --block-type=PADDING $flacfile)
-check_exit
+run_metaflac --remove --block-type=PADDING $flacfile
 check_flac
+metaflac_test case24 "--remove --block-type=PADDING" "--list"
 
-(set -x && run_metaflac --remove --block-type=PADDING --dont-use-padding $flacfile)
-check_exit
+run_metaflac --remove --block-type=PADDING --dont-use-padding $flacfile
 check_flac
+metaflac_test case25 "--remove --block-type=PADDING --dont-use-padding" "--list"
 
-(set -x && run_metaflac --add-padding=0 $flacfile $flacfile)
-check_exit
+run_metaflac --add-padding=0 $flacfile $flacfile
 check_flac
+metaflac_test case26 "--add-padding=0 * 2" "--list"
 
-(set -x && run_metaflac --remove --except-block-type=PADDING $flacfile)
-check_exit
+run_metaflac --remove --except-block-type=PADDING $flacfile
 check_flac
+metaflac_test case27 "--remove --except-block-type=PADDING" "--list"
 
-(set -x && run_metaflac --remove-all $flacfile)
-check_exit
+run_metaflac --remove-all $flacfile
 check_flac
+metaflac_test case28 "--remove-all" "--list"
 
-(set -x && run_metaflac --remove-all --dont-use-padding $flacfile)
-check_exit
+run_metaflac --remove-all --dont-use-padding $flacfile
 check_flac
+metaflac_test case29 "--remove-all --dont-use-padding" "--list"
 
-(set -x && run_metaflac --remove-all --dont-use-padding $flacfile)
-check_exit
+run_metaflac --remove-all --dont-use-padding $flacfile
 check_flac
+metaflac_test case30 "--remove-all --dont-use-padding" "--list"
 
-(set -x && run_metaflac --set-tag="f=0123456789abcdefghij" $flacfile)
-check_exit
+run_metaflac --set-tag="f=0123456789abcdefghij" $flacfile
 check_flac
-(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
-check_exit
+metaflac_test case31 "--set-tag=..." "--list"
 
-(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile)
-check_exit
+run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile
 check_flac
-(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
-check_exit
+metaflac_test case32 "--remove-all-tags --set-tag=..." "--list"
 
-(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcde" $flacfile)
-check_exit
+run_metaflac --remove-all-tags --set-tag="f=0123456789abcde" $flacfile
 check_flac
-(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
-check_exit
+metaflac_test case33 "--remove-all-tags --set-tag=..." "--list"
 
-(set -x && run_metaflac --remove-all-tags --set-tag="f=0" $flacfile)
-check_exit
+run_metaflac --remove-all-tags --set-tag="f=0" $flacfile
 check_flac
-(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
-check_exit
+metaflac_test case34 "--remove-all-tags --set-tag=..." "--list"
 
-(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile)
-check_exit
+run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile
 check_flac
-(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
-check_exit
+metaflac_test case35 "--remove-all-tags --set-tag=..." "--list"
 
-(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile)
-check_exit
+run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile
 check_flac
-(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
-check_exit
+metaflac_test case36 "--remove-all-tags --set-tag=..." "--list"
 
-(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile)
-check_exit
+run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile
 check_flac
-(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
-check_exit
+metaflac_test case37 "--remove-all-tags --set-tag=..." "--list"
 
-(set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghij" $flacfile)
-check_exit
+run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghij" $flacfile
 check_flac
-(set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
-check_exit
+metaflac_test case38 "--remove-all-tags --set-tag=..." "--list"
 
-(set -x && echo "TITLE=Tittle" | run_metaflac --import-tags-from=- $flacfile)
-check_exit
+echo "TITLE=Tittle" | run_metaflac --import-tags-from=- $flacfile
 check_flac
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
-check_exit
+metaflac_test case39 "--import-tags-from=-" "--list"
 
 cat > vc.txt << EOF
 artist=Fartist
 artist=artits
 EOF
-(set -x && run_metaflac --import-tags-from=vc.txt $flacfile)
-check_exit
+run_metaflac --import-tags-from=vc.txt $flacfile
 check_flac
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
-check_exit
+metaflac_test case40 "--import-tags-from=[FILE]" "--list"
 
 rm vc.txt
 
+run_metaflac --add-replay-gain $flacfile
+check_flac
+metaflac_test case41 "--add-replay-gain" "--list"
+
+run_metaflac --remove-replay-gain $flacfile
+check_flac
+metaflac_test case42 "--remove-replay-gain" "--list"
+
 cs_in=cuesheets/good.000.cue
 cs_out=metaflac.cue
 cs_out2=metaflac2.cue
-(set -x && run_metaflac --import-cuesheet-from="$cs_in" $flacfile)
-check_exit
+run_metaflac --import-cuesheet-from="$cs_in" $flacfile
 check_flac
-(set -x && run_metaflac --export-cuesheet-to=$cs_out $flacfile)
-check_exit
-(set -x && run_metaflac --remove --block-type=CUESHEET $flacfile)
-check_exit
+metaflac_test case43 "--import-cuesheet-from" "--list"
+run_metaflac --export-cuesheet-to=$cs_out $flacfile
+run_metaflac --remove --block-type=CUESHEET $flacfile
 check_flac
-(set -x && run_metaflac --import-cuesheet-from=$cs_out $flacfile)
-check_exit
+metaflac_test case44 "--remove --block-type=CUESHEET" "--list"
+run_metaflac --import-cuesheet-from=$cs_out $flacfile
 check_flac
-(set -x && run_metaflac --export-cuesheet-to=$cs_out2 $flacfile)
-check_exit
+metaflac_test case45 "--import-cuesheet-from" "--list"
+run_metaflac --export-cuesheet-to=$cs_out2 $flacfile
 echo "comparing cuesheets:"
 diff $cs_out $cs_out2 || die "ERROR, cuesheets should be identical"
 echo identical
 
 rm -f $cs_out $cs_out2
 
-(set -x && run_metaflac --add-replay-gain $flacfile)
-check_exit
-check_flac
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
-check_exit
-
-(set -x && run_metaflac --remove-replay-gain $flacfile)
-check_exit
-check_flac
-(set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
-check_exit
-
 echo -n "Testing FLAC file with unknown metadata... "
 cp -p metaflac.flac.in $flacfile
 # remove the VORBIS_COMMENT block so vendor string changes don't interfere with the comparison:
@@ -342,4 +316,6 @@ run_metaflac --remove --block-type=VORBIS_COMMENT --dont-use-padding $flacfile
 cmp $flacfile metaflac.flac.ok || die "ERROR, $flacfile and metaflac.flac.ok differ"
 echo OK
 
+rm -f out.flac out.meta
+
 exit 0