cdrdo TOC parsing regression tests.

testdefault.c: more verbose about what's going on.
This commit is contained in:
rocky
2004-05-07 10:57:50 +00:00
parent d31f2f4489
commit e286bafd95
16 changed files with 233 additions and 13 deletions

View File

@@ -8,9 +8,10 @@ check_iso.sh
check_nrg.sh
check_sizeof
testassert
testdefault
testischar
testiso9660
testdefault
testtoc
*.dump
*.cue
*.bin

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.20 2004/05/04 11:47:53 rocky Exp $
# $Id: Makefile.am,v 1.21 2004/05/07 10:57:50 rocky Exp $
#
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
#
@@ -23,16 +23,17 @@
#
# There's a problem with doing make distcheck for testdefault.
# A reminder of why I hate automake.
hack = testassert testischar testiso9660 check_sizeof
hack = check_sizeof testassert testischar testiso9660 testtoc
noinst_PROGRAMS = $(hack) testdefault
INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS)
check_sizeof_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
testassert_LDADD = $(LIBCDIO_LIBS)
testdefault_LDADD = $(LIBCDIO_LIBS)
testischar_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
testiso9660_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
check_sizeof_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
testtoc_LDADD = $(LIBCDIO_LIBS)
check_SCRIPTS = check_nrg.sh check_cue.sh check_cd_read.sh \
check_iso.sh check_opts.sh
@@ -47,6 +48,8 @@ check_DATA = vcd_demo.right \
check_opts3.right check_opts4.right check_opts5.right \
check_opts6.right check_opts7.right \
isofs-m1-read.right cdda-read.right \
t1.toc t2.toc t3.toc t4.toc t5.toc t6.toc t7.toc t8.toc t9.toc \
bad-mode1.toc bad-msf-1.toc bad-msf-2.toc \
copying.iso copying.right
EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \

5
test/bad-mode1.toc Normal file
View File

@@ -0,0 +1,5 @@
// $Id: bad-mode1.toc,v 1.1 2004/05/07 10:57:50 rocky Exp $
CD_DA
TRACK MODE1_FORM45 // "MODE1_FORM45" is not a valid mode.
SILENCE 10:0:0

6
test/bad-msf-1.toc Normal file
View File

@@ -0,0 +1,6 @@
// $Id: bad-msf-1.toc,v 1.1 2004/05/07 10:57:50 rocky Exp $
// bad MSF in second field
TRACK AUDIO
NO COPY // so that all CTL flags are 0
FILE "cdda.bin" 0:0:75 // frame should be less than 75

6
test/bad-msf-2.toc Normal file
View File

@@ -0,0 +1,6 @@
// $Id: bad-msf-2.toc,v 1.1 2004/05/07 10:57:50 rocky Exp $
// bad MSF in second field
TRACK AUDIO
NO COPY // so that all CTL flags are 0
FILE "cdda.bin" 0:60:0 // seconds should be less than 60

5
test/t1.toc Normal file
View File

@@ -0,0 +1,5 @@
// simplest cue sheet
TRACK AUDIO
NO COPY // so that all CTL flags are 0
SILENCE 0:0:74 // frames are just under 75

6
test/t2.toc Normal file
View File

@@ -0,0 +1,6 @@
// additional pre-gap for track 1
TRACK AUDIO
NO COPY // so that all CTL flags are 0
FILE "cdda.bin" 0:59:0 // Seconds are just under 60
START 0:10:0 // 10 second pre-gap

11
test/t3.toc Normal file
View File

@@ -0,0 +1,11 @@
// simplest cue sheet for two tracks
TRACK AUDIO
NO COPY // so that all CTL flags are 0
FILE "cdda.bin" 180:0:0 // 180 for number of minutes is okay, although
// it is not for a second or a frame value.
TRACK AUDIO
NO COPY // so that all CTL flags are 0
FILE "cdda.bin" 1:0:0

8
test/t4.toc Normal file
View File

@@ -0,0 +1,8 @@
// non default CTL flag of track 1
TRACK AUDIO
COPY
PRE_EMPHASIS
FOUR_CHANNEL_AUDIO
FILE "cdda.bin" 1:0:0

8
test/t5.toc Normal file
View File

@@ -0,0 +1,8 @@
// test catalog number
CATALOG "1234567890123"
TRACK AUDIO
NO COPY
FILE "cdda.bin" 1:0:0

7
test/t6.toc Normal file
View File

@@ -0,0 +1,7 @@
// test ISRC code
TRACK AUDIO
NO COPY
ISRC "DEMUA9800001"
FILE "cdda.bin" 1:0:0

12
test/t7.toc Normal file
View File

@@ -0,0 +1,12 @@
// check two tracks with pre-gap and ISRC
TRACK AUDIO
NO COPY
FILE "cdda.bin" 1:0:0
TRACK AUDIO
NO COPY
ISRC "DEMUA9800001"
FILE "cdda.bin" 1:0:0
START 0:5:0 // pre-gap

14
test/t8.toc Normal file
View File

@@ -0,0 +1,14 @@
// check index increments
TRACK AUDIO
NO COPY
FILE "cdda.bin" 0:10:0
INDEX 1:0:0
INDEX 2:0:0
TRACK AUDIO
NO COPY
FILE "cdda.bin" 0:10:0
START 0:5:0 // pre-gap

31
test/t9.toc Normal file
View File

@@ -0,0 +1,31 @@
CD_DA
// check mulitple tracks
CATALOG "0724385356926"
TRACK AUDIO
ISRC "USEM39600078"
COPY
FILE "cdda.bin" 0:10:0
START 0:5:0
TRACK AUDIO
NO COPY
ISRC "USEM39600079"
FILE "cdda.bin" 0:10:0
START 0:2:0
TRACK AUDIO
COPY
FILE "cdda.bin" 0:10:0
START 0:1:30
TRACK AUDIO
NO COPY
START 0:0:0
FILE "cdda.bin" 0:10:0
TRACK AUDIO
ISRC "EDUMA9892346"
NO COPY
FILE "cdda.bin" 0:10:0
START 0:2:1

View File

@@ -1,5 +1,5 @@
/*
$Id: testdefault.c,v 1.4 2004/03/20 22:46:57 rocky Exp $
$Id: testdefault.c,v 1.5 2004/05/07 10:57:50 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -74,6 +74,7 @@ main(int argc, const char *argv[])
char **imgs;
char **c;
unsigned int i;
int ret=0;
const char *cue_files[2] = {"cdda.cue", "isofs-m1.cue"};
const char *nrg_files[1] = {"videocd.nrg"};
@@ -92,7 +93,7 @@ main(int argc, const char *argv[])
}
if (!is_in(nrg_images, nrg_files[0])) {
return 1;
return 10;
}
bincue_images = cdio_get_devices(DRIVER_BINCUE);
@@ -102,11 +103,16 @@ main(int argc, const char *argv[])
}
for (i=0; i<2; i++) {
if (!is_in(bincue_images, cue_files[i])) {
return 2;
if (is_in(bincue_images, cue_files[i])) {
printf("%s parses as a CDRWIN BIN/CUE csheet.\n", cue_files[i]);
} else {
printf("%s doesn't parse as a CDRWIN BIN/CUE csheet.\n", cue_files[i]);
ret = i+1;
}
}
if (ret != 0) return ret;
printf("-----\n");
printf("ISO 9660 images...\n");
imgs = NULL;
@@ -115,7 +121,7 @@ main(int argc, const char *argv[])
if (NULL == imgs || *imgs == NULL) {
printf("Failed to find an ISO 9660 image\n");
return 3;
return 11;
}
for( c = imgs; *c != NULL; c++ ) {
@@ -134,7 +140,7 @@ main(int argc, const char *argv[])
if (NULL == imgs || *imgs == NULL) {
printf("Failed to find CDDA image\n");
return 4;
return 12;
}
for( c = imgs; *c != NULL; c++ ) {
@@ -154,7 +160,7 @@ main(int argc, const char *argv[])
true);
if (NULL == imgs || *imgs == NULL) {
printf("Failed to find VCD image\n");
return 5;
return 13;
}
for( c = imgs; *c != NULL; c++ ) {
@@ -170,7 +176,7 @@ main(int argc, const char *argv[])
if (NULL != imgs && *imgs != NULL) {
printf("Found erroneous High Sierra image\n");
return 5;
return 14;
}
imgs = NULL;
@@ -179,7 +185,7 @@ main(int argc, const char *argv[])
if (NULL != imgs && *imgs != NULL) {
printf("Found erroneous UFS image\n");
return 6;
return 15;
}
cdio_free_device_list(imgs);

91
test/testtoc.c Normal file
View File

@@ -0,0 +1,91 @@
/*
$Id: testtoc.c,v 1.1 2004/05/07 10:57:50 rocky Exp $
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
Regression test for cdio_tocfile.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cdio/cdio.h>
#include <cdio/logging.h>
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <string.h>
#define NUM_GOOD_TOCS 9
#define NUM_BAD_TOCS 3
int
main(int argc, const char *argv[])
{
const char *toc_file[NUM_GOOD_TOCS] = {
"t1.toc",
"t2.toc",
"t3.toc",
"t4.toc",
"t5.toc",
"t6.toc",
"t7.toc",
"t8.toc",
"t9.toc"
};
const char *badtoc_file[NUM_BAD_TOCS] = {
"bad-msf-1.toc",
"bad-msf-2.toc",
"bad-mode1.toc"
};
int ret=0;
unsigned int i;
cdio_loglevel_default = CDIO_LOG_INFO;
for (i=0; i<NUM_GOOD_TOCS; i++) {
if (!cdio_is_tocfile(toc_file[i])) {
printf("Incorrect: %s doesn't parse as a cdrdao TOC file.\n",
toc_file[i]);
ret=i+1;
} else {
printf("Correct: %s parses as a cdrdao TOC file.\n",
toc_file[i]);
}
}
for (i=0; i<NUM_BAD_TOCS; i++) {
if (!cdio_is_tocfile(badtoc_file[i])) {
printf("Correct: %s doesn't parse as a cdrdao TOC file.\n",
badtoc_file[i]);
} else {
printf("Incorrect: %s parses as a cdrdao TOC file.\n",
badtoc_file[i]);
ret+=50*i+1;
break;
}
}
return ret;
}