File: tool

package info (click to toggle)
libdatrie 0.2.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,156 kB
  • sloc: sh: 4,331; ansic: 4,282; makefile: 204
file content (46 lines) | stat: -rwxr-xr-x 1,043 bytes parent folder | download | duplicates (5)
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
#!/bin/sh
# autopkgtest check: Check if 'trietool' utility works properly

set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > thaidict.abm
[0x0e01,0x0e5b]
EOF

trietool thaidict add "แดง" 4
trietool thaidict add "เขียว" 2
trietool thaidict add "น้ำเงิน" 1
trietool thaidict add "เหลือง" 6
trietool thaidict add "ขาว" 7
trietool thaidict add "ดำ" 0

echo "dict preparation: OK"

RES=$(trietool thaidict query "แดง")
[ $RES -eq 4 ]
RES=$(trietool thaidict query "เขียว")
[ $RES -eq 2 ]
RES=$(trietool thaidict query "น้ำเงิน")
[ $RES -eq 1 ]
RES=$(trietool thaidict query "เหลือง")
[ $RES -eq 6 ]
RES=$(trietool thaidict query "ขาว")
[ $RES -eq 7 ]
RES=$(trietool thaidict query "ดำ")
[ $RES -eq 0 ]

echo "dict query: OK"

N=$(trietool thaidict list | wc -l)
[ $N -eq 6 ]

trietool thaidict delete "ดำ"

N=$(trietool thaidict list | wc -l)
[ $N -eq 5 ]

echo "dict delete & list: OK"