Add some bincue regression tests.

This commit is contained in:
rocky
2004-07-09 20:47:08 +00:00
parent 0438ec5e26
commit 771e9fb7cd
5 changed files with 108 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.am,v 1.24 2004/05/09 23:06:44 rocky Exp $
# $Id: Makefile.am,v 1.25 2004/07/09 20:47:08 rocky Exp $
#
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
#
@@ -23,7 +23,7 @@
#
# There's a problem with doing make distcheck for testdefault.
# A reminder of why I hate automake.
hack = check_sizeof testassert testischar testiso9660 testtoc
hack = check_sizeof testassert testischar testiso9660 testtoc testbincue
noinst_PROGRAMS = $(hack) testdefault
INCLUDES = -I$(top_srcdir) $(LIBCDIO_CFLAGS)
@@ -34,6 +34,7 @@ testdefault_LDADD = $(LIBCDIO_LIBS)
testischar_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
testiso9660_LDADD = $(LIBISO9660_LIBS) $(LIBCDIO_LIBS)
testtoc_LDADD = $(LIBCDIO_LIBS)
testbincue_LDADD = $(LIBCDIO_LIBS)
check_SCRIPTS = check_nrg.sh check_cue.sh check_cd_read.sh \
check_iso.sh check_opts.sh
@@ -52,6 +53,7 @@ check_DATA = vcd_demo.right \
data1.toc data2.toc data5.toc data6.toc data7.toc \
bad-mode1.toc bad-msf-1.toc bad-msf-2.toc \
bad-cat1.toc bad-cat2.toc bad-cat3.toc \
bad-cat1.cue bad-cat2.cue bad-cat3.cue \
copying.iso copying.right
EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \

9
test/bad-cat2.cue Normal file
View File

@@ -0,0 +1,9 @@
REM $Id: bad-cat2.cue,v 1.1 2004/07/09 20:47:08 rocky Exp $
REM test catalog number. -- not enough digits
CATALOG "167890123"
FILE "cdda.bin" BINARY
TRACK 01 AUDIO
INDEX 01 00:00:00

View File

@@ -1,7 +1,7 @@
// $Id: bad-cat2.toc,v 1.1 2004/05/08 20:36:02 rocky Exp $
// $Id: bad-cat2.toc,v 1.2 2004/07/09 20:47:08 rocky Exp $
// test catalog number. -- not enough digits
CATALOG "167890123" // Should be 13 digits
CATALOG 167890123 // Should be 13 digits
TRACK AUDIO
NO COPY

9
test/bad-cat3.cue Normal file
View File

@@ -0,0 +1,9 @@
REM $Id: bad-cat3.cue,v 1.1 2004/07/09 20:47:08 rocky Exp $
REM test catalog number. -- not enough digits
CATALOG 123456789A123
FILE "cdda.bin" BINARY
TRACK 01 AUDIO
INDEX 01 00:00:00

84
test/testbincue.c Normal file
View File

@@ -0,0 +1,84 @@
/*
$Id: testbincue.c,v 1.1 2004/07/09 20:47:08 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_binfile().
*/
#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_CUES 2
#define NUM_BAD_CUES 3
int
main(int argc, const char *argv[])
{
const char *cue_file[NUM_GOOD_CUES] = {
"cdda.cue",
"isofs-m1.cue",
};
const char *badcue_file[NUM_BAD_CUES] = {
"bad-cat1.cue",
"bad-cat2.cue",
"bad-cat3.cue",
};
int ret=0;
unsigned int i;
cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO;
for (i=0; i<NUM_GOOD_CUES; i++) {
if (!cdio_is_cuefile(cue_file[i])) {
printf("Incorrect: %s doesn't parse as a CDRWin CUE file.\n",
cue_file[i]);
ret=i+1;
} else {
printf("Correct: %s parses as a CDRWin CUE file.\n",
cue_file[i]);
}
}
for (i=0; i<NUM_BAD_CUES; i++) {
if (!cdio_is_cuefile(badcue_file[i])) {
printf("Correct: %s doesn't parse as a CDRWin CUE file.\n",
badcue_file[i]);
} else {
printf("Incorrect: %s parses as a CDRWin CUE file.\n",
badcue_file[i]);
ret+=50*i+1;
break;
}
}
return ret;
}