| 1 |
#!/bin/sh |
| 2 |
# autopkgtest check: Check if 'trietool' utility works properly |
| 3 |
|
| 4 |
set -e |
| 5 |
|
| 6 |
WORKDIR=$(mktemp -d) |
| 7 |
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM |
| 8 |
cd $WORKDIR |
| 9 |
cat <<EOF > thaidict.abm |
| 10 |
[0x0e01,0x0e5b] |
| 11 |
EOF |
| 12 |
|
| 13 |
trietool thaidict add "แดง" 4 |
| 14 |
trietool thaidict add "เขียว" 2 |
| 15 |
trietool thaidict add "น้ำเงิน" 1 |
| 16 |
trietool thaidict add "เหลือง" 6 |
| 17 |
trietool thaidict add "ขาว" 7 |
| 18 |
trietool thaidict add "ดำ" 0 |
| 19 |
|
| 20 |
echo "dict preparation: OK" |
| 21 |
|
| 22 |
RES=$(trietool thaidict query "แดง") |
| 23 |
[ $RES -eq 4 ] |
| 24 |
RES=$(trietool thaidict query "เขียว") |
| 25 |
[ $RES -eq 2 ] |
| 26 |
RES=$(trietool thaidict query "น้ำเงิน") |
| 27 |
[ $RES -eq 1 ] |
| 28 |
RES=$(trietool thaidict query "เหลือง") |
| 29 |
[ $RES -eq 6 ] |
| 30 |
RES=$(trietool thaidict query "ขาว") |
| 31 |
[ $RES -eq 7 ] |
| 32 |
RES=$(trietool thaidict query "ดำ") |
| 33 |
[ $RES -eq 0 ] |
| 34 |
|
| 35 |
echo "dict query: OK" |
| 36 |
|
| 37 |
N=$(trietool thaidict list | wc -l) |
| 38 |
[ $N -eq 6 ] |
| 39 |
|
| 40 |
trietool thaidict delete "ดำ" |
| 41 |
|
| 42 |
N=$(trietool thaidict list | wc -l) |
| 43 |
[ $N -eq 5 ] |
| 44 |
|
| 45 |
echo "dict delete & list: OK" |
| 46 |
|