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 E43966B467; Fri, 26 Mar 2021 10:53:13 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E43966B467 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616745193; bh=gIILV7W2NjsKUG6C4fERN5GUlHvPf03RgTet8RefgEs=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=kVrCefCe0127Gi69l+a1Kh8DgQjZMGuewG9KdM1KzOx8THVrFyMP5nRCCfEfGkSN+ 7GpprlvQEefiVoRB/HOudiNKvXr0x8AA0W0NIHe9VCoxQr7Rm//MttmKhVUgmhW53s TyxIqcwoPHK1EuZaAnN746uTNfWP39tQFYTZ2ngM= Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (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 6F49E68F47 for ; Fri, 26 Mar 2021 10:44:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6F49E68F47 Received: by smtp63.i.mail.ru with esmtpa (envelope-from ) id 1lPh8y-00042u-Fk; Fri, 26 Mar 2021 10:44:32 +0300 To: Sergey Ostanevich , Igor Munkin Date: Fri, 26 Mar 2021 10:43:01 +0300 Message-Id: <2ffe160c0e47930914ff03996df38af1d9625767.1616743343.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9064ADF4728AA0EE9AECA9F3C9C9885BEE78E91CF33279E24182A05F5380850405620E043A509B5090650EC99210C358FFBF94B58739FE1A478975DB451E28ED6 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77BF46084C0059042EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637911538129B0A8D078638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C5DD32608FC869F5D2FE884325BFA2C9F1635E0A5A0349BFEA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE7ABB305BD10C6E5099FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3CF36E64A7E3F8E58117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD1A18204E546F3947C0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73528A6D463EDFD0DBBC4224003CC83647689D4C264860C145E X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C5DD32608FC869F5D2FE884325BFA2C9F1635E0A5A0349BFE9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFF532FBFD8162E58C699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3490011A262ADAEDFE6DB6EE65A5696E02BC7E6969160C0887D42F75E2F388ED7CBCCF00906EF45CB71D7E09C32AA3244CD535C603723BCE6991A9726A99E5D14A259227199D06760A927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojapPp7P/VpAjV4Gn1ncRN2w== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB41C04B83A8F859D25C37CE200D0FCECB7D42F93969D0DF7B7F2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 luajit 18/30] test: replace math.mod to math.fmod for Lua 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: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" In Lua 5.1 math.mod() is renamed to math.fmod() if build Lua 5.1 without flag `-DLUA_COMPAT_MOD`. LuaJIT has math.fmod() instead old-style math.mod() built-in. This patch replaces usage of math.mod with new-style math.fmod in the following files: * closure.lua * constructs.lua * math.lua * nextvar.lua Closes tarantool/tarantool#5711 Part of tarantool/tarantool#5845 Part of tarantool/tarantool#4473 --- test/PUC-Lua-5.1-tests/closure.lua | 3 ++- test/PUC-Lua-5.1-tests/constructs.lua | 6 ++++-- test/PUC-Lua-5.1-tests/math.lua | 3 ++- test/PUC-Lua-5.1-tests/nextvar.lua | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/PUC-Lua-5.1-tests/closure.lua b/test/PUC-Lua-5.1-tests/closure.lua index 27ca0ad..7f56ab8 100644 --- a/test/PUC-Lua-5.1-tests/closure.lua +++ b/test/PUC-Lua-5.1-tests/closure.lua @@ -254,7 +254,8 @@ function filter (p, g) while 1 do local n = g() if n == nil then return end - if math.mod(n, p) ~= 0 then coroutine.yield(n) end + -- LuaJIT: use `math.fmod()` instead old-style `math.mod()`. + if math.fmod(n, p) ~= 0 then coroutine.yield(n) end end end) end diff --git a/test/PUC-Lua-5.1-tests/constructs.lua b/test/PUC-Lua-5.1-tests/constructs.lua index 5fb3798..18d1789 100644 --- a/test/PUC-Lua-5.1-tests/constructs.lua +++ b/test/PUC-Lua-5.1-tests/constructs.lua @@ -202,7 +202,8 @@ function ID(x) return x end function f(t, i) local b = t.n - local res = math.mod(math.floor(i/c), b)+1 + -- LuaJIT: use `math.fmod()` instead old-style `math.mod()`. + local res = math.fmod(math.floor(i/c), b)+1 c = c*b return t[res] end @@ -233,7 +234,8 @@ repeat ]], s1, s, s1, s, s1, s, s1, s, s) assert(loadstring(s))() assert(X and not NX and not WX1 == K and not WX2 == K) - if math.mod(i,4000) == 0 then print('+') end + -- LuaJIT: use `math.fmod()` instead old-style `math.mod()`. + if math.fmod(i,4000) == 0 then print('+') end i = i+1 until i==c diff --git a/test/PUC-Lua-5.1-tests/math.lua b/test/PUC-Lua-5.1-tests/math.lua index 5076f38..8f0526f 100644 --- a/test/PUC-Lua-5.1-tests/math.lua +++ b/test/PUC-Lua-5.1-tests/math.lua @@ -100,7 +100,8 @@ assert(math.abs(-10) == 10) assert(eq(math.atan2(1,0), math.pi/2)) assert(math.ceil(4.5) == 5.0) assert(math.floor(4.5) == 4.0) -assert(math.mod(10,3) == 1) +-- LuaJIT: use `math.fmod()` instead old-style `math.mod()`. +assert(math.fmod(10,3) == 1) assert(eq(math.sqrt(10)^2, 10)) assert(eq(math.log10(2), math.log(2)/math.log(10))) assert(eq(math.exp(0), 1)) diff --git a/test/PUC-Lua-5.1-tests/nextvar.lua b/test/PUC-Lua-5.1-tests/nextvar.lua index 7ceaa75..81159dc 100644 --- a/test/PUC-Lua-5.1-tests/nextvar.lua +++ b/test/PUC-Lua-5.1-tests/nextvar.lua @@ -201,7 +201,8 @@ print('+') a = {} for i=0,10000 do - if math.mod(i,10) ~= 0 then + -- LuaJIT: use `math.fmod()` instead old-style `math.mod()`. + if math.fmod(i,10) ~= 0 then a['x'..i] = i end end -- 2.31.0