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 CAB0F55C707; Fri, 18 Aug 2023 13:43:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CAB0F55C707 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1692355399; bh=SshFP574+Q/1GEJoVWGRZiJNw1h9PE+GrH+woNw2UN4=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=k3G1U/64nZQY2yhhS4Ts1KfuhoKb2Fi7K6CYrXcGagQErS7Oycj7un2HHs00AWbzB 4vQA8FcJJ064MIhk2D3DZVPfUlxlZ/MKxmGQEQu/lCKoEi7ssBM0bEd0KLG64FeG1g +IH2K2UJD/kBbZtTds1CEfISrU4xtVfo5aOPs70M= Received: from smtp46.i.mail.ru (smtp46.i.mail.ru [95.163.41.84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 F26FA55C707 for ; Fri, 18 Aug 2023 13:43:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F26FA55C707 Received: by smtp46.i.mail.ru with esmtpa (envelope-from ) id 1qWwwn-004S83-3D; Fri, 18 Aug 2023 13:43:18 +0300 Message-ID: <29d67ed7-fed4-28ed-8dde-8030189008d6@tarantool.org> Date: Fri, 18 Aug 2023 13:43:17 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: Sergey Kaplun , Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org References: <28c7aec4df761b06208cc7ccd9055dd444ed2a70.1692089299.git.skaplun@tarantool.org> In-Reply-To: <28c7aec4df761b06208cc7ccd9055dd444ed2a70.1692089299.git.skaplun@tarantool.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9700E0DCE2907754D1F9D5B7CD6B34A186ED0A35A424B74BD182A05F538085040B3CA2FA36E60EE3FF7C76B498766FE77A0A4CF3D8FF4192440449B6BCC0B8D97 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BCC85671EC7A750CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006371777B963B59186248638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D801203276C1DD4901654F1117AB99B2F5117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCCD8DAA7A11EFD9E5A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C2A336C65186350916136E347CC761E074AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C30D7879B950AD227EBA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CF17B107DEF921CE791DD303D21008E298D5E8D9A59859A8B625DC386152A6764A75ECD9A6C639B01B78DA827A17800CE71D0063F52110EA4A731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A5F0585F48289D35E57EBD2FA87DC85F1AD9D28241BCED210EF87CCE6106E1FC07E67D4AC08A07B9B0CF7CD7A0D5AA5F25CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF3C1983756F5D182AA408C188BE1FFB5F138B89F9F8484EE4EE32BAC6818EDD9C42BBF92C36119C8524F7434E9608BF9FBC223AB5708C9889EE7BFF68ABAA3BBDE48CAC7CA610320002C26D483E81D6BE0DBAE6F56676BC7117BB6831D7356A2DEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojgZIFrgxvv3pNvIj0kVX2OQ== X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F2588458CCDB54D4FD9972E6C72B588CB9DDD9A1AF7FB42BDCBFC197282EC151BADDC1D3523A6D01B4765B2DFB59E2DDD9FE06B14FA522850F29BC30B0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 1/5] test: introduce `samevalues()` TAP checker 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: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey Thanks for the patch! See my comments inline. On 8/15/23 12:36, Sergey Kaplun wrote: > The introduced `samevalues()` helper checks that values in range from > 1, to `table.maxn()` of the given table are exactly the same. It may be > usefull for test consistency of JIT and VM behaviour. Originally, the > `arr_is_consistent()` function was introduced in the > . `samevalues()` has the same > functionallity (except usage of `table.maxn()` instead `#` operator to > be sure, that the table we check isn't a sparse array). I would rename samevalues to something like assert_equals or assert_items_equals just because similar functions are named in unit testing frameworks and helpers with prefix assert_ more readable from my point of view. See names for assertions in luatest [1] and JUnit (popular unit testing framework). 1. https://github.com/tarantool/luatest#list-of-luatest-functions 2. https://junit.org/junit5/docs/5.0.1/api/org/junit/jupiter/api/Assertions.html > --- > test/tarantool-tests/gh-6163-min-max.test.lua | 52 ++++++++----------- > test/tarantool-tests/tap.lua | 14 +++++ > 2 files changed, 37 insertions(+), 29 deletions(-) > > diff --git a/test/tarantool-tests/gh-6163-min-max.test.lua b/test/tarantool-tests/gh-6163-min-max.test.lua > index 63437955..4bc6155c 100644 > --- a/test/tarantool-tests/gh-6163-min-max.test.lua > +++ b/test/tarantool-tests/gh-6163-min-max.test.lua > @@ -2,25 +2,17 @@ local tap = require('tap') > local test = tap.test('gh-6163-jit-min-max'):skipcond({ > ['Test requires JIT enabled'] = not jit.status(), > }) > + Nit: Unneeded change. > diff --git a/test/tarantool-tests/tap.lua b/test/tarantool-tests/tap.lua > index 8559ee52..af1d4b20 100644 > --- a/test/tarantool-tests/tap.lua > +++ b/test/tarantool-tests/tap.lua > @@ -254,6 +254,19 @@ local function iscdata(test, v, ctype, message, extra) > return ok(test, ffi.istype(ctype, v), message, extra) > end > > +local function isnan(v) > + return v ~= v > +end > + I would put isnan() to utils, because it is not related to TAP module actually and can be useful for other tests too and exporting it in tap module will be strange. > +local function samevalues(test, got, message, extra) > + for i = 1, table.maxn(got) - 1 do > + if got[i] ~= got[i + 1] and not (isnan(got[i]) and isnan(got[i + 1])) then > + return fail(test, message, extra) > + end > + end > + return ok(test, true, message, extra) > +end > + > local test_mt > > local function new(parent, name, fun, ...) > @@ -372,6 +385,7 @@ test_mt = { > isudata = isudata, > iscdata = iscdata, > is_deeply = is_deeply, > + samevalues = samevalues, > like = like, > unlike = unlike, > }