diff --git a/configure.ac b/configure.ac index fdeb3370..4d4752d2 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ define(RELEASE_NUM, 81) define(CDIO_VERSION_STR, 0.$1cvs) AC_PREREQ(2.52) -AC_REVISION([$Id: configure.ac,v 1.222 2008/03/16 00:12:42 rocky Exp $])dnl +AC_REVISION([$Id: configure.ac,v 1.223 2008/03/22 22:43:56 rocky Exp $])dnl AC_INIT(libcdio, CDIO_VERSION_STR(RELEASE_NUM)) AC_CONFIG_SRCDIR(src/cd-info.c) @@ -683,6 +683,7 @@ AC_CONFIG_FILES([ src/Makefile \ test/testbincue.c \ test/testisocd2.c \ + test/testnrg.c \ test/check_common_fn \ test/Makefile \ ]) diff --git a/test/.cvsignore b/test/.cvsignore index f0d159f8..e28e43d3 100644 --- a/test/.cvsignore +++ b/test/.cvsignore @@ -25,6 +25,8 @@ testiso9660 testisocd testisocd2 testisocd2.c +testnrg +testnrg.c testparanoia testpregap testtoc diff --git a/test/Makefile.am b/test/Makefile.am index d272acde..b1904885 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.63 2008/03/20 19:02:38 karl Exp $ +# $Id: Makefile.am,v 1.64 2008/03/22 22:43:56 rocky Exp $ # # Copyright (C) 2003, 2004, 2006, 2008 Rocky Bernstein # @@ -30,7 +30,7 @@ endif hack = check_sizeof testassert testbincue testischar \ testisocd testisocd2 testiso9660 \ - $(testparanoia) testtoc testpregap + testnrg $(testparanoia) testtoc testpregap noinst_PROGRAMS = testdefault @@ -54,6 +54,9 @@ testpregap_CFLAGS = -DTEST_DIR=\"$(srcdir)\" testbincue_LDADD = $(LIBCDIO_LIBS) $(LIBICONV) testbincue_CFLAGS = -DTEST_DIR=\"$(srcdir)\" +testnrg_LDADD = $(LIBCDIO_LIBS) $(LIBICONV) +testnrg_CFLAGS = -DTEST_DIR=\"$(srcdir)\" + check_SCRIPTS = check_nrg.sh check_cue.sh check_cd_read.sh \ check_iso.sh check_fuzzyiso.sh check_paranoia.sh check_opts.sh # If we beefed this up so it checked to see if a CD-DA was loaded @@ -85,7 +88,7 @@ check_DATA = vcd_demo.right vcd_demo_vcdinfo.right \ EXTRA_DIST = $(check_SCRIPTS) $(check_DATA) \ check_common_fn check_cue.sh.in check_nrg.sh.in \ - testbincue.c.in check_iso.sh.in + testbincue.c.in testnrg.c.in check_iso.sh.in TESTS = $(check_PROGRAMS) $(check_SCRIPTS) XFAIL_TESTS = testassert diff --git a/test/testnrg.c.in b/test/testnrg.c.in new file mode 100644 index 00000000..eaa42274 --- /dev/null +++ b/test/testnrg.c.in @@ -0,0 +1,91 @@ +/* -*- C -*- + $Id: testnrg.c.in,v 1.1 2008/03/22 22:43:56 rocky Exp $ + + Copyright (C) 2008 Rocky Bernstein + + 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 . +*/ + +/* + Regression test for cdio_nrgfile(). +*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include + +#ifdef HAVE_STDIO_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#include + +#ifndef TEST_DIR +#define TEST_DIR "@srcdir@" +#endif + +#define NUM_FIELDS 2 + +int +main(int argc, const char *argv[]) +{ + char psz_nrgfile[500]; + CdIo_t *p_cdio; + const char *cdtext_check[NUM_FIELDS] = { + "Richard Stallman", + "Join us now we have the software" + }; + const int cdtext_fields[NUM_FIELDS] = {CDTEXT_PERFORMER, CDTEXT_TITLE}; + + cdio_loglevel_default = (argc > 1) ? CDIO_LOG_DEBUG : CDIO_LOG_INFO; + /* snprintf(psz_nrgfile, sizeof(psz_nrgfile)-1, + "%s/%s", TEST_DIR, cue_file[i]); + */ + if (!cdio_have_driver(DRIVER_NRG)) return(77); + + snprintf(psz_nrgfile, sizeof(psz_nrgfile)-1, "%s/%s", + TEST_DIR, "./p1.nrg"); + + p_cdio = cdio_open_nrg(psz_nrgfile); + if (!p_cdio) { + printf("Can't open Nero image file: %s.\n", psz_nrgfile); + return(1); + } + { + unsigned int i; + cdtext_t *p_cdtext = cdio_get_cdtext(p_cdio, 0); + if (!p_cdtext) return(1); + for (i=0; ifield[cdtext_fields[i]]; + if (!psz_field) + return(2); + if (0 != strncmp(psz_field, cdtext_check[i], strlen(cdtext_check[i]))) { + printf("CD-Text compare mismatch.\n"); + printf("expected:\n\t'%s'\ngot:\n\t'%s'\n", + cdtext_check[i], psz_field); + return(3); + } + } + } + cdio_destroy(p_cdio); + + return 0; +}