Adding test for MARC->MARCXML conversions with 3 weird records
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 1 Oct 2004 11:43:43 +0000 (11:43 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 1 Oct 2004 11:43:43 +0000 (11:43 +0000)
test/Makefile.am
test/marc1 [new file with mode: 0644]
test/marc2 [new file with mode: 0644]
test/marc3 [new file with mode: 0644]
test/tstcql.sh
test/tstmarc.sh [new file with mode: 0755]

index 8dda4f6..8528e8d 100644 (file)
@@ -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 (file)
index 0000000..5df484c
--- /dev/null
@@ -0,0 +1 @@
+00988nam0 32003011  45  001002800000004001000028008002800038009001100066021002700077032001500104100002100119245005400140250004100194260004000235300002700275504012300302512006000425520005000485652002400535652001600559666001600575666001900591666001500610666001800625666001900643666000900662666001500671\1e000\1fa9 181 423 4\1fb710100\1ffa\1e000\1frn\1fae\1e000\1ftm\1fuu\1fa2002\1fbus\1fleng\1fv0\1e000\1faa\1fgxx\1e000\1fa1-4000-4596-7\1fd$14,00\1e000\1f&DBC200439\1e000\1f0\1faSloman\1fhLarry\1e000\1faOn the road with Bob Dylan\1feLarry "Ratso" Sloman\1e000\1faRevised edition\1fbThree Rivers Press\1e000\1faNew York\1fbThree Rivers Press\1fc2002\1e000\1faxv, 464 sider, tavler\1e000\1faLarry "Ratso" Slomans meget personlige beretning om Bob Dylans koncertturne i USA i 1975: "The Rolling Thunder revue"\1e000\1faPå omslaget: With a new introduction by Kinky Friedman\1e000\1faTidligere: 1. udgave. New York, Bantam, 1978\1e000\1f0\1fm99.4\1faDylan\1fhBob\1e000\1fp78.9064\1fv5\1e000\1fffolkemusik\1e000\1fffolkemusikere\1e000\1ffrockmusik\1e000\1ffrockmusikere\1e000\1ffrockkoncerter\1e000\1feUSA\1e000\1fi1970-1979\1e\1d
\ No newline at end of file
diff --git a/test/marc2 b/test/marc2
new file mode 100644 (file)
index 0000000..cfc7f72
--- /dev/null
@@ -0,0 +1 @@
+01116nam0 32002171  45  001002800000004001000028008002800038009001100066039000900077100001900086245005900105260003300164300001000197512007300207531001400280538001900294652001500313666004900328795050200377795001900879\1e000\1fa9 182 502 3\1fb710100\1ffa\1e000\1frc\1fae\1e000\1fts\1fuf\1fa1995\1fbgb\1fleng\1fv0\1e000\1fas\1fgxc\1e000\1fabef\1e000\1faMimms\1fhGarnet\1e000\1faCry baby\1faWarm and soulful\1feGarnet Mimms ... [et al.]\1e000\1faBury St. Edmunds\1fbBGO\1fc1995\1e000\1fn1 cd\1e000\1faIndspilninger publiceret 1963 (Cry baby) og 1965 (Warm and soulful)\1e000\1faIndhold:\1e000\1ffBGO\1fgBGOCD268\1e000\1fm78.794\1fv4\1e000\1fmsoul\1fmrhythm & blues\1fnvokal\1fp1960-1969\1flUSA\1e000\1få11\1faCry baby\1faNobody but you\1faUntil you were gone\1faAnytime you want me\1faSo close\1faFor your precious love\1faBaby don't you weep\1faA ¤quiet place\1faCry to me\1faDon't change your heart\1faWanting you\1faThe ¤truth hurts\1faI'll take good care of you\1faLooking for you\1faIt won't hurt (half as much)\1faIt was easier to hurt her\1faThinkin'\1faProve it to me\1faMore than a miracle\1faAs long as I have you\1faOne girl\1faThere goes my baby\1faIt's just a matter of time\1faA ¤little bit of soap\1faLook away\1faI'll make it up to you\1e000\1få40\1fy0\1fa1 girl\1e\1d
\ No newline at end of file
diff --git a/test/marc3 b/test/marc3
new file mode 100644 (file)
index 0000000..2c40d62
--- /dev/null
@@ -0,0 +1 @@
+00914naa  2200337   45  001001700000004000900017008002400026009001000050041000800060041000800068097000700076245003300083300002600116557003300142630001600175630001300191633001000204633000900214648006100223648001600284648005400300J01000600354BAS000500360LKR004200365CAT003000407CAT003000437CAT003000467CAT003900497CAT002600536UID001400562\1e  \1faa00001508\1ffa\1e  \1fai\1frn\1e  \1fa1991\1fbxx\1flnor\1fta\1fv9\1e  \1faa\1fgxx\1e  \1fanor\1e  \1fdeng\1e00\1fa06\1e  \1faByfornyelse ved Ibsen-Ringen\1e  \1fbfarvefoto\1fbplan\1fbsnit\1e  \1faByggekunst\1fj1991\1fv1/2\1fk41-45\1e  \1ffbyfornyelse\1e  \1ffsanering\1e  \1ffNorge\1e  \1ffOslo\1e  \1faTelje Torp Aasen Arkitektkontor\1fcKristian Augustsgate 7B\1e  \1faEng, Dagfin\1e  Granlund, Tom\1fcKristian Augustsgate\1fcPilestredet 19\1e  \1faa\1e  20\1e  \1faITM\1flARK50\1fb0000145\1fy1991\1fi1/2\1fk41-45\1e  \1fa\1fb\1fc20020111\1flARK01\1fh2002\1e  \1fa\1fb\1fc20020111\1flARK01\1fh2116\1e  \1fa\1fb\1fc20021002\1flARK01\1fh1000\1e  \1faICLLOAD\1fb00\1fc20021122\1flARK01\1fh1948\1e  \1fc20030618\1flARK01\1fh1330\1e  \1faa00001508\1e\1d
\ No newline at end of file
index 8c70905..526d260 100755 (executable)
@@ -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 (executable)
index 0000000..1b0aae9
--- /dev/null
@@ -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