File: tests-01.sql

package info (click to toggle)
icu-ext 1.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 336 kB
  • sloc: ansic: 2,701; sql: 764; makefile: 22; sh: 2
file content (80 lines) | stat: -rw-r--r-- 2,555 bytes parent folder | download | duplicates (3)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
-- regression tests for icu_ext

CREATE EXTENSION icu_ext;

-- Check that the database has the built-in ICU collations
-- required by the tests
SELECT collname FROM pg_collation WHERE collname IN
 ('und-x-icu', 'en-x-icu')
ORDER BY collname;

-- icu_char_name
SELECT c, to_hex(ascii(c)), icu_char_name(c)
   FROM regexp_split_to_table('El Niño', '') as c;

-- icu_character_boundaries
SELECT * FROM icu_character_boundaries('Ete'||E'\u0301', 'fr') as chars;

-- icu_collation_attributes
SELECT * FROM icu_collation_attributes('en') WHERE attribute <> 'version';

-- icu_compare
SELECT icu_compare('abcé', 'abce', 'en@colStrength=primary;colCaseLevel=yes');
SELECT icu_compare('Abcé', 'abce' COLLATE "en-x-icu");

-- icu_confusable_strings_check
SELECT txt, icu_confusable_strings_check('phil', txt) AS confusable
    FROM (VALUES ('phiL'), ('phiI'), ('phi1'), (E'ph\u0131l')) AS s(txt);

-- icu_confusable_string_skeleton
SELECT txt, icu_confusable_string_skeleton(txt) AS skeleton
    FROM (VALUES ('phiL'), ('phiI'), ('phi1'), (E'ph\u0131l'), (E'\u2026\u2026')) AS s(txt);

-- icu_line_boundaries
SELECT *,convert_to( contents, 'utf-8')
FROM icu_line_boundaries(
$$Thus much let me avow
You are not wrong, who deem
That my days have been a dream;
Yet if hope has flown away
In a night, or in a day,$$
, 'en');

-- icu_number_spellout
/* use the unaligned format for this test. With the aligned format,
   there are environment-related differences in how psql computes
   the width of strings containing U+00AD (soft hyphen) */
\pset format unaligned
SELECT loc, icu_number_spellout(1234, loc)
    FROM (values ('en'),('fr'),('de'),('ru'),('ja')) AS s(loc);
\pset format aligned

-- icu_replace
SELECT n,
   icu_replace(
      n,
     'jeanrene',
     '{firstname}',
     'und@colStrength=primary;colAlternate=shifted')
FROM (values('jeanrenédupont'),('Jean-René  Dupont')) as s(n)
ORDER BY n COLLATE "C";

-- icu_sentence_boundaries
SELECT * FROM icu_sentence_boundaries('Call me Mr. Brown. It''s a movie.',
 'en@ss=standard');

-- icu_strpos
SELECT v,icu_strpos('hey rene', v, 'und@colStrength=primary;colAlternate=shifted')
FROM (VALUES ('René'), ('rené'), ('Rene'), ('n'), ('në'), ('no'), (''), (null))
 AS s(v)
ORDER BY v COLLATE "C";

-- icu_transform
SELECT icu_transform('10\N{SUPERSCRIPT MINUS}\N{SUPERSCRIPT FOUR}'
		   '\N{MICRO SIGN}m = 1 \N{ANGSTROM SIGN}',
		 'Name-Any');

SELECT icu_transform('Ich muß essen.', '[:^ascii:]; Hex');

-- icu_word_boundaries
SELECT * FROM icu_word_boundaries($$Do you like O'Reilly books?$$, 'en');