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 84F506EC40; Wed, 18 Aug 2021 20:18:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 84F506EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1629307124; bh=q3fQEJWWqaxmQ0XBDcuK5OzzmR62h7Kem3OaBDZztqU=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Vcs4RUoG5IbX2hymPMfxj2dPbJXLAZQpyFGi3aAi5x6xqdYsHIHKsTLOAZtJdcR6+ zSi/qv7qvtL3DzBA86Wcut7CcrFzUq3RFFAWC0lnbXpgBAADsiKK53uWmocrmVhBuY Fc8WuGEy0n95P/TETnEwVvEB2qMDfFrhtB4T/JJY= Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 65CE66EC40 for ; Wed, 18 Aug 2021 20:18:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 65CE66EC40 Received: by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1mGPD8-0002ky-CO; Wed, 18 Aug 2021 20:18:42 +0300 To: Vladimir Davydov , Timur Safin via Tarantool-patches Cc: v.shpilevoy@tarantool.org References: <906cfac8b66b70eb982b5c7fe4878da39712a305.1629071531.git.tsafin@tarantool.org> <20210817190515.gfvarox63jvltiti@esperanza> Message-ID: <77cf2850-48f3-ebf0-dafe-fb7710dbc787@tarantool.org> Date: Wed, 18 Aug 2021 20:18:29 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210817190515.gfvarox63jvltiti@esperanza> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD9ECFD080E047A606F56291F8739A291D6182A05F5380850408AA13717FE4E42DE87058F9020A941CBB90AA50709378436DBEAB3C5DC6DB33C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7B264C8851FD8E810EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063792EDBE6976DC04EF8F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB55337566F160826E4E1956AE23ADA53D064F43CCBBB8DA830D42BDB7A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE77A825AB47F0FC8649FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C332941D3B652364A4117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CF6006DAA84001027DBA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B6AC37AC2B1429C73A76E601842F6C81A1F004C906525384307823802FF610243DF43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C5C8BF3F796D5A11743847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A5E43FC05E3050383E0C03712BA6575056A1072CAA8FF215D7D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75C29D03FC76C37677410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3458239C6F30CE7ACFDB132C91ACA5428FF0FFA37C02965C7044D5B56BDD57247BAFBA9F167211F7E21D7E09C32AA3244CEE4D589A2EE80481872043DFB33EA7B664EE5813BBCA3A9DFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojGSxK+6r6oBGaNXRoW0lCbA== X-Mailru-Sender: 6CA451E36783D721CBEA96CEA26D325D997CDC7837C98CA4493B7B3F91157FD6B7CBEF92542CD7C82F97C478340294DCC77752E0C033A69E0F0C7111264B8915FF1320A92A5534336C18EFA0BB12DBB0 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 5/8] box, datetime: datetime comparison for indices 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: Safin Timur via Tarantool-patches Reply-To: Safin Timur Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On 17.08.2021 22:05, Vladimir Davydov via Tarantool-patches wrote: > On Mon, Aug 16, 2021 at 02:59:39AM +0300, Timur Safin via > Tarantool-patches wrote: >> diff --git a/test/engine/datetime.test.lua > b/test/engine/datetime.test.lua >> new file mode 100644 >> index 000000000..3685e4d4b >> --- /dev/null >> +++ b/test/engine/datetime.test.lua >> @@ -0,0 +1,35 @@ >> +env = require('test_run') >> +test_run = env.new() >> +engine = test_run:get_cfg('engine') >> + >> +date = require('datetime') >> + >> +_ = box.schema.space.create('T', {engine = engine}) >> +_ = box.space.T:create_index('pk', {parts={1,'datetime'}}) >> + >> +box.space.T:insert{date('1970-01-01')}\ >> +box.space.T:insert{date('1970-01-02')}\ >> +box.space.T:insert{date('1970-01-03')}\ >> +box.space.T:insert{date('2000-01-01')} > > We need more tests. Off the top of my head: > - unique constraint > - multi-part indexes > - index:get(key) / index:select(key) > - index:replace > - index:update / index:upsert > - dates before unix epoch and very big dates > - hint corner cases (when two different dates have the same hint) > - snapshot and recovery Sigh. Could you please to show the good example for such kind of tests for any data types? Because I modelled my tests after uuid, and decimal, and I didn't see that much to be checked usually. > >> + >> +o = box.space.T:select{} >> +assert(tostring(o[1][1]) == '1970-01-01T00:00Z') >> +assert(tostring(o[2][1]) == '1970-01-02T00:00Z') >> +assert(tostring(o[3][1]) == '1970-01-03T00:00Z') >> +assert(tostring(o[4][1]) == '2000-01-01T00:00Z') >> + >> +for i = 1,16 do\ >> + box.space.T:insert{date.now()}\ >> +end > > Please don't use now(), because it'd make it difficult to reproduce > a failure. > >> + >> +a = box.space.T:select{} >> +err = {} >> +for i = 1, #a - 1 do\ >> + if a[i][1] >= a[i+1][1] then\ >> + table.insert(err, {a[i][1], a[i+1][1]})\ >> + break\ >> + end\ >> +end >> + >> +err >> +box.space.T:drop()