File: lb.sh

package info (click to toggle)
sombok 2.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 4,520 kB
  • sloc: ansic: 38,009; sh: 3,059; perl: 769; makefile: 134
file content (66 lines) | stat: -rw-r--r-- 934 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- bash -*-

OPTIONS="\
--charmax 998 \
--colmin 0 \
--colmax 76 \
--format-func SIMPLE \
--no-hangul-as-al \
--legacy-cm \
--newline \\n \
--sizing-func UAX11 \
--urgent-func NONE \
--virama-as-joiner \
"

plan () {
    PLANNED=$1
    SUCCESS=0
}

dotest () {
    in=$1
    shift
    if [ "$in" = "negate" ]; then
	negate=yes
	in=$1
	shift
    fi
    out=$1
    shift

    ./sombok $OPTIONS $* -o tmp.out test-data/$in.in
    rc=$?
    if [ $rc = 0 ]; then
	if [ -e test-data/$out.out ]; then
	    cmp tmp.out test-data/$out.out
	    rc=$?
	else
	    cat tmp.out > test-data/$out.xxx
	    rc=255
	fi
    fi
    rm -f tmp.out

    if [ "$negate" = "yes" ]; then
	if [ $rc = 0 ]; then
	    rc=255
	else
	    rc=0
	fi
    fi
    if [ $rc = 0 ]; then
	SUCCESS=`expr $SUCCESS + 1`
    fi
}

check_result () {
    echo "$SUCCESS of $PLANNED subtests passed."

    if [ "$PLANNED" = "$SUCCESS" ]; then
	exit 0
    else
	exit 1
    fi
}