From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 3E5D46E459; Mon, 22 Nov 2021 00:41:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3E5D46E459 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1637530889; bh=8hVQEB9wPDD5W4a4BMzG9EeqOBsG3M8shQkVuQBiBhU=; h=To:Cc:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Hql1lrInZ/cwB+viVIGH/AgNeTselgcY1pOYjGIsEpQ5AJ3rn5Og86GA4MVjErOLb BUclcWmVIhbCZGwfmbJq590mCJ7cmVI2x10tlHJ8D9bqQjze8Yhai/UK6R5S2k9/AI ltYqEVhiyrdkoyrv2m2Q6x249z+TcyzNG6Nio6BY= Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id E3A1F6E459 for ; Mon, 22 Nov 2021 00:41:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E3A1F6E459 Received: by mail-lf1-f54.google.com with SMTP id k37so71560922lfv.3 for ; Sun, 21 Nov 2021 13:41:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XMyKbU46r1FO09gftR8sddg3Sjmw/YkBVulk5jXTPUM=; b=r8NZ9XY5r9qr+oyzxewerJkRMpjRKYMAjEVacmWuYNdmkkrBvDIRNHSipeMqBsr+qX vxTdecWYnE1aLSBNJmjOGaADb5dNs5eotpqmux3EYZ3YdTATHoQijMI19SYxFD977fv6 NeQPxulih5Du2KrOLXJmnBo4OQ6wvQvJDipNHt359Ed5/7E5xbJD8bfo7efIhD68NZp/ VuKc+2Xbu0ouEaBLrwkKuN0qqevzwmYbRcsJlv78bU+mS/436bytS+jUB1ZzHjMFofoD Bln2F/DrRbgk3Oa0gkryAyavPMADOHoNZTS0M7jfsnuWIIHb/uBRS7GRopz5rzGvZEyI E+ow== X-Gm-Message-State: AOAM532hIx3NahcRT4DCNlwJ/oDEIqXHcd7YkrWjAwIy32IGFiJuoazL 3nnjMlSjR88KgGr96LSj6OQ7ER/lTCg= X-Google-Smtp-Source: ABdhPJzWZONdW5mf7d+uzEzCtM3z91tmbVABD1WFWDWhTYM0EPH+eEhyHbDDEWoO22T3aFqzTQCd+g== X-Received: by 2002:a2e:92c4:: with SMTP id k4mr46059223ljh.271.1637530885954; Sun, 21 Nov 2021 13:41:25 -0800 (PST) Received: from localhost.localdomain (109-252-85-87.nat.spd-mgts.ru. [109.252.85.87]) by smtp.gmail.com with ESMTPSA id g30sm697663lja.22.2021.11.21.13.41.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 13:41:25 -0800 (PST) X-Google-Original-From: Lord To: tarantool-patches@dev.tarantool.org Cc: Gleb Date: Mon, 22 Nov 2021 00:41:22 +0300 Message-Id: <20211121214122.103443-1-lord.nemo@protonmail.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH] sql: Update POSITION() tests X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Lord via Tarantool-patches Reply-To: Lord Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Gleb Updates positioning tests to correspond with KMP introduction patch. Removes unicode_ci-based tests and adds more tests on general correctness. Needed for tarantool/tarantool#6492 --- test/sql-tap/position.test.lua | 94 +++++++++++++++++++++++++--------- 1 file changed, 71 insertions(+), 23 deletions(-) diff --git a/test/sql-tap/position.test.lua b/test/sql-tap/position.test.lua index 6a96ed9bc..d35f00122 100755 --- a/test/sql-tap/position.test.lua +++ b/test/sql-tap/position.test.lua @@ -1,6 +1,66 @@ #!/usr/bin/env tarantool local test = require("sqltester") -test:plan(80) +test:plan(86) + +test:do_test( + "position-1.0.1", + function() + return test:execsql "SELECT position('ststs', 'statemenstrststs');" + end, { + -- + 12 + -- + }) + +test:do_test( + "position-1.0.2", + function() + return test:execsql "SELECT position('abc', 'abdcdefgabcabcabc');" + end, { + -- + 9 + -- + }) + +test:do_test( + "position-1.0.3", + function() + return test:execsql "SELECT position('aaabab', 'aabaaabab');" + end, { + -- + 4 + -- + }) + +test:do_test( + "position-1.0.4", + function() + return test:execsql "SELECT position('abcABCabc', 'abcABCDabcABCabc');" + end, { + -- + 8 + -- + }) + +test:do_test( + "position-1.0.5", + function() + return test:execsql "SELECT position('abc', 'abc');" + end, { + -- + 1 + -- + }) + +test:do_test( + "position-1.0.6", + function() + return test:execsql "SELECT position('a', 'bcdefg');" + end, { + -- + 0 + -- + }) test:do_test( "position-1.1", @@ -671,45 +731,43 @@ test:do_execsql_test( -- }) --- Tests that make use of collations. --- A short remainder of how "unicode" and "unicode_ci" collations --- works: --- unicode_ci: „a“ = „A“ = „á“ = „Á“. --- unicode: all symbols above are pairwise unequal. - --- Collation is set in space format. +-- Basic logic tests -test:do_execsql_test( +test:do_execsql_test( --TODO "position-1.63", [[ - CREATE TABLE test1 (s1 VARCHAR(5) PRIMARY KEY COLLATE "unicode_ci"); - INSERT INTO test1 VALUES('à'); - SELECT POSITION('a', s1) FROM test1; - DELETE FROM test1; + SELECT position('qwerqwer', 'qwertqwertyqwerqwerty') ]], { - 1 + -- + 12 + -- } ) test:do_execsql_test( "position-1.64", [[ - INSERT INTO test1 VALUES('qwèrty'); - SELECT POSITION('er', s1) FROM test1; + CREATE TABLE test1 (s1 VARCHAR(5) PRIMARY KEY COLLATE "unicode_ci"); + INSERT INTO test1 VALUES('qwèrtyqwertyqwerty'); + SELECT POSITION('qwertyqwerty', s1) FROM test1; DELETE FROM test1; ]], { - 3 + -- + 7 + -- } ) test:do_execsql_test( "position-1.65", [[ - INSERT INTO test1 VALUES('qwèrtÿ'); - SELECT POSITION('y', s1) FROM test1; + INSERT INTO test1 VALUES('qwèrtÿqwerty'); + SELECT POSITION('tÿqwer', s1) FROM test1; DELETE FROM test1; ]], { - 6 + -- + 5 + -- } ) -- 2.33.1