Commit 4373c4d4 authored by Tatsuo Ishii's avatar Tatsuo Ishii

Addition to test/locale submitted by Oleg Broytmann. Comments from him:

There are two subdirectories (ISO8859-7 and koi8-to-win1251) containing
tests for Greek locale and server<=>client recoding feature (recently
submitted by Tatsuo Ishii <t-ishii@sra.co.jp>; we've debugged his patches
together in the field of Cyrillic support).
parent c2d59497
......@@ -14,7 +14,7 @@ CFLAGS+= $(KRBFLAGS)
endif
PROGS = test-pgsql-locale test-ctype
DIRS = koi8-r
DIRS = koi8-r ISO8859-7 koi8-to-win1251
all: $(PROGS)
......
......@@ -24,4 +24,4 @@ think) method is just copy koi8-r directory and edit/replace files.
Oleg.
----
Oleg Broytmann http://members.tripod.com/~phd2/ phd2@earthling.net
Oleg Broytmann http://members.xoom.com/phd2/ phd2@earthling.net
#
# Makefile for example programs
#
all:
-@echo "make: Nothing to be done for \`all'."
test:
@./runall
clean:
rm -f *.out
gr_GR.ISO8859-7 (Greek) locale test.
Created by Angelos Karageorgiou <angelos@awesome.incredible.com>
This diff is collapsed.
abbrev|name_en |name_gr
------+--------------------+------------------------------------------------------------
AK |Alaska |
AL |Alabama |
AZ |Arizona |
AR |Arkansas |
ID |Idaho |
IA |Iowa |
VT |Vermont |
VA |Virginia |
NC |North Carolina |
ND |North Dakota |
UT |Utah |
WY |Wyoming |
WV |West Virginia |
WI |Wisconsin |
WA |Washington |
DC |Washington DC |
IL |Illinois |
IN |Indiana |
KA |Kansas |
CA |California |
KY |Kentucky |
CO |Colorado |
CT |Connecticut |
LA |Louisiana |
ME |Maine |
MI |Michigan |
MD |Maryland |
MA |Massachusetts |
MN |Minnesota |
MS |Mississippi |
MO |Missouri |
MT |Montana |
NJ |New Jersey |
NY |New York |
NM |New Mexico |
NH |New Hampshire |
NV |Nevada |
NE |Nebraska |
DE |Delaware |
SC |South Carolina |
SD |South Dakota |
OK |Oklahoma |
OR |Oregon |
OH |Ohio |
PA |Pennsylvania |
RI |Rhode Island |
TX |Texas |
TN |Tennessee |
GA |Georgia |
FL |Florida |
(50 rows)
EOF
abbrev|name_en |name_gr
------+--------------------+------------------
UT |Utah |
WY |Wyoming |
WV |West Virginia |
WI |Wisconsin |
WA |Washington |
DC |Washington DC |
(6 rows)
EOF
abbrev|name_en |name_gr
------+--------------------+------------------
AK |Alaska |
AL |Alabama |
AZ |Arizona |
AR |Arkansas |
ID |Idaho |
IA |Iowa |
VT |Vermont |
VA |Virginia |
NC |North Carolina |
ND |North Dakota |
UT |Utah |
WY |Wyoming |
WV |West Virginia |
WI |Wisconsin |
WA |Washington |
DC |Washington DC |
IL |Illinois |
IN |Indiana |
KA |Kansas |
CA |California |
KY |Kentucky |
CO |Colorado |
CT |Connecticut |
LA |Louisiana |
ME |Maine |
MI |Michigan |
MD |Maryland |
MA |Massachusetts |
MN |Minnesota |
MS |Mississippi |
MO |Missouri |
MT |Montana |
NJ |New Jersey |
NY |New York |
NM |New Mexico |
NH |New Hampshire |
NV |Nevada |
NE |Nebraska |
DE |Delaware |
SC |South Carolina |
SD |South Dakota |
OK |Oklahoma |
OR |Oregon |
OH |Ohio |
PA |Pennsylvania |
RI |Rhode Island |
TX |Texas |
TN |Tennessee |
GA |Georgia |
FL |Florida |
(50 rows)
EOF
abbrev|name_en |name_gr
------+--------------------+------------------
AK |Alaska |
AL |Alabama |
AZ |Arizona |
AR |Arkansas |
ID |Idaho |
IA |Iowa |
VT |Vermont |
VA |Virginia |
NC |North Carolina |
ND |North Dakota |
UT |Utah |
WY |Wyoming |
WV |West Virginia |
WI |Wisconsin |
WA |Washington |
DC |Washington DC |
IL |Illinois |
IN |Indiana |
KA |Kansas |
CA |California |
KY |Kentucky |
CO |Colorado |
CT |Connecticut |
LA |Louisiana |
ME |Maine |
MI |Michigan |
MD |Maryland |
MA |Massachusetts |
MN |Minnesota |
MS |Mississippi |
MO |Missouri |
MT |Montana |
NJ |New Jersey |
NY |New York |
NM |New Mexico |
NH |New Hampshire |
NV |Nevada |
NE |Nebraska |
DE |Delaware |
SC |South Carolina |
SD |South Dakota |
OK |Oklahoma |
OR |Oregon |
OH |Ohio |
PA |Pennsylvania |
RI |Rhode Island |
TX |Texas |
TN |Tennessee |
GA |Georgia |
FL |Florida |
(50 rows)
EOF
#! /bin/sh
PATH=..:$PATH
echo "Testing PostgreSQL compilation..."
if ! test-pgsql-locale; then
exit 1
fi
LC_CTYPE=gr_GR.ISO8859-7
LC_COLLATE=$LC_CTYPE
export LC_CTYPE LC_COLLATE
echo "Testing LC_CTYPE..."
if ! test-ctype > gr-ctype.out; then
exit 1
fi
diff expected/gr-ctype.out gr-ctype.out
echo "Testing LC_COLLATE..."
perl ../sort-test.pl test-gr-sort.in > test-gr-sort.out
diff expected/test-gr-sort.out test-gr-sort.out
### If you have Python - uncomment the following two lines
#python ../sort-test.py test-gr-sort.in > test-gr-sort.out
#diff expected/test-gr-sort.out test-gr-sort.out
abort() {
[ "$1" ] && echo "$*"
exit 1
}
for f in char varchar text; do
if echo $f | grep -q char; then
ftype="$f(60)"
else
ftype="$f"
fi
echo "Testing PgSQL: sort on $ftype type..."
destroydb testlocale >/dev/null 2>&1
createdb testlocale || abort "createdb failed"
psql -d testlocale -c "CREATE TABLE usastates (abbrev char(2), name_en char(20), name_gr $ftype);" >/dev/null 2>&1 || abort "createtable failed"
psql testlocale < test-gr.sql.in > test-gr-$f.sql.out 2>/dev/null || abort "test query failed"
diff expected/test-gr-$f.sql.out test-gr-$f.sql.out
done
echo "Testing PgSQL: select on regexp..."
psql testlocale < test-gr-select.sql.in > test-gr-select.sql.out 2>/dev/null || abort "select query failed"
diff expected/test-gr-select.sql.out test-gr-select.sql.out
destroydb testlocale || abort "destroydb failed"
echo "Finished."
SELECT * FROM usastates WHERE name_gr ~* '^.*' ORDER BY name_gr;
COPY usastates FROM stdin USING DELIMITERS '|';
AK|Alaska |
WA|Washington |
OR|Oregon |
CA|California |
NV|Nevada |
ID|Idaho |
UT|Utah |
AZ|Arizona |
MT|Montana |
WY|Wyoming |
CO|Colorado |
NM|New Mexico |
ND|North Dakota |
SD|South Dakota |
NE|Nebraska |
KA|Kansas |
OK|Oklahoma |
TX|Texas |
MN|Minnesota |
IA|Iowa |
MO|Missouri |
AR|Arkansas |
LA|Louisiana |
WI|Wisconsin |
IL|Illinois |
IN|Indiana |
MS|Mississippi |
AL|Alabama |
MI|Michigan |
OH|Ohio |
KY|Kentucky |
TN|Tennessee |
GA|Georgia |
FL|Florida |
PA|Pennsylvania |
WV|West Virginia |
VA|Virginia |
NC|North Carolina|
SC|South Carolina|
NY|New York |
NJ|New Jersey |
DE|Delaware |
MD|Maryland |
DC|Washington DC |
VT|Vermont |
MA|Massachusetts |
CT|Connecticut |
ME|Maine |
NH|New Hampshire |
RI|Rhode Island |
\.
SELECT * FROM usastates ORDER BY name_gr;
#
# Makefile for example programs
#
all:
-@echo "make: Nothing to be done for \`all'."
test:
@./runall
clean:
rm -f *.out
koi8-to-win1251 test. The database should be created in koi8 (createdb -E koi8),
test uses koi8-to-win1251 converting feature.
Created by Oleg Broytmann <phd2@earthling.net>. Code for encodings
converting created by Tatsuo Ishii <t-ishii@sra.co.jp>.
abbrev|name_en |name_ru
------+--------------------+------------------------------------------------------------
ID |Idaho |
IA |Iowa |
AL |Alabama |
AK |Alaska |
AZ |Arizona |
AR |Arkansas |
WY |Wyoming |
WA |Washington |
VT |Vermont |
VA |Virginia |
WI |Wisconsin |
DE |Delaware |
GA |Georgia |
WV |West Virginia |
IL |Illinois |
IN |Indiana |
CA |California |
KA |Kansas |
KY |Kentucky |
CO |Colorado |
CT |Connecticut |
LA |Louisiana |
MA |Massachusetts |
MN |Minnesota |
MS |Mississippi |
MO |Missouri |
MI |Michigan |
MT |Montana |
ME |Maine |
MD |Maryland |
NE |Nebraska |
NV |Nevada |
NH |New Hampshire |-
NJ |New Jersey |-
NY |New York |-
NM |New Mexico |-
OH |Ohio |
OK |Oklahoma |
DC |Washington DC | ( )
OR |Oregon |
PA |Pennsylvania |
RI |Rhode Island |-
ND |North Dakota |
NC |North Carolina |
TN |Tennessee |
TX |Texas |
FL |Florida |
SD |South Dakota |
SC |South Carolina |
UT |Utah |
(50 rows)
EOF
abbrev|name_en |name_ru
------+--------------------+----------------------------------------------
OH |Ohio |
OK |Oklahoma |
DC |Washington DC | ( )
OR |Oregon |
(4 rows)
EOF
abbrev|name_en |name_ru
------+--------------------+----------------------------------------------
ID |Idaho |
IA |Iowa |
AL |Alabama |
AK |Alaska |
AZ |Arizona |
AR |Arkansas |
WY |Wyoming |
WA |Washington |
VT |Vermont |
VA |Virginia |
WI |Wisconsin |
DE |Delaware |
GA |Georgia |
WV |West Virginia |
IL |Illinois |
IN |Indiana |
CA |California |
KA |Kansas |
KY |Kentucky |
CO |Colorado |
CT |Connecticut |
LA |Louisiana |
MA |Massachusetts |
MN |Minnesota |
MS |Mississippi |
MO |Missouri |
MI |Michigan |
MT |Montana |
ME |Maine |
MD |Maryland |
NE |Nebraska |
NV |Nevada |
NH |New Hampshire |-
NJ |New Jersey |-
NY |New York |-
NM |New Mexico |-
OH |Ohio |
OK |Oklahoma |
DC |Washington DC | ( )
OR |Oregon |
PA |Pennsylvania |
RI |Rhode Island |-
ND |North Dakota |
NC |North Carolina |
TN |Tennessee |
TX |Texas |
FL |Florida |
SD |South Dakota |
SC |South Carolina |
UT |Utah |
(50 rows)
EOF
abbrev|name_en |name_ru
------+--------------------+----------------------------------------------
ID |Idaho |
IA |Iowa |
AL |Alabama |
AK |Alaska |
AZ |Arizona |
AR |Arkansas |
WY |Wyoming |
WA |Washington |
VT |Vermont |
VA |Virginia |
WI |Wisconsin |
DE |Delaware |
GA |Georgia |
WV |West Virginia |
IL |Illinois |
IN |Indiana |
CA |California |
KA |Kansas |
KY |Kentucky |
CO |Colorado |
CT |Connecticut |
LA |Louisiana |
MA |Massachusetts |
MN |Minnesota |
MS |Mississippi |
MO |Missouri |
MI |Michigan |
MT |Montana |
ME |Maine |
MD |Maryland |
NE |Nebraska |
NV |Nevada |
NH |New Hampshire |-
NJ |New Jersey |-
NY |New York |-
NM |New Mexico |-
OH |Ohio |
OK |Oklahoma |
DC |Washington DC | ( )
OR |Oregon |
PA |Pennsylvania |
RI |Rhode Island |-
ND |North Dakota |
NC |North Carolina |
TN |Tennessee |
TX |Texas |
FL |Florida |
SD |South Dakota |
SC |South Carolina |
UT |Utah |
(50 rows)
EOF
#! /bin/sh
PATH=..:$PATH
echo "Testing PostgreSQL compilation..."
if ! test-pgsql-locale; then
exit 1
fi
LC_CTYPE=ru_RU.KOI8-R
LC_COLLATE=$LC_CTYPE
export LC_CTYPE LC_COLLATE
PGCLIENTENCODING=win
export PGCLIENTENCODING
echo "Testing LC_COLLATE..."
perl ../sort-test.pl test-koi8-sort.in > test-koi8-sort.out
diff expected/test-koi8-sort.out test-koi8-sort.out
### If you have Python - uncomment the following two lines
#python ../sort-test.py test-koi8-sort.in > test-koi8-sort.out
#diff expected/test-koi8-sort.out test-koi8-sort.out
abort() {
[ "$1" ] && echo "$*"
exit 1
}
for f in char varchar text; do
if echo $f | grep -q char; then
ftype="$f(60)"
else
ftype="$f"
fi
echo "Testing PgSQL: sort on $ftype type..."
destroydb testlocale >/dev/null 2>&1
createdb testlocale || abort "createdb failed"
psql -d testlocale -c "CREATE TABLE usastates (abbrev char(2), name_en char(20), name_ru $ftype);" >/dev/null 2>&1 || abort "createtable failed"
psql testlocale < test-koi8.sql.in > test-koi8-$f.sql.out 2>/dev/null || abort "test query failed"
diff expected/test-koi8-$f.sql.out test-koi8-$f.sql.out
done
echo "Testing PgSQL: select on regexp..."
psql testlocale < test-koi8-select.sql.in > test-koi8-select.sql.out 2>/dev/null || abort "select query failed"
diff expected/test-koi8-select.sql.out test-koi8-select.sql.out
destroydb testlocale || abort "destroydb failed"
echo "Finished."
SELECT * FROM usastates WHERE name_ru ~* '^.*' ORDER BY name_ru;
COPY usastates FROM stdin USING DELIMITERS '|';
AK|Alaska |
WA|Washington |
OR|Oregon |
CA|California |
NV|Nevada |
ID|Idaho |
UT|Utah |
AZ|Arizona |
MT|Montana |
WY|Wyoming |
CO|Colorado |
NM|New Mexico |-
ND|North Dakota |
SD|South Dakota |
NE|Nebraska |
KA|Kansas |
OK|Oklahoma |
TX|Texas |
MN|Minnesota |
IA|Iowa |
MO|Missouri |
AR|Arkansas |
LA|Louisiana |
WI|Wisconsin |
IL|Illinois |
IN|Indiana |
MS|Mississippi |
AL|Alabama |
MI|Michigan |
OH|Ohio |
KY|Kentucky |
TN|Tennessee |
GA|Georgia |
FL|Florida |
PA|Pennsylvania |
WV|West Virginia |
VA|Virginia |
NC|North Carolina|
SC|South Carolina|
NY|New York |-
NJ|New Jersey |-
DE|Delaware |
MD|Maryland |
DC|Washington DC | ( )
VT|Vermont |
MA|Massachusetts |
CT|Connecticut |
ME|Maine |
NH|New Hampshire |-
RI|Rhode Island |-
\.
SELECT * FROM usastates ORDER BY name_ru;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment