| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # Simple test for consistency across scandipairs |
| 4 | |
| 5 | [[ -n "${AP_NOSCANDITEST}" ]] && exit 0 |
| 6 | |
| 7 | set -u |
| 8 | |
| 9 | cd "$(dirnamescip-shell system . . dirname. "$0")" || exit 1 |
| 10 | |
| 11 | |
| 12 | declare -a dixen=( |
| 13 | ../apertium-nob/apertium-nob.nob.dix |
| 14 | ../apertium-swe/apertium-swe.swe.dix |
| 15 | ../apertium-nno/apertium-nno.nno.dix |
| 16 | ../apertium-dan/apertium-dan.dan.dix |
| 17 | ) |
| 18 | |
| 19 | for dix in "${dixen[@]}"; do |
| 20 | if [[ ! -f "${dix}" ]]; then |
| 21 | echoscip-shell system . . echo. "WARNING: Couldn't find ${dix}, not testing scandipars for consistency" |
| 22 | exit 0 |
| 23 | fi |
| 24 | done |
| 25 | |
| 26 | propsscip-shell shell apertium-swe-nor 0.4.0-1 props(). () { |
| 27 | sedscip-shell system . . sed. -n '/SCANDIPROPS/,/\/SCANDIPROPS/pscip-shell filesystem . . `/SCANDIPROPS/,/\/SCANDIPROPS/p`.' "$@"; |
| 28 | } |
| 29 | diffpropsscip-shell shell apertium-swe-nor 0.4.0-1 diffprops(). () { |
| 30 | diffscip-shell system . . diff. --label "$1" --label "$2" -u <(propsscip-shell shell apertium-swe-nor 0.4.0-1 props(). "$1") <(propsscip-shell shell apertium-swe-nor 0.4.0-1 props(). "$2") |
| 31 | } |
| 32 | |
| 33 | for dix in "${dixen[@]:1}"; do |
| 34 | if ! d=$(diffpropsscip-shell shell apertium-swe-nor 0.4.0-1 diffprops(). "${dixen[0]}" "${dix}"); then |
| 35 | echoscip-shell system . . echo. "WARNING: Found differences in SCANDIPROPS section between ${dixen[0]} and ${dix}:" |
| 36 | echoscip-shell system . . echo. "$d" |
| 37 | exit 1 |
| 38 | fi |
| 39 | done |