<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi.</p>
<p>I have some questions related to the func.c file, however before
that I would ask you to fix tests.</p>
<p>General ideas:</p>
1. Those tests are regresson tests (it just tests that problem will
not appear in the future).<br>
We name those tests in the following manear:
gh-XXXX-short-description.test.lua<br>
2. The thing you test is not related to a table and other columns.<br>
Please, convert the tests to the next format: {[[select '' like
'_B';]], {1}]]}.<br>
To make it more readable, you can do it like `like_testcases` in
`sql-tap/collation.test.lua`.<br>
3. There is two extra things that should be tested:<br>
1. When string or pattern ends with incorrect unicode symbol
(e.g. half of the whole unicode symbol)<br>
2. String or pattern contains incorrect unicode symbol.<br>
<br>
Implementing 3 point may require some additional investigations.
E.g. it is ok for a blob to have invalid Unicode symbols.<br>
<blockquote type="cite"
cite="mid:CAEi+_aq3ibC1=3sN4On=P9rHOEB=mZexKEMo5rf1t=3aa6MBTg@mail.gmail.com">
<div dir="ltr">
<div class="gmail_quote">
<div>
<div>diff --git a/test/sql-tap/like1.test.lua
b/test/sql-tap/like1.test.lua</div>
<div>new file mode 100755</div>
<div>index 0000000..807ee65</div>
<div>--- /dev/null</div>
<div>+++ b/test/sql-tap/like1.test.lua</div>
<div>@@ -0,0 +1,181 @@</div>
<div>+#!/usr/bin/env tarantool</div>
<div>+test = require("sqltester")</div>
<div>+test:plan(16)</div>
<div>+</div>
<div>+test:do_catchsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.1",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>CREATE TABLE t2
(column1 INTEGER,</div>
<div>+<span style="white-space:pre"> </span> column2
VARCHAR(100),</div>
<div>+<span style="white-space:pre"> </span> column3
BLOB,</div>
<div>+<span style="white-space:pre"> </span> column4
FLOAT,</div>
<div>+<span style="white-space:pre"> </span> PRIMARY
KEY (column1, column2));</div>
<div>+<span style="white-space:pre"> </span>INSERT INTO t2
VALUES (1, 'AB', X'4142', 5.5);</div>
<div>+<span style="white-space:pre"> </span>INSERT INTO t2
VALUES (1, 'CD', X'2020', 1E4);</div>
<div>+<span style="white-space:pre"> </span>INSERT INTO t2
VALUES (2, 'AB', X'2020', 12.34567);</div>
<div>+<span style="white-space:pre"> </span>INSERT INTO t2
VALUES (-1000, '', X'', 0.0);</div>
<div>+<span style="white-space:pre"> </span>CREATE TABLE t1
(a INT PRIMARY KEY, str VARCHAR(100));</div>
<div>+<span style="white-space:pre"> </span>INSERT INTO t1
VALUES (1, 'ab');</div>
<div>+<span style="white-space:pre"> </span>INSERT INTO t1
VALUES (2, 'abCDF');</div>
<div>+<span style="white-space:pre"> </span>INSERT INTO t1
VALUES (3, 'CDF');</div>
<div>+<span style="white-space:pre"> </span>CREATE TABLE t
(s1 char(2) primary key, s2 char(2));</div>
<div>+<span style="white-space:pre"> </span>INSERT INTO t
VALUES ('AB', 'AB');</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+<span style="white-space:pre"> </span>--
<like-test-1.1></div>
<div>+<span style="white-space:pre"> </span>0</div>
<div>+<span style="white-space:pre"> </span>--
<like-test-1.1></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.2",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT column1,
column2, column1 * column4 FROM t2 WHERE column2 LIKE
'_B';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+<span style="white-space:pre"> </span>--
<like-test-1.2></div>
<div>+<span style="white-space:pre"> </span>1, 'AB', 5.5,
2, 'AB', 24.69134</div>
<div>+<span style="white-space:pre"> </span>--
<like-test-1.2></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.3",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT column1,
column2 FROM t2 WHERE column2 LIKE '%B';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+ -- <like-test-1.3></div>
<div>+ 1, 'AB', 2, 'AB'</div>
<div>+ -- <like-test-1.3></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.4",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT column1,
column2 FROM t2 WHERE column2 LIKE 'A__';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+ -- <like-test-1.4></div>
<div>+</div>
<div>+ -- <like-test-1.4></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.5",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT column1,
column2 FROM t2 WHERE column2 LIKE 'A_';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+ -- <like-test-1.5></div>
<div>+ 1, 'AB', 2, 'AB'</div>
<div>+ -- <like-test-1.5></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.6",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT column1,
column2 FROM t2 WHERE column2 LIKE 'A';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+ -- <like-test-1.6></div>
<div>+</div>
<div>+ -- <like-test-1.6></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.7",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT column1,
column2 FROM t2 WHERE column2 LIKE '_';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+ -- <like-test-1.7></div>
<div>+</div>
<div>+ -- <like-test-1.7></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.8",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT * FROM t
WHERE s1 LIKE '%A';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+ -- <like-test-1.8></div>
<div>+</div>
<div>+ -- <like-test-1.8></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.9",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT * FROM t
WHERE s1 LIKE '%C';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+ -- <like-test-1.9></div>
<div>+</div>
<div>+ -- <like-test-1.9></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.10",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT * FROM
t1 WHERE str LIKE '%df';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+ -- <like-test-1.10></div>
<div>+ 2, 'abCDF', 3, 'CDF'</div>
<div>+ -- <like-test-1.10></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.11",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT * FROM
t1 WHERE str LIKE 'a_';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+ -- <like-test-1.11></div>
<div>+ 1, 'ab'</div>
<div>+ -- <like-test-1.11></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.12",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT column1,
column2 FROM t2 WHERE column2 LIKE '__';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+ -- <like-test-1.12></div>
<div>+ 1, 'AB', 1, 'CD', 2, 'AB'</div>
<div>+ -- <like-test-1.12></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.13",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT str FROM
t1 WHERE str LIKE 'ab%';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+<span style="white-space:pre"> </span>--
<like-test-1.13></div>
<div>+<span style="white-space:pre"> </span>'ab', 'abCDF'</div>
<div>+<span style="white-space:pre"> </span>--
<like-test-1.13></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.14",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT str FROM
t1 WHERE str LIKE 'abC%';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+<span style="white-space:pre"> </span>--
<like-test-1.14></div>
<div>+<span style="white-space:pre"> </span>'abCDF'</div>
<div>+<span style="white-space:pre"> </span>--
<like-test-1.14></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.15",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>SELECT str FROM
t1 WHERE str LIKE 'a_%';</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+<span style="white-space:pre"> </span>--
<like-test-1.15></div>
<div>+<span style="white-space:pre"> </span>'ab', 'abCDF'</div>
<div>+<span style="white-space:pre"> </span>--
<like-test-1.15></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:do_execsql_test(</div>
<div>+<span style="white-space:pre"> </span>"like-test-1.16",</div>
<div>+<span style="white-space:pre"> </span>[[</div>
<div>+<span style="white-space:pre"> </span>DROP TABLE t1;</div>
<div>+<span style="white-space:pre"> </span>DROP TABLE t2;</div>
<div>+<span style="white-space:pre"> </span>DROP TABLE t;</div>
<div>+<span style="white-space:pre"> </span>]], {</div>
<div>+ -- <like-test-1.16></div>
<div>+</div>
<div>+ -- <like-test-1.16></div>
<div>+<span style="white-space:pre"> </span>})</div>
<div>+</div>
<div>+test:finish_test()</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>