testtoc -> driver/cdrdao.c.in
This commit is contained in:
5
test/driver/.gitignore
vendored
5
test/driver/.gitignore
vendored
@@ -1,15 +1,16 @@
|
||||
/*.o
|
||||
/*.exe
|
||||
/*.o
|
||||
/*~
|
||||
/.deps
|
||||
/.libs
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
/bincue
|
||||
/bincue
|
||||
/bincue.c
|
||||
/cdrdao.c
|
||||
/follow_symlink
|
||||
/freebsd
|
||||
/bincue
|
||||
/gnu_linux
|
||||
/mmc
|
||||
/nrg
|
||||
|
||||
@@ -19,6 +19,9 @@ DATA_DIR = $(abs_top_srcdir)/test/data
|
||||
bincue_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
bincue_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
|
||||
|
||||
cdrdao_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
cdrdao_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
|
||||
|
||||
freebsd_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
freebsd_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
|
||||
|
||||
@@ -44,13 +47,14 @@ win32_LDADD = $(LIBCDIO_LIBS) $(LTLIBICONV)
|
||||
win32_CFLAGS = -DDATA_DIR=\"$(DATA_DIR)\"
|
||||
|
||||
check_PROGRAMS = \
|
||||
bincue freebsd gnu_linux mmc nrg \
|
||||
bincue cdrdao freebsd gnu_linux mmc nrg \
|
||||
osx realpath solaris win32
|
||||
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
EXTRA_DIST = \
|
||||
bincue.c.in \
|
||||
cdrdao.c.in \
|
||||
nrg.c.in
|
||||
|
||||
MOSTLYCLEANFILES = \
|
||||
|
||||
116
test/driver/cdrdao.c.in
Normal file
116
test/driver/cdrdao.c.in
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
Copyright (C) 2004, 2008, 2010 Rocky Bernstein <rocky@gnu.org>
|
||||
|
||||
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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
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>
|
||||
|
||||
#ifndef DATA_DIR
|
||||
#define DATA_DIR "@abs_top_srcdir@/test/data"
|
||||
#endif
|
||||
|
||||
#define NUM_GOOD_TOCS 16
|
||||
#define NUM_BAD_TOCS 8
|
||||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
const char *toc_file[NUM_GOOD_TOCS] = {
|
||||
"cdtext.toc",
|
||||
"t1.toc",
|
||||
"t2.toc",
|
||||
"t3.toc",
|
||||
"t4.toc",
|
||||
"t5.toc",
|
||||
"t6.toc",
|
||||
"t7.toc",
|
||||
"t8.toc",
|
||||
"t9.toc",
|
||||
"data1.toc",
|
||||
"data2.toc",
|
||||
"data5.toc",
|
||||
"data6.toc",
|
||||
"data7.toc",
|
||||
"vcd2.toc",
|
||||
};
|
||||
|
||||
const char *badtoc_file[NUM_BAD_TOCS] = {
|
||||
"bad-msf-1.toc",
|
||||
"bad-msf-2.toc",
|
||||
"bad-msf-3.toc",
|
||||
"bad-cat1.toc",
|
||||
"bad-cat2.toc",
|
||||
"bad-cat3.toc",
|
||||
"bad-file.toc",
|
||||
"bad-mode1.toc"
|
||||
};
|
||||
int ret=0;
|
||||
unsigned int i;
|
||||
char psz_tocfile[500];
|
||||
|
||||
#ifdef HAVE_CHDIR
|
||||
if (0 == chdir(DATA_DIR))
|
||||
#endif
|
||||
{
|
||||
psz_tocfile[sizeof(psz_tocfile)-1] = '\0';
|
||||
|
||||
cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO;
|
||||
for (i=0; i<NUM_GOOD_TOCS; i++) {
|
||||
snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
|
||||
"%s/%s", DATA_DIR, toc_file[i]);
|
||||
if (!cdio_is_tocfile(psz_tocfile)) {
|
||||
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++) {
|
||||
snprintf(psz_tocfile, sizeof(psz_tocfile)-1,
|
||||
"%s/%s", DATA_DIR, badtoc_file[i]);
|
||||
if (!cdio_is_tocfile(psz_tocfile)) {
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user