6
0
mirror of https://github.com/FirebirdSQL/firebird-qa.git synced 2025-01-22 13:33:07 +01:00
firebird-qa/tests/bugs/core_4739_test.py

73 lines
2.7 KiB
Python
Raw Normal View History

2021-04-26 20:07:00 +02:00
#coding:utf-8
2022-01-24 20:27:02 +01:00
"""
ID: issue-5044
ISSUE: 5044
TITLE: Accent insensitive comparison: diacritical letters with DIAGONAL crossing
stroke pass only test on EQUALITY to their non-accented forms
2022-01-24 20:27:02 +01:00
DESCRIPTION:
JIRA: CORE-4739
FBTEST: bugs.core_4739
2022-01-24 20:27:02 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
import pytest
from firebird.qa import *
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
db = db_factory(charset='UTF8')
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
test_script = """
create collation co_utf8_ci_ai for utf8 from unicode case insensitive accent insensitive;
2021-04-26 20:07:00 +02:00
commit;
set list on;
set count on;
2022-01-24 20:27:02 +01:00
with recursive
d as (
select
2021-04-26 20:07:00 +02:00
cast( 'ḂĊḊḞĠṀṖṠṪ' || 'ẀẂŴŶ' || 'ŠŽ' || 'Ø' || 'Ð' || 'Ł' || 'Ŀ' || 'ĘĄĂÂÎŢŐŰĖÅĽĢÁÉÍÓÚÝÀÈÌÒÙÂÊÎÔÛÃÑÕÄËÏÖÜŸÇŠĄĘŹŻĂŞŢ' as varchar(80) character set utf8) s
,cast( 'BCDFGMPST' || 'WWWY' || 'SZ' || 'O' || 'D' || 'L' || 'L' || 'EAAAITOUEALGAEIOUYAEIOUAEIOUANOAEIOUYCSAEZZAST' as varchar(80) character set utf8) ascii_only_char
2022-01-24 20:27:02 +01:00
from rdb$database
)
,r as(select 1 i from rdb$database union all select r.i+1 from r where r.i < 100)
,e as(
select
substring(d.s from r.i for 1) non_ascii_char
,substring(d.ascii_only_char from r.i for 1) ascii_only_char
from d join r on r.i <= char_length(d.s)
)
,f as (
select
2021-04-26 20:07:00 +02:00
e.non_ascii_char --as utf_char
,e.ascii_only_char
2022-01-24 20:27:02 +01:00
,iif( e.non_ascii_char collate co_utf8_ci_ai = e.ascii_only_char, 1, 0 ) equal_test
2021-04-26 20:07:00 +02:00
,iif( e.non_ascii_char collate co_utf8_ci_ai between e.ascii_only_char and e.ascii_only_char, 1, 0 ) between_test
2022-01-24 20:27:02 +01:00
,iif( position(e.ascii_only_char, e.non_ascii_char collate co_utf8_ci_ai) >0 , 1, 0 ) pos_test
,iif( e.non_ascii_char collate co_utf8_ci_ai starting with e.ascii_only_char, 1, 0 ) start_with_test
,iif( e.non_ascii_char collate co_utf8_ci_ai like e.ascii_only_char, 1, 0 ) like_test
2021-04-26 20:07:00 +02:00
,iif( e.non_ascii_char collate co_utf8_ci_ai containing e.ascii_only_char, 1, 0 ) containing_test
2022-01-24 20:27:02 +01:00
,iif( e.non_ascii_char collate co_utf8_ci_ai similar to e.ascii_only_char, 1, 0 ) similar_to_letter_test
,iif( e.non_ascii_char collate co_utf8_ci_ai similar to '[[:ALPHA:]]', 1, 0 ) similar_to_alpha_test
from e
)
select *
from f
2021-04-26 20:07:00 +02:00
where minvalue( equal_test, between_test, pos_test, start_with_test, like_test, containing_test, similar_to_letter_test, similar_to_alpha_test ) = 0
order by non_ascii_char
2022-01-24 20:27:02 +01:00
;
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
act = isql_act('db', test_script)
2021-04-26 20:07:00 +02:00
2022-01-24 20:27:02 +01:00
expected_stdout = """
2021-04-26 20:07:00 +02:00
Records affected: 0
2021-12-22 20:23:11 +01:00
"""
2021-04-26 20:07:00 +02:00
@pytest.mark.intl
2021-04-26 20:07:00 +02:00
@pytest.mark.version('>=4.0')
2022-01-24 20:27:02 +01:00
def test_1(act: Action):
act.expected_stdout = expected_stdout
act.execute()
assert act.clean_stdout == act.clean_expected_stdout
2021-04-26 20:07:00 +02:00