| Marc Kupietz | ab0a733 | 2024-04-26 13:25:16 +0200 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | TESTDIR=$(dirname $0) |
| 3 | ASSERTSH=${TESTDIR}/assert.sh |
| 4 | set -e |
| 5 | . ${ASSERTSH} |
| 6 | |
| 7 | TEXTS=6 |
| 8 | I5_FILE=target/dnb18.i5.xml |
| 9 | if [ ! -f "$I5_FILE" ]; then |
| 10 | log_failure "File $I5_FILE does not exist" |
| 11 | exit 1 |
| 12 | fi |
| 13 | |
| 14 | |
| 15 | observed=$(xmlstarlet sel --net -t -v "count(//idsText)" $I5_FILE) |
| 16 | |
| 17 | if $(assert_eq "$observed" "$TEXTS"); then |
| 18 | log_success "$I5_FILE contains $TEXTS idsText elements" |
| 19 | else |
| 20 | log_failure "$I5_FILE does not contain $TEXTS idsText elements" |
| 21 | fi |
| 22 | |
| 23 | |
| 24 | observed=$(xmlstarlet sel --net -t -v "count(/idsCorpus/idsDoc/idsText/idsHeader/fileDesc/sourceDesc/biblStruct/monogr/h.author[normalize-space(.)])" $I5_FILE) |
| 25 | if $(assert_eq "$observed" "$TEXTS"); then |
| 26 | log_success "$I5_FILE contains $TEXTS non-empty h.author elements" |
| 27 | else |
| 28 | log_failure "$I5_FILE does not contain $TEXTS non-empty h.author elements" |
| 29 | fi |
| 30 | |
| Marc Kupietz | fddbb51 | 2024-04-26 16:49:02 +0200 | [diff] [blame^] | 31 | observed=$(xmlstarlet sel --net -t -v "count(/idsCorpus/idsDoc/idsText/idsHeader/fileDesc/sourceDesc/biblStruct/monogr/h.author[contains(., '[')])" target/dnb13.i5.xml) |
| Marc Kupietz | ab0a733 | 2024-04-26 13:25:16 +0200 | [diff] [blame] | 32 | if $(assert_eq "$observed" "0"); then |
| 33 | log_success "authors do not contain []" |
| 34 | else |
| 35 | log_failure "authors contain []" |
| 36 | fi |