From 48e3b97da367521131aa740054e51f30f1d00225 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 1 Oct 2004 11:43:43 +0000 Subject: [PATCH] Adding test for MARC->MARCXML conversions with 3 weird records --- test/Makefile.am | 17 +++++++---------- test/marc1 | 1 + test/marc2 | 1 + test/marc3 | 1 + test/tstcql.sh | 1 + test/tstmarc.sh | 37 +++++++++++++++++++++++++++++++++++++ 6 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 test/marc1 create mode 100644 test/marc2 create mode 100644 test/marc3 create mode 100755 test/tstmarc.sh diff --git a/test/Makefile.am b/test/Makefile.am index 8dda4f6..8528e8d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,13 +1,15 @@ ## Copyright (C) 1994-2004, Index Data ## All rights reserved. -## $Id: Makefile.am,v 1.2 2004-03-10 16:34:30 adam Exp $ +## $Id: Makefile.am,v 1.3 2004-10-01 11:43:43 adam Exp $ check_PROGRAMS = tsticonv tstnmem tstmatchstr tstwrbuf tstodr tstccl -check_SCRIPTS = tstcql.sh +check_SCRIPTS = tstcql.sh tstmarc.sh TESTS = $(check_PROGRAMS) $(check_SCRIPTS) -EXTRA_DIST = tstodr.asn tstodrcodec.c tstodrcodec.h cqlsample $(check_SCRIPTS) +EXTRA_DIST = tstodr.asn tstodrcodec.c tstodrcodec.h cqlsample \ + $(check_SCRIPTS) \ + marc1 marc1.xml marc2 marc2.xml marc3 marc3.xml YAZCOMP = $(top_srcdir)/util/yaz-asncomp YAZCOMPLINE = $(YAZCOMP) -d z.tcl -i yaz -I../include $(YCFLAGS) @@ -23,22 +25,17 @@ dist-hook: tstodrcodec.c tstodrcodec.h: tstodr.asn $(YAZCOMP) cd $(srcdir); $(YAZCOMP) tstodr.asn -# Tests.. -tsticonv_LDADD = ../src/libyaz.la +LDADD = ../src/libyaz.la + tsticonv_SOURCES = tsticonv.c -tstnmem_LDADD = ../src/libyaz.la tstnmem_SOURCES = tstnmem.c -tstmatchstr_LDADD = ../src/libyaz.la tstmatchstr_SOURCES = tstmatchstr.c -tstwrbuf_LDADD = ../src/libyaz.la tstwrbuf_SOURCES = tstwrbuf.c -tstodr_LDADD = ../src/libyaz.la tstodr_SOURCES = tstodrcodec.c tstodrcodec.h tstodr.c -tstccl_LDADD = ../src/libyaz.la tstccl_SOURCES = tstccl.c diff --git a/test/marc1 b/test/marc1 new file mode 100644 index 0000000..5df484c --- /dev/null +++ b/test/marc1 @@ -0,0 +1 @@ +00988nam0 32003011 45 001002800000004001000028008002800038009001100066021002700077032001500104100002100119245005400140250004100194260004000235300002700275504012300302512006000425520005000485652002400535652001600559666001600575666001900591666001500610666001800625666001900643666000900662666001500671000a9 181 423 4b710100fa000rnae000tmuua2002buslengv0000aagxx000a1-4000-4596-7d$14,00000&DBC2004390000aSlomanhLarry000aOn the road with Bob DylaneLarry "Ratso" Sloman000aRevised editionbThree Rivers Press000aNew YorkbThree Rivers Pressc2002000axv, 464 sider, tavler000aLarry "Ratso" Slomans meget personlige beretning om Bob Dylans koncertturne i USA i 1975: "The Rolling Thunder revue"000aPå omslaget: With a new introduction by Kinky Friedman000aTidligere: 1. udgave. New York, Bantam, 19780000m99.4aDylanhBob000p78.9064v5000ffolkemusik000ffolkemusikere000frockmusik000frockmusikere000frockkoncerter000eUSA000i1970-1979 \ No newline at end of file diff --git a/test/marc2 b/test/marc2 new file mode 100644 index 0000000..cfc7f72 --- /dev/null +++ b/test/marc2 @@ -0,0 +1 @@ +01116nam0 32002171 45 001002800000004001000028008002800038009001100066039000900077100001900086245005900105260003300164300001000197512007300207531001400280538001900294652001500313666004900328795050200377795001900879000a9 182 502 3b710100fa000rcae000tsufa1995bgblengv0000asgxc000abef000aMimmshGarnet000aCry babyaWarm and soulfuleGarnet Mimms ... [et al.]000aBury St. EdmundsbBGOc1995000n1 cd000aIndspilninger publiceret 1963 (Cry baby) og 1965 (Warm and soulful)000aIndhold:000fBGOgBGOCD268000m78.794v4000msoulmrhythm & bluesnvokalp1960-1969lUSA000å11aCry babyaNobody but youaUntil you were goneaAnytime you want meaSo closeaFor your precious loveaBaby don't you weepaA ¤quiet placeaCry to meaDon't change your heartaWanting youaThe ¤truth hurtsaI'll take good care of youaLooking for youaIt won't hurt (half as much)aIt was easier to hurt heraThinkin'aProve it to meaMore than a miracleaAs long as I have youaOne girlaThere goes my babyaIt's just a matter of timeaA ¤little bit of soapaLook awayaI'll make it up to you000å40y0a1 girl \ No newline at end of file diff --git a/test/marc3 b/test/marc3 new file mode 100644 index 0000000..2c40d62 --- /dev/null +++ b/test/marc3 @@ -0,0 +1 @@ +00914naa 2200337 45 001001700000004000900017008002400026009001000050041000800060041000800068097000700076245003300083300002600116557003300142630001600175630001300191633001000204633000900214648006100223648001600284648005400300J01000600354BAS000500360LKR004200365CAT003000407CAT003000437CAT003000467CAT003900497CAT002600536UID001400562 aa00001508fa airn a1991bxxlnortav9 aagxx anor deng00a06 aByfornyelse ved Ibsen-Ringen bfarvefotobplanbsnit aByggekunstj1991v1/2k41-45 fbyfornyelse fsanering fNorge fOslo aTelje Torp Aasen ArkitektkontorcKristian Augustsgate 7B aEng, Dagfin Granlund, TomcKristian AugustsgatecPilestredet 19 aa 20 aITMlARK50b0000145y1991i1/2k41-45 abc20020111lARK01h2002 abc20020111lARK01h2116 abc20021002lARK01h1000 aICLLOADb00c20021122lARK01h1948 c20030618lARK01h1330 aa00001508 \ No newline at end of file diff --git a/test/tstcql.sh b/test/tstcql.sh index 8c70905..526d260 100755 --- a/test/tstcql.sh +++ b/test/tstcql.sh @@ -1,4 +1,5 @@ #!/bin/sh +# $Id: tstcql.sh,v 1.3 2004-10-01 11:43:43 adam Exp $ srcdir=${srcdir:-.} oIFS="$IFS" IFS=' diff --git a/test/tstmarc.sh b/test/tstmarc.sh new file mode 100755 index 0000000..1b0aae9 --- /dev/null +++ b/test/tstmarc.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# $Id: tstmarc.sh,v 1.1 2004-10-01 11:43:43 adam Exp $ +srcdir=${srcdir:-.} +ecode=0 +for f in ${srcdir}/marc?; do + NEW=${f}.new.xml + OLD=${f}.xml + DIFF=${f}.diff + ../util/yaz-marcdump -f iso-8859-1 -t utf-8 -X $f > $NEW + if test $? != "0"; then + echo "Failed decode of $f" + ecode=1 + elif test -f $OLD; then + if diff $OLD $NEW >$DIFF; then + rm $DIFF + rm $NEW + else + echo "Differ in $f" + ecode=1 + fi + else + echo "Making test $f for the first time" + if test -x /usr/bin/xmllint; then + if xmllint --noout $NEW >out 2>stderr; then + echo "XML for $f is OK" + mv $NEW $OLD + else + echo "XML for $f is invalid" + ecode=1 + fi + else + echo "xmllint not found. install libxml2-utils" + ecode=1 + fi + fi +done +exit $ecode \ No newline at end of file -- 1.7.10.4