mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Add a test for countMatches()/countMatchesCaseInsensitive()
This commit is contained in:
parent
737357418f
commit
cbd4434a33
24
tests/queries/0_stateless/01595_countMatches.reference
Normal file
24
tests/queries/0_stateless/01595_countMatches.reference
Normal file
@ -0,0 +1,24 @@
|
||||
basic
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
case sensitive
|
||||
2
|
||||
1
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
4
|
||||
4
|
||||
case insensitive
|
||||
2
|
||||
1
|
||||
2
|
||||
2
|
||||
2
|
||||
2
|
||||
4
|
||||
4
|
||||
errors
|
29
tests/queries/0_stateless/01595_countMatches.sql
Normal file
29
tests/queries/0_stateless/01595_countMatches.sql
Normal file
@ -0,0 +1,29 @@
|
||||
select 'basic';
|
||||
select countMatches('', 'foo');
|
||||
select countMatches('foo', '');
|
||||
-- simply stop if zero bytes was processed
|
||||
select countMatches('foo', '[f]{0}');
|
||||
-- but this is ok
|
||||
select countMatches('foo', '[f]{0}foo');
|
||||
|
||||
select 'case sensitive';
|
||||
select countMatches('foobarfoo', 'foo');
|
||||
select countMatches('foobarfoo', 'foo.*');
|
||||
select countMatches('oooo', 'oo');
|
||||
select countMatches(concat(toString(number), 'foofoo'), 'foo') from numbers(2);
|
||||
select countMatches('foobarbazfoobarbaz', 'foo(bar)(?:baz|)');
|
||||
select countMatches('foo.com bar.com baz.com bam.com', '([^. ]+)\.([^. ]+)');
|
||||
select countMatches('foo.com@foo.com bar.com@foo.com baz.com@foo.com bam.com@foo.com', '([^. ]+)\.([^. ]+)@([^. ]+)\.([^. ]+)');
|
||||
|
||||
select 'case insensitive';
|
||||
select countMatchesCaseInsensitive('foobarfoo', 'FOo');
|
||||
select countMatchesCaseInsensitive('foobarfoo', 'FOo.*');
|
||||
select countMatchesCaseInsensitive('oooo', 'Oo');
|
||||
select countMatchesCaseInsensitive(concat(toString(number), 'Foofoo'), 'foo') from numbers(2);
|
||||
select countMatchesCaseInsensitive('foOBarBAZfoobarbaz', 'foo(bar)(?:baz|)');
|
||||
select countMatchesCaseInsensitive('foo.com BAR.COM baz.com bam.com', '([^. ]+)\.([^. ]+)');
|
||||
select countMatchesCaseInsensitive('foo.com@foo.com bar.com@foo.com BAZ.com@foo.com bam.com@foo.com', '([^. ]+)\.([^. ]+)@([^. ]+)\.([^. ]+)');
|
||||
|
||||
select 'errors';
|
||||
select countMatches(1, 'foo') from numbers(1); -- { serverError 43; }
|
||||
select countMatches('foobarfoo', toString(number)) from numbers(1); -- { serverError 44; }
|
Loading…
Reference in New Issue
Block a user