Added a test

This commit is contained in:
Alexey Milovidov 2019-08-24 02:07:05 +03:00
parent d38e9ee229
commit cc0157b293
3 changed files with 21 additions and 1 deletions

View File

@ -85,7 +85,7 @@ private:
char_data += num_chars;
}
if constexpr (mode::trim_left)
if constexpr (mode::trim_right)
{
const char * found = find_last_not_symbols_or_null<' '>(char_data, char_end);
if (found)

View File

@ -0,0 +1,20 @@
WITH
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' AS x,
replaceRegexpAll(x, '.', ' ') AS spaces,
concat(substring(spaces, 1, rand(1) % 62), substring(x, 1, rand(2) % 62), substring(spaces, 1, rand(3) % 62)) AS s,
trimLeft(s) AS sl,
trimRight(s) AS sr,
trimBoth(s) AS t,
replaceRegexpOne(s, '^ +', '') AS slr,
replaceRegexpOne(s, ' +$', '') AS srr,
replaceRegexpOne(s, '^ *(.*?) *$', '\\1') AS tr
SELECT
replaceAll(s, ' ', '_'),
replaceAll(sl, ' ', '_'),
replaceAll(slr, ' ', '_'),
replaceAll(sr, ' ', '_'),
replaceAll(srr, ' ', '_'),
replaceAll(t, ' ', '_'),
replaceAll(tr, ' ', '_')
FROM numbers(100000)
WHERE NOT ((sl = slr) AND (sr = srr) AND (t = tr))