Annotation of embedaddon/libiconv/tests/check-stateless, revision 1.1.1.1

1.1       misho       1: #!/bin/sh
                      2: # Complete check of a stateless encoding.
                      3: # Usage: check-stateless SRCDIR CHARSET
                      4: srcdir="$1"
                      5: charset="$2"
                      6: set -e
                      7: 
                      8: # charset, modified for use in filenames.
                      9: charsetf=`echo "$charset" | sed -e 's,:,-,g'`
                     10: 
                     11: # iconv in one direction.
                     12: ./table-from "$charset" > tmp-"$charsetf".TXT
                     13: 
                     14: # iconv in the other direction.
                     15: ./table-to "$charset" | sort > tmp-"$charsetf".INVERSE.TXT
                     16: 
                     17: # Check 1: charmap and iconv forward should be identical.
                     18: cmp "${srcdir}"/"$charsetf".TXT tmp-"$charsetf".TXT 2> /dev/null
                     19: 
                     20: # Check 2: the difference between the charmap and iconv backward.
                     21: sed -e '/      .* 0x/d' < "${srcdir}"/"$charsetf".TXT > tmp-noprecomposed-"$charsetf".TXT
                     22: if test -f "${srcdir}"/"$charsetf".IRREVERSIBLE.TXT; then
                     23:   cat tmp-noprecomposed-"$charsetf".TXT "${srcdir}"/"$charsetf".IRREVERSIBLE.TXT | sort | uniq -u > tmp-orig-"$charsetf".INVERSE.TXT
                     24: else
                     25:   cp tmp-noprecomposed-"$charsetf".TXT tmp-orig-"$charsetf".INVERSE.TXT
                     26: fi
                     27: cmp tmp-orig-"$charsetf".INVERSE.TXT tmp-"$charsetf".INVERSE.TXT 2> /dev/null
                     28: 
                     29: rm -f tmp-"$charsetf".TXT tmp-"$charsetf".INVERSE.TXT tmp-noprecomposed-"$charsetf".TXT tmp-orig-"$charsetf".INVERSE.TXT
                     30: exit 0
                     31: # For a new encoding:
                     32: # You can create the "$charsetf".TXT like this:
                     33: #   ./table-from "$charset" > "$charsetf".TXT
                     34: # You can create the "$charsetf".IRREVERSIBLE.TXT like this:
                     35: #   ./table-to "$charset" | sort > "$charsetf".INVERSE.TXT
                     36: #   diff "$charsetf".TXT "$charsetf".INVERSE.TXT | grep '^[<>]' | sed -e 's,^. ,,' > "$charsetf".IRREVERSIBLE.TXT

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>