actual/packages/node-libofx/OpenSP-1.5.2/tests/af-13

121 lines
2.3 KiB
Text
Raw Normal View History

2022-04-29 02:44:38 +00:00
#!/bin/sh
# Architectural Form: test ArcBridA:
# Resolving IDREFs (series: af-12 - af-15)
# test onsgmls and osgmlnorm
LANG=C; export LANG
LC_ALL=C; export LC_ALL
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles af-13.sgml af-13.dtd af-meta-13.dtd"
cat <<EOF >af-13.sgml
<!DOCTYPE doc SYSTEM "af-13.dtd">
<doc>
<s>
<v n="n1">verse 1</v>
<v n="n2">verse 2</v>
</s>
<n>
<i r="n2">note on verse 2</i>
</n>
</doc>
EOF
cat <<EOF >af-13.dtd
<!NOTATION SGML PUBLIC "-//ISO 8879:1986//NOTATION Standard Generalized Markup
Language//EN">
<?IS10744 ArcBase open>
<!NOTATION open PUBLIC "-//OpenJade Project//NOTATION AFDR ARCBASE open Architecture//EN">
<!ATTLIST #NOTATION open
ArcDTD CDATA #FIXED "opendtd">
<!ENTITY opendtd SYSTEM "af-meta-13.dtd" CDATA SGML>
<!ELEMENT doc - o (s+,n)>
<!ATTLIST doc
open NMTOKEN #FIXED "open">
<!ELEMENT s - o (v+)>
<!ATTLIST s
open NMTOKEN #FIXED "stanza">
<!ELEMENT v - o (#PCDATA)>
<!ATTLIST v
n id #REQUIRED
open NMTOKEN #FIXED "verse">
<!ELEMENT n - o (i+)>
<!ATTLIST n
open NMTOKEN #FIXED "notes">
<!ELEMENT i - o (#PCDATA)>
<!ATTLIST i
r IDREF #REQUIRED>
EOF
cat <<EOF >af-meta-13.dtd
<!ELEMENT open - o (stanza+,notes)>
<!ELEMENT stanza - o (verse+)>
<!ELEMENT verse - o (#PCDATA)>
<!ATTLIST verse
n ID #REQUIRED>
<!ELEMENT notes - o (i+)>
<!ELEMENT i - o (#PCDATA)>
<!ATTLIST i
r IDREF #IMPLIED>
EOF
tmpfiles="$tmpfiles af-13-onsgmls.out"
: ${ONSGMLS=onsgmls}
${ONSGMLS} >af-13-onsgmls.out -A open af-13.sgml
tmpfiles="$tmpfiles af-13-onsgmls.ok"
cat <<EOF >af-13-onsgmls.ok
(OPEN
(STANZA
AN TOKEN N1
(VERSE
-verse 1
)VERSE
AN TOKEN N2
(VERSE
-verse 2
)VERSE
)STANZA
(NOTES
AR TOKEN N2
(I
-note on verse 2
)I
)NOTES
)OPEN
C
EOF
: ${DIFF=diff}
${DIFF} af-13-onsgmls.ok af-13-onsgmls.out
result=$?
test $result = 0 || { rm -fr $tmpfiles; exit 1; }
tmpfiles="$tmpfiles af-13-norm.out"
: ${OSGMLNORM=osgmlnorm}
${OSGMLNORM} >af-13-norm.out -A open af-13.sgml
tmpfiles="$tmpfiles af-13-norm.ok"
cat <<EOF >af-13-norm.ok
<OPEN>
<STANZA>
<VERSE N="N1">verse 1</VERSE>
<VERSE N="N2">verse 2</VERSE>
</STANZA>
<NOTES>
<I R="N2">note on verse 2</I>
</NOTES>
</OPEN>
EOF
${DIFF} af-13-norm.ok af-13-norm.out
result=$?
test $result = 0 || result=$(($result + 1))
rm -fr $tmpfiles
exit $result